-
-
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
Lint/UnneededDisable reports a warning if rubocop:disable all
is used inside a block with already disabled cop
#3580
Comments
It's not the
So I guess this is the expected behavior. You can disable the cop by simply adding
to your |
Damn, I didn't really read the offense output. :-) Not a bug indeed. |
rubocop:disable all
is used inside a block with already disabled coprubocop:disable all
is used inside a block with already disabled cop
Ouch, yeah, subject mentioned a wrong cop. I still think that there is an issue: right now there is no way to disable all cops in situations like: class Whatever
# So so code
# rubocop:disable Cop1,Cop2,Cop3
def method_one
end
def method_two
end
# Code is total garbage
# rubocop:disable all
def method_three
end
end which is quite useful during cleanups (i. e. we do not want to introduce new offenses in the first part and don't care about second part because no one has touched it yet). AFAIU right now we can: As I've said in the first comment, I expect And, even if my reading of |
Absolutely. |
The cop
This is clearly the case in a file with # rubocop:disable Style/ParallelAssignment
# rubocop:disable all
x, y = 1, 2 So
should not be the expected behavior. If this cop wouldn't detect an offense here, I'd call it a bug. |
Add proper handling of two scenarios. The first is that a `rubocop:disable all` comment precedes a comment disabling a specific cop. The second is the other way around.
If
# rubocop:disable all
is used inside of code block with some cops already disabled, Lint/UselessAssignment reports a warning. For example for code:Actual behavior
Expected behavior
No warnings reported,
# rubocop:disable all
is used to disable all remaining cops, not all initially enabled cops.RuboCop version
The text was updated successfully, but these errors were encountered: