-
Notifications
You must be signed in to change notification settings - Fork 213
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
Consider disabling Style/EmptyCaseCondition #229
Comments
I appreciate the spirit of this and I'm always open to cases where keywords like |
Thanks for clarification! I see your point, but I'd like to then ask, wouldn't the same argument (many developers don't know how case statement works) apply in the following example too? case string
when "foo" then puts "hi!"
when /^foo.*/ then puts "ho!"
end This might not be the best example, but my point is that it's possible that multiple when conditions can match the variable, but only the first matching one will be executed. This was never confusing [to me], as I've never seen I hope, I could explain myself, as with the above example, the standard gem will be happy, but the developers who don't know how case statements work in Ruby will still be confused. |
I often use empty |
Also, case # rubocop:disable Style/EmptyCaseCondition
when search_term then by_term
... is kind of common in our code base :) (yeah, this can be disabled but still doesn't) |
I don't find either of following code snippets to be better than the other:
in fact, me and colleagues use the first example more often.
original discussion: rubocop/rubocop#3019
The text was updated successfully, but these errors were encountered: