You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The branching helps understanding clearly which result is expected for which conditions. And in the doc examples we can see that it is well suited for simple if-else cases.
Describe the solution you'd like
Having an option that allows for multiple branches to stay as it is:
I'm the author of this cop. TBH, I didn't consider this case when I made this. So, I think it's good to allow when multiple elsifs are used instead of the new option. OTOH, if there is only single elsif, elsif will not exist due to autocorrection. So I think the current behavior can be kept. I've opened #11007.
koic
added a commit
to koic/rubocop
that referenced
this issue
Sep 16, 2022
…teralBranches`
Fixesrubocop#11006.
This PR allows multiple `elsif` for `Style/IfWithBooleanLiteralBranches`.
I think it's good to allow when multiple `elsif`s are used instead of a new config option.
OTOH, if there is only single `elsif`, `elsif` will not exist due to autocorrection.
So I think the current behavior can be kept.
…anches`
Fixes#11006.
This PR allows multiple `elsif` for `Style/IfWithBooleanLiteralBranches`.
I think it's good to allow when multiple `elsif`s are used instead of a new config option.
OTOH, if there is only single `elsif`, `elsif` will not exist due to autocorrection.
So I think the current behavior can be kept.
Is your feature request related to a problem? Please describe.
The below method would in my opinion loose in readability if it were corrected by rubocop:
source
The branching helps understanding clearly which result is expected for which conditions. And in the doc examples we can see that it is well suited for simple if-else cases.
Describe the solution you'd like
Having an option that allows for multiple branches to stay as it is:
Describe alternatives you've considered
disabling the rule, but this would make me miss the simple if-else which are to be removed.
The text was updated successfully, but these errors were encountered: