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
[Fix #7299] Implement Lint/RaiseException cop #7325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a small nit for the matcher. 🚀
Thanks @denys281! 🙏 |
Lint/RaiseException: | ||
Description: Checks for `raise` or `fail` statements which is raise `Exception` class. | ||
Enabled: true | ||
VersionAdded: '0.75' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this in the style guide? If so - let's add a link to the rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bbatsov no, we have only this one https://github.com/rubocop-hq/ruby-style-guide#no-blind-rescues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we can add something on the subject there then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bbatsov Did you mean in style guide?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
092beae
to
8bd6403
Compare
Better late than never! :-) Thanks! |
- introduced in 0.81.0, rubocop/rubocop#7325
- introduced in 0.81.0, rubocop/rubocop#7325
Resolves #7299
Should go with rubocop/ruby-style-guide#775
Cop checks for:
raise Exception
;raise Exception, 'error message'
;fail
and::Exception
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.