-
-
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
Metrics/ModuleLength disabling not respected when rubocop runs inside subdirectory #3664
Comments
Looks like the new |
Use the AllCops:
DisplayCopNames: true It helps a bunch with debugging. |
I've added cop names to the $ cd spec
$ rubocop
Inspecting 1 file
C
Offenses:
example_spec.rb:3:1: C: Metrics/BlockLength: Block has too many lines. [27/25]
describe 'Example' do ...
^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected Somehow, that cop is not disabled as expected when I run robocop from inside the subdirectory. |
Did you disable |
I just realized In particular, |
Thanks for pointing me in the right direction. In my original mistake, as you pointed out I disabled In any case, I can remove the offenses that were bothering me by using a different exclusion in my Metrics/ModuleLength:
Exclude:
- "**/*_spec.rb"
Metrics/BlockLength:
Exclude:
- "**/*_spec.rb" I am closing this ticket, because I have a good workaround, but I'll leave it up to you to consider maybe changing the default regex so that Atom users don't get bit by this. Thanks a lot for the help: Your time is appreciated. |
I am running into this issue now, and it's related to AtomLinter/linter-rubocop#174. I'd like to request changing the default to what @ylansegal suggested. |
Starting in version 0.47.0, there is no longer a default setting for |
Expected behavior
I want to disable the Metrics/ModuleLength cop. If rubocop runs from inside a subdirectory of the project, the configuration is not respected. To reproduce, create the following two files:
When running rubocop from the root of the project. It works as expected, and no offenses are found:
$ rubocop Inspecting 1 file . 1 file inspected, no offenses detected
When running inside the spec directory, the cop doesn't seem to be disabled
Actual behavior
This behavior is only present in
0.44.1
, but not in0.43.0
RuboCop version
Note: I noticed this issue running rubocop from inside Atom, using the linter-rubocop package, which modifies the present working directory to be the one that contains the file passed to rubpcop.
Thank you for maintaining this project: It provides great value to the ruby community.
The text was updated successfully, but these errors were encountered: