-
-
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
GuardClause cop for loops #1010
Comments
maybe it could be called |
I like it. That's something we keep forgetting to fix all over the place, and the Question: How should it deal with more pathological cases, like foos.each do |foo|
if foo['bar'] then
# do *n* lines of something
else
if foo['quux'] then
# do *m* lines of something else
else
# more bloviation here
end
end
end I'd argue that the appropriate response would be to send a WTF email to everybody on the team; as a more practical workaround, should this new cop (or another related new cop) read this guy the riot act? Come to think of it, this would be more appropriate as a different cop, yes? Something like |
I think this cop should only take action if there is a single |
What do you think about a cop that that checks for something similar to a guard clause but in loops. So something like this:
bad
good
What do you think and how should this be called?
The text was updated successfully, but these errors were encountered: