From e4c86df7b2093ffa5592e54700254f7f0a3b9bf7 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 9 Apr 2018 17:19:47 +0200 Subject: [PATCH] Auto correct Rubocop's Layout/CaseIndentation cop --- .rubocop_todo.yml | 9 --------- app/models/enterprise.rb | 12 ++++++------ app/models/product_importer.rb | 4 ++-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 78cda1c170..2708b078b6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -84,15 +84,6 @@ Layout/AlignParameters: - 'spec/lib/open_food_network/user_balance_calculator_spec.rb' - 'spec/support/request/authentication_workflow.rb' -# Offense count: 8 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, IndentOneStep, IndentationWidth. -# SupportedStyles: case, end -Layout/CaseIndentation: - Exclude: - - 'app/models/enterprise.rb' - - 'app/models/product_importer.rb' - # Offense count: 3 # Cop supports --auto-correct. Layout/ClosingParenthesisIndentation: diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 8b0f3fe385..5e04d3b498 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -289,17 +289,17 @@ class Enterprise < ActiveRecord::Base # Map backend cases to front end cases. case cat - when "producer_sells_any" + when "producer_sells_any" :producer_hub # Producer hub who sells own and others produce and supplies other hubs. - when "producer_sells_own" + when "producer_sells_own" :producer_shop # Producer with shopfront and supplies other hubs. - when "producer_sells_none" + when "producer_sells_none" :producer # Producer only supplies through others. - when "non_producer_sells_any" + when "non_producer_sells_any" :hub # Hub selling others products in order cycles. - when "non_producer_sells_own" + when "non_producer_sells_own" :hub # Wholesaler selling through own shopfront? Does this need a separate name? Should it exist? - when "non_producer_sells_none" + when "non_producer_sells_none" :hub_profile # Hub selling outside the system. end end diff --git a/app/models/product_importer.rb b/app/models/product_importer.rb index d4b490f2c5..fe33379289 100644 --- a/app/models/product_importer.rb +++ b/app/models/product_importer.rb @@ -364,9 +364,9 @@ class ProductImporter def assign_defaults(object, entry) @import_settings[entry['supplier_id'].to_s]['defaults'].each do |attribute, setting| case setting['mode'] - when 'overwrite_all' + when 'overwrite_all' object.assign_attributes(attribute => setting['value']) - when 'overwrite_empty' + when 'overwrite_empty' if object.send(attribute).blank? or (attribute == 'on_hand' and entry['on_hand_nil']) object.assign_attributes(attribute => setting['value']) end