-
-
Notifications
You must be signed in to change notification settings - Fork 288
Fix a false positive for RSpec/ScatteredSetup when the hook is defined inside a class method
#2147
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 a false positive for RSpec/ScatteredSetup when the hook is defined inside a class method
#2147
Conversation
You should use Ruby 3.4 (as specified in .ruby-version), but an Ruby version agnostic alternative has been suggested in #2144. For now, reverting/ignoring the documentation change was the correct call. 👍🏼 |
|
@bquorning ah, that explains it, I'm using |
bquorning
left a comment
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.
This looks useful. But it seems it doesn’t consider the other ways of defining class methods:
class << self
def foo
end
end
ce8a208 to
c587a4c
Compare
|
@bquorning I feel that the |
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.
@ydah What is your opinion?
…ned inside a class method Fixes rubocop#2146
c587a4c to
9e60861
Compare
|
@bquorning I had to push another fix because I've realized too late that it won't work with multiline The PR should be OK now, apologies for pushing too soon. |
ydah
left a comment
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.
Thank you!
bquorning
left a comment
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.
Thank you @d4rky-pl 🙏🏼
This PR fixes a false positive in
RSpec/ScatteredSetupby ignoring the hooks defined inside class methods.Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif the new code introduces user-observable changes.bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).