-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Suggestion: Prefer to _not_ use two argument version of raise #747
Comments
Upon further investigation we had disabled the rule instead of setting it to "EnforcedStyle: compact". I would still suggest a change in default, but it seems that Rubocop has this covered. Nice. 👌 |
Actually, can I suggest that this gets split into two rules:
I think this is a more sensible approach. Because now I can't enable the rule without changing all instances. |
I'm totally open to improving the existing rule. Keep in mind the following:
I think it's mostly a matter of misaligned expectations. |
Related rubocop/rubocop#8175 |
Tracked in #395 |
Just hit this surprising behavior of
raise
.These two lines are not equivalent:
In the former case the third argument will be silently ignored causing an error like this:
This is a confusion can be avoided by simply calling
new
directly. (Also IMO is clearer about what's really happening when you callraise
, a simple object construction.)Alternatively a Rubocop rule could be introduced to detect when more than two arguments are passed to
raise
.The text was updated successfully, but these errors were encountered: