rubocop / guard-rubocop

Guard plugin for RuboCop
MIT License
262 stars 55 forks source link

Output differs from running Rubocop standalone #33

Closed ehannes closed 7 years ago

ehannes commented 7 years ago

I get different outputs from guard-rubocop and standalone rubocop. In the example below, guard-rubocop reports 1 offenses but rubocop standalone reports 8. How could that be? Is it possible that guard-rubocop runs an older version of rubocop?

guard-rubocop reports the following errors:

10:03:08 - INFO - Inspecting Ruby code style: spec/requests/admin/orders_spec.rb
Inspecting 1 file
C

Offenses:

spec/requests/admin/orders_spec.rb:116:40: C: Style/SpaceInsideHashLiteralBraces: Space inside } missing.
        let(:parameters) { { year: year} }
                                       ^

1 file inspected, 1 offense detected

rubocop reports the following errors:

$ rubocop spec/requests/admin/orders_spec.rb 
Inspecting 1 file
C

Offenses:

spec/requests/admin/orders_spec.rb:84:13: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
            let(:delivery_week_2) { create_delivery(end_of_week(year, week)) }
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:90:13: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
            let(:delivery_week_2) { create_delivery(middle_of_week) }
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:107:9: C: RSpec/EmptyLineAfterSubject: Add empty line after subject.
        subject { response }
        ^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:109:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { { week: week } }
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:114:9: C: RSpec/EmptyLineAfterSubject: Add empty line after subject.
        subject { response }
        ^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:116:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { { year: year} }
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:116:40: C: Style/SpaceInsideHashLiteralBraces: Space inside } missing.
        let(:parameters) { { year: year} }
                                       ^
spec/requests/admin/orders_spec.rb:127:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { {} }
        ^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 8 offenses detected
yujinakayama commented 7 years ago

You should run rubocop and guard with prefix bundle exec. bundle exec rubocop and bundle exec guard should output same results.