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 #5261] Fix false positive for Style/MixinUsage
when using inside module
#5272
[Fix #5261] Fix false positive for Style/MixinUsage
when using inside module
#5272
Conversation
@@ -58,6 +68,28 @@ class C | |||
RUBY | |||
end | |||
|
|||
it 'registers an offense when using `include` in method definition ' \ |
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.
does not register :-)
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.
Oops! I fixed it 💦
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.
There was a slight misunderstanding. This was good with registers
, the other was not good. #5272 (comment)
Thank you for pointing out.
RUBY | ||
end | ||
|
||
it 'registers an offense when using `include` in method definition ' \ |
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.
does not register :-)
df1e39c
to
ee78395
Compare
…ng inside module Fixes rubocop#5261. Correspondence to use case for `include` belonging to module was insufficient. This PR added a reproduction test and fixed it.
ee78395
to
1e491db
Compare
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
For the record: This PR also seems to fix false positives that we're seeing with 0.52.0 on code like class Foo
if GlobalConfig.special_logging?
include LogInstrumentation
end
end |
Fixes #5261.
Correspondence to use case for
include
belonging to module was insufficient. This PR added a reproduction test and fixed it.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.