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

auto-correct leads to wrong offense count, if lines are removed #1032

Closed
MartinKoerner opened this issue Apr 25, 2014 · 1 comment
Closed
Assignees
Labels

Comments

@MartinKoerner
Copy link

Original output:

rubocop functional/test.rb 
Inspecting 1 file
C

Offenses:

functional/test.rb:5:1: C: Extra empty line detected at body beginning.
functional/test.rb:7:121: C: Line is too long. [181/120]
    puts 'This line is too long this line is too long this line is This line is too long this line is too long this line is This line is too long this line is too long this line is'
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
functional/test.rb:9:1: C: Extra blank line detected.
functional/test.rb:10:5: C: Do not introduce global variables.
    $app.processEvents(Qt::EventLoop::AllEvents, 2000)
    ^^^^
functional/test.rb:11:1: C: Extra empty line detected at body end.

1 file inspected, 5 offenses detected

Output with --auto-corret:

rubocop functional/test.rb --auto-correct
Inspecting 1 file
C

Offenses:

functional/test.rb:5:1: C: [Corrected] Extra empty line detected at body beginning.
functional/test.rb:6:121: C: Line is too long. [181/120]
    puts 'This line is too long this line is too long this line is This line is too long this line is too long this line is This line is too long this line is too long this line is'
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
functional/test.rb:7:121: C: Line is too long. [181/120]
    puts 'This line is too long this line is too long this line is This line is too long this line is too long this line is This line is too long this line is too long this line is'
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
functional/test.rb:8:5: C: Do not introduce global variables.
    $app.processEvents(Qt::EventLoop::AllEvents, 2000)
    ^^^^
functional/test.rb:9:1: C: [Corrected] Extra blank line detected.
functional/test.rb:10:5: C: Do not introduce global variables.
    $app.processEvents(Qt::EventLoop::AllEvents, 2000)
    ^^^^
functional/test.rb:11:1: C: [Corrected] Extra empty line detected at body end.

1 file inspected, 7 offenses detected, 3 offenses corrected

Output afterwards:

rubocop functional/test.rb          
Inspecting 1 file
C

Offenses:

functional/test.rb:6:121: C: Line is too long. [181/120]
    puts 'This line is too long this line is too long this line is This line is too long this line is too long this line is This line is too long this line is too long this line is'
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
functional/test.rb:8:5: C: Do not introduce global variables.
    $app.processEvents(Qt::EventLoop::AllEvents, 2000)
    ^^^^

1 file inspected, 2 offenses detected
rubocop -V
0.20.1 (using Parser 2.1.7, running on jruby 1.9.3 java)
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 25, 2014

@jonas054, please have a look at this.

bbatsov added a commit that referenced this issue Apr 26, 2014
[Fix #1032] Avoid duplicate reporting during --auto-correct
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

3 participants