Skip to content
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

false positive for Style/Mixin #5261

Closed
marcandre opened this issue Dec 14, 2017 · 2 comments · Fixed by #5272
Closed

false positive for Style/Mixin #5261

marcandre opened this issue Dec 14, 2017 · 2 comments · Fixed by #5272
Labels

Comments

@marcandre
Copy link
Contributor

marcandre commented Dec 14, 2017

I get a complaint for the following code:

module X
  def foo
    include Bar
  end
end

"Style/MixinUsage: include is used at the top level. Use inside class or module"

No, it's not used at the top level.

$ rubocop -v
0.52.0
@Drenmi Drenmi added the bug label Dec 15, 2017
@pocke
Copy link
Collaborator

pocke commented Dec 16, 2017

Definitely, the include is an instance method of X, so the cop should not complain about the code. cc: @koic

@koic
Copy link
Member

koic commented Dec 17, 2017

Thanks for the feedback. I confirmed this reproduction. I'm thinking about opening a PR for this issue later.

koic added a commit to koic/rubocop that referenced this issue Dec 19, 2017
…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.
bbatsov pushed a commit that referenced this issue Dec 20, 2017
…de module

Fixes #5261.

Correspondence to use case for `include` belonging to module was
insufficient. This PR added a reproduction test and fixed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants