Skip to content

Commit

Permalink
Merge pull request #324 from testdouble/change-case-indentation
Browse files Browse the repository at this point in the history
Change case indentation to match if/else
  • Loading branch information
camilopayan authored Mar 23, 2022
2 parents 350e08f + 437cba5 commit 91d40ed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 2 additions & 3 deletions config/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ Layout/BlockEndNewline:
Enabled: true

Layout/CaseIndentation:
# Disabled because IndentOneStep can't be configured for one-liner cases. See:
# https://github.com/rubocop-hq/rubocop/issues/6447
Enabled: false
Enabled: true
EnforcedStyle: end

Layout/ClassStructure:
Enabled: false
Expand Down
10 changes: 10 additions & 0 deletions test/fixture/cli/autocorrectable-bad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,13 @@ def bad_function(test: true, a:, b:)
b
end
end

def count_carbs(food)
carbs = case food
when :pancakes
23
when :mushrooms
4
end
carbs + 1
end
10 changes: 10 additions & 0 deletions test/fixture/cli/autocorrectable-good.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,13 @@ def bad_function(a:, b:, test: true)
b
end
end

def count_carbs(food)
carbs = case food
when :pancakes
23
when :mushrooms
4
end
carbs + 1
end

0 comments on commit 91d40ed

Please sign in to comment.