-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Cop idea: enforce a style for include
, extend
, prepend
, etc.
#3936
Labels
Comments
include
and extend
include
, extend
, prepend
, etc.
I agree. That's a good idea. It would also need a style guide rule. Same applies to the |
Drenmi
added a commit
to Drenmi/rubocop
that referenced
this issue
Jan 29, 2017
This cop checks for grouping of `mixins` in class and `module` bodies. By default, it enforces a separated style, i.e.: ``` class Foo include Bar include Qux end ``` but it can be configured to enforce a grouped style as well.
Thanks for implementing @Drenmi! |
Note that the include TestModule1
include TestModule2
#=> TestModule1 before TestModule2
include TestModule1, TestModule2
include TestModule2
#=> TestModule2 before TestModule1
# You can run this in irb:
module TestModule1; end; module TestModule2; end;
class TestClass1; include TestModule1, TestModule2; end; TestClass1.ancestors
class TestClass2; include TestModule1; include TestModule2; end; TestClass2.ancestors |
@PikachuEXE: Wow. Great catch! My assumptions were totally wrong here. 😅 Patch incoming. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I see two distinct styles for mixing in modules:
Style 1
Style 2
It would be nice to be able to enforce either of these styles
The text was updated successfully, but these errors were encountered: