-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Suggestion : No rescue without class #2943
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
Comments
We already have something like this. |
does that cover simply writing |
Maintainers, do we want something like this? There are a lot of Ruby codebases which use idioms like:
|
@alexdowad I think we have a cop that checks for this very same thing. :-) I think |
I looked into this briefly. From what I found the To me that sounds like a different cop. Does that sound right to others as well? |
@HParker That sounds right. The message from |
@HParker: Agree with both of you on that. 😀 |
This cop checks for cases where `rescue` is used without specifying one or more errors to rescue, e.g.: ``` begin foo rescue bar end ```
Why |
it's about being explicit and forcing people to think about what they want to rescue instead of gobbling up all errors. That was the main idea behind my feature request for this. |
The difference is saying "I'm deliberately rescuing |
Hello,
just a small suggestion.
Would it be possible to create a cop that checks rescue statements and if they are actually catching a specific error?
This would be accepted:
And these 2 examples would not be accepted anymore:
It's kinda a policy we have in our team that specific errors should be caught and not just every globbed up.
The text was updated successfully, but these errors were encountered: