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
Is your feature request related to a problem? Please describe.
I only learned about the power of case statements quite recently, so there are lots of opportunities in my code that could be written more nicely with a cop that recognizes these patterns. I am sure there are others with the same situation.
Describe the solution you'd like
If there is an if/elsif/else construct with at least one elsif and all conditions can be translated appropriately, suggest using a case/when construct instead.
Additional context
E.g. something like this can be translated:
if a == 1
# do something
elsif a == 2 || a == 3
# do something
end
Or something like this:
if a.is_a?(Integer)
handle_integer(a)
elsif a.is_a?(Float)
handle_float(a)
end
Note that I might even implement this myself eventually, I'll just add the issue so it's tracked.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I only learned about the power of case statements quite recently, so there are lots of opportunities in my code that could be written more nicely with a cop that recognizes these patterns. I am sure there are others with the same situation.
Describe the solution you'd like
If there is an if/elsif/else construct with at least one elsif and all conditions can be translated appropriately, suggest using a case/when construct instead.
Additional context
E.g. something like this can be translated:
Or something like this:
Note that I might even implement this myself eventually, I'll just add the issue so it's tracked.
The text was updated successfully, but these errors were encountered: