Auto correct Rubocop's Layout/CaseIndentation cop

This commit is contained in:
Pau Perez
2018-04-09 17:19:47 +02:00
parent 1357c7c3b5
commit e4c86df7b2
3 changed files with 8 additions and 17 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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