-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid offense with Lint/EndAlignment on if statements #2399
Comments
I came across this recently as well. Feel free to work on it. If not, I was going to try and knock it out soon. |
I take that back, I was thinking of auto-correct not aligning the The correct style that I am thinking of is: arr << if foo
1
else
2
end |
Having looked at this a bit last night, with |
The comment that describes # The value `variable` means that in assignments, `end` should be aligned
# with the start of the variable on the left hand side of `=`. In all other
# situations, `end` should still be aligned with the keyword. so this behavior is not a bug. In #2317 we made the If we keep widening the scope of the |
I find |
So we want to have a |
Sorry, maintainers: can you please confirm whether you agree that |
👍 from me on |
Yeah, let's go for |
You want |
For those of you who are here via a google search and are looking to fill in the blank: # SupportedStylesAlignWith: keyword, variable, start_of_line
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: ________________________ EnforcedStyleAlignWith: keywordarr << if foo
1
else
2
end
var1 = if bar
1
else
2
end EnforcedStyleAlignWith: variablearr << if foo
1
else
2
end
var1 = if bar
1
else
2
end EnforcedStyleAlignWith: start_of_linearr << if foo
1
else
2
end
var1 = if bar
1
else
2
end |
When
AlignWith
is set tovariable
,if
statements treated as arguments are flagged as offenses.Example:
This appears to have been reported with
case
statements here: #2317. Can we apply the same treatment toif
statements? I'm also wondering ifstart_of_line
wouldn't be a more appropriate style name. Happy to follow up with a commit. Just looking for a 👍 that this is expected behavior.Miscellaneous:
The text was updated successfully, but these errors were encountered: