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

Lint/UnneededDisable Exclude is ignored. #3036

Closed
boc-tothefuture opened this issue Apr 12, 2016 · 1 comment
Closed

Lint/UnneededDisable Exclude is ignored. #3036

boc-tothefuture opened this issue Apr 12, 2016 · 1 comment
Assignees
Labels

Comments

@boc-tothefuture
Copy link

The Lint/UnneededDisable does not honor the excludes

Expected behavior

I would expect that if I explicitly exclude a file or set of files from the this cop then that cop will not trigger an error.

Actual behavior

Cop triggers an error on explicitly excluded files.

Steps to reproduce the problem

Create a file with an unnecessarily disabled rule:

# Disable style cop to enable metadata DSL to line up for readability
# rubocop:disable Style/SingleSpaceBeforeFirstArg
#
foo       'qux'
bar       'quux'
baz       'garply'

Exclude the file in your configuration:

Lint/UnneededDisable:
  Exclude:
    - '**/metadata.rb'

Output from a run:

bundle exec rubocop -c /tmp/github/exclude.yml -D /tmp/github/metadata.rb 
Inspecting 1 file
W

Offenses:

/tmp/github/metadata.rb:2:1: W: Lint/UnneededDisable: Unnecessary disabling of Style/SingleSpaceBeforeFirstArg (did you mean Style/SpaceBeforeFirstArg?).
# rubocop:disable Style/SingleSpaceBeforeFirstArg
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

Note that if the rule is globally disabled, it will not execute the cop. So, it seems to just not be honoring the excludes.

RuboCop version

bundle exec rubocop -V
0.39.0 (using Parser 2.3.0.7, running on ruby 2.1.6 x86_64-linux)

@jonas054 jonas054 self-assigned this Apr 24, 2016
@jonas054 jonas054 added the bug label Apr 24, 2016
@jonas054
Copy link
Collaborator

That's a bug. I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants