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

End-of-line disable comments can't be used to disable an offense in a comment #7708

Closed
jeffkowalski opened this issue Feb 12, 2020 · 0 comments
Assignees

Comments

@jeffkowalski
Copy link

Per @jonas054 in #1625:

End-of-line disable comments can't be used to disable an offense in a comment, currently. It will work like the other kind of disable comment, the one that needs an enable. It's an edge case, but it seems like a bug to me.

@jeffkowalski Please open a new issue. If you mention me in it, I will try to fix the problem.

Expected behavior

Disable an offense for a single-line comment, returning the enable state afterward

Actual behavior

Disable comment has no effect on code comment

Steps to reproduce the problem

$ cat test.rb 
# coding: utf-8     # rubocop:disable Style/Encoding
# frozen_string_literal: true

$ rubocop test.rb
Inspecting 1 file
W

Offenses:

test.rb:1:1: W: Lint/MissingCopEnableDirective: Re-enable Style/Encoding cop with # rubocop:enable after disabling it.
# coding: utf-8     # rubocop:disable Style/Encoding
^

1 file inspected, 1 offense detected

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ rubocop --version
0.78.0
@jonas054 jonas054 self-assigned this Feb 16, 2020
@koic koic closed this as completed in 4412bed Feb 17, 2020
koic added a commit that referenced this issue Feb 17, 2020
…_comment

[Fix #7708] Support EOL disable comments on comment lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants