-
-
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
Style/SignalException is bit too inclusive about the fail scope #2875
Comments
There's no way we can possibly detect every situation where |
I think it's not a good idea to shadow This is the first time someone reports such an issue in 3 years, so I'm not sure whether it's worth investing any efforts here. On the other hand - trivial cases should be easy to handle. |
The question is, if someone wants to define a custom |
The consumers of my utility class use Foo.fail instead of (Kernel.)fail, therefore it's not really an issue as there's no namespace conflict. As you can see, my utility class is made of static methods, but some methods in Foo may call the fail method defined in its scope which triggers this issue in RuboCop. If this deserves a cop, I'm OK with it. |
I should have read the example code. :-) This would be easy to fix. |
What if we don't flag any call to |
Uhh... that's what we already do. Forget what I said. |
I am glad that the great debate about raise/fail is finally over, having to refactor my code in the process (see #2732). However, Style/SignalException shouldn't really apply to this piece of code:
By trying to workaround the issue with:
There's:
$ rubocop Inspecting 1 file C Offenses: code.rb:11:5: C: Redundant self detected. self.fail 'nice reason for failing instead of ugly stack trace' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
2010 really want their memes back, but I was ready to drop a rageface over this one.
LE: forgot to add this:
The text was updated successfully, but these errors were encountered: