-
Notifications
You must be signed in to change notification settings - Fork 552
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
Determine if use of guard clauses should be enforced #452
Comments
/cc @bf4 @sferik @xaviershay @amatsuda Gentlemen, what do you think? Personally I'd prefer a simple if/else statement over a guard clause any time because it is easier to parse the control flow of the method this way imho, so I'd drop this particular cop. |
I tend to prefer guard clause but don't think this is a thing that should be enforced by rubocop either way - depends on code context too much. |
👍 to what @xaviershay said. |
Agreed! Context matters a lot with this technique. I think it makes sense to proceed with the cop turned off. Closing this out... |
Thanks for giving your thoughts everyone, let's keep it this way then! 👏 |
As per @colszowka's request, this issue is for discussion between the contributors to determine if the
Style/GuardClause
cop should be enabled. This came up while bringing the codebase into compliance with the latestrubocop
version. For the time being, the cop has been disabled.Here's the existing method in the codebase that raised this question.
For what it's worth, my two cents: I like that the use of guard clauses, where appropriate, reduces the level of indentation in a method, so I'm in favor of enabling the cop.
The text was updated successfully, but these errors were encountered: