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

Feature Request: Matching Cop to Lint/UnneededDisable: Lint/UnneededEnable #5356

Closed
jfelchner opened this issue Dec 29, 2017 · 5 comments
Closed

Comments

@jfelchner
Copy link
Contributor

The Lint/UnneededDisable is very useful, but part of the problem with using it is that, if you wrap code like this:

# rubocop:disable Layout/ExtraSpacing
def bar
  puts 'hi'
end
# rubocop:enable Layout/ExtraSpacing

Making the Lint/UnneededDisable cop happy (either manually or with autocorrection) leaves the enable line even though it's no longer needed.

It'd be great to have a cop to handle this use case as well.

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 30, 2017

Yeah, that's a good idea. Although it should be named UndeededCopEnableDirective. We agreed a while ago that we would rename this UnneededDisable to UnneededCopDisableDirective, but I guess we forgot to do so.

@garettarrowood
Copy link
Contributor

garettarrowood commented Dec 30, 2017

This appears to be a dup of our oldest open issue, #2543 , and #3001 . It also looks like they got resolved by a new Lint/MissingCopEnableDirective. Does this accomplish our goal, or are we not seeing this fire when it should?

@jfelchner
Copy link
Contributor Author

jfelchner commented Dec 30, 2017

@garettarrowood You are correct that this issue is a dupe of #2543 but it is not a dupe of #3001. The functionality I'm asking for is the opposite of Lint/MissingCopEnableDirective.

#3001 describes what the Lint/MissingCopEnableDirective does.

What I'm asking for is a cop that flags if there's a rubocop:enable that is not needed (because the cop(s) were never disabled).

@garettarrowood
Copy link
Contributor

garettarrowood commented Dec 30, 2017

@jfelchner - Thanks for the clarification! And sorry for the confusion!

@garettarrowood
Copy link
Contributor

Ok. I think I'll tackle this today.

garettarrowood added a commit to garettarrowood/rubocop that referenced this issue Dec 31, 2017
@bbatsov bbatsov closed this as completed in 626d25f Jan 3, 2018
This was referenced Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants