Reputation: 2929
How do I get rubo-cop to accept the following as correct for case select:
variable = case some_other_variable
when 'some value' then 'some result'
when 'some other value' then 'some other result'
when 'one more value' then 'one more result'
end
I have this currently in my .rubocop.yml
:
CaseIndentation:
EnforcedStyle: end
IndentOneStep: true
but it keeps erroring like this:
C: Layout/CaseIndentation: Indent when one step more than end.
when 'some value' then 'some result'
What am I doing wrong and how can I fix it ?
Upvotes: 3
Views: 1532
Reputation: 33420
It says
- Indent when as deep as case
- When assigning the result of a conditional expression to a variable, preserve the usual alignment of its branches
So it could be valid for Rubocop this way:
variable = case some_other_variable
when 'some value' then 'some result'
when 'some other value' then 'some other result'
when 'one more value' then 'one more result'
end
Or this way
variable =
case some_other_variable
when 'some value' then 'some result'
when 'some other value' then 'some other result'
when 'one more value' then 'one more result'
end
Upvotes: 2