-
-
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/MixinUsage false positive in specs #5059
Comments
Thanks for opening issue. I can reproduce it. I think that this minimum case will be below. do_something(include(M)) The difficulty is that it can not be judged by receiver object whether it is However, as indicated in the issue example, there are some cases where it becomes false positive with RSpec. So it may be a practical solution to make |
I agree @koic. AFAIK, if the This would also mean the fix should be trivial: return if include_node.argument? |
@Drenmi Thanks for comment and advice. I will open a PR to resolve this issue. |
Fixes rubocop#5059. This PR solves the issue based on false positives detected against RSpec `Include matcher`. https://relishapp.com/rspec/rspec-expectations/v/2-0/docs/matchers/include-matcher If an `include` method is called with a method argument, treat it as false negative. In this case, it's safe to assume it's not a mixin.
Fixes #5059. This PR solves the issue based on false positives detected against RSpec `Include matcher`. https://relishapp.com/rspec/rspec-expectations/v/2-0/docs/matchers/include-matcher If an `include` method is called with a method argument, treat it as false negative. In this case, it's safe to assume it's not a mixin.
Thanks! |
The Style/MixinUsage finds false positive inside specs on the current master branch of RuboCop
Expected behavior
Does not report a lint
Actual behavior
Reports a lint
Steps to reproduce the problem
my_class_spec.rb
Real world use case: https://github.com/brigade/scss-lint/blob/master/spec/scss_lint/reporter_spec.rb
RuboCop version
Include the output of
rubocop -V
. Here's an example:The text was updated successfully, but these errors were encountered: