skryukov / rubocop-gradual

Gradually improve your code with RuboCop
MIT License
36 stars 0 forks source link

Config loads differently based on something #19

Closed pboling closed 10 months ago

pboling commented 10 months ago

Or... maybe it is doing something extra at the end of the task, but only sometimes?

Using the rubocop shim hack (with autocorrect):

❯ bundle exec rubocop -a
Inspecting 109 file(s) for autocorrection...
.............................................................................................................
Fixed 0 file(s).
...........................................................................................................................................................................................................................................................
Found 142 files with 6203 issue(s).
Processing results...
RuboCop Gradual got 1 issue(s) fixed, 6203 left. Keep going!
bundle exec rubocop -a  48.45s user 6.64s system 200% cpu 27.541 total

Using the rake check task locally the process appears to run as expected:

❯ bundle exec rake rubocop_gradual:check
Running RuboCop Gradual...
...........................................................................................................................................................................................................................................................
Found 142 files with 6203 issue(s).
Processing results...
RuboCop Gradual got no changes.
bundle exec rake rubocop_gradual:check  45.73s user 6.49s system 172% cpu 30.274 total

However, in CI we get a different results from the same rake check task, running against the same code, same git SHA:

+ bundle exec rake rubocop_gradual:check
Program Name: /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.7.0/bin/rake
Not using any observers because program name isn't rails, passenger, or rspec
Running RuboCop Gradual...
...........................................................................................................................................................................................................................................................
Found 142 files with 6203 issue(s).
Processing results...
RuboCop Gradual got 1 issue(s) fixed, 6203 left. Keep going!
RuboCop Gradual failed!
Unexpected Changes!
RuboCop Gradual lock file is outdated, to fix this message:
- Run `rubocop-gradual` locally and commit the results, or
- EVEN BETTER: before doing the above, try to fix the remaining issues in those files!
`.rubocop_gradual.lock` diff:
+  "config/environments/development.rb:4085136686": [
+    [13, 5, 42, "Rails/Blank: Use `ENV[\"TOPICS\"].blank?` instead of `ENV[\"TOPICS\"].nil? || ENV[\"TOPICS\"].empty?`.", 75732059]
+  ],

I'm at a loss for how this is possible.

pboling commented 10 months ago

Closing this - as I am not sure exactly what happened here. The possibility of running rubocop on unstaged changes and those lines leaking into the canonical lockfile is a possible culprit.