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

Single line disable broken? #862

Closed
askreet opened this issue Mar 10, 2014 · 3 comments · Fixed by #867
Closed

Single line disable broken? #862

askreet opened this issue Mar 10, 2014 · 3 comments · Fixed by #867
Labels

Comments

@askreet
Copy link

askreet commented Mar 10, 2014

From the documentation it seems like a trailing line # rubocop:disable LineLength should disable LineLength for only that line, however the following file passes rubocop version 0.18.1:

# This class has some class-level documentation that tells you all about how
# great it is.
class MyClass
  puts 'This is a very long line, but we will tell Rubocop to ignore it because it is very important to us.' # rubocop:disable LineLength

  puts 'This line on the other hand is awful and really needs to be refactored, so Rubocop should alert us about that.'
end

If I remove the disable comment, both lines are reported as violations.

Is this a bug, or am I misunderstanding the purpose of single-line disable comments?

Edit: If I am misunderstanding the purpose of the end-of-line comment, then I'll submit a feature request to have something like # rubocop:skip CopName for exactly this purpose.

@jonas054
Copy link
Collaborator

Sure looks like a bug to me.

@jonas054 jonas054 added the bug label Mar 10, 2014
@jonas054
Copy link
Collaborator

Last time I used git bisect I got it wrong, but maybe this time the result is correct. It should be this commit that introduced the bug. Seems likely looking at the commit message. (Although looking at the date one can't help but wonder if this feature is used much.)

commit 3b7d7cb16bb98fda62511bb311e65dbe7cc8df4c
Author: Yuji Nakayama <nkymyj@gmail.com>
Date:   Sat Jul 13 16:03:36 2013 +0900

    Refactor SourceParser#disabled_lines_in and improve performance

Could you take a look, @yujinakayama?

@yujinakayama
Copy link
Collaborator

@jonas054 OK.

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

Successfully merging a pull request may close this issue.

3 participants