In our builds (which have been executing on circleci for many years) we have a step which runs rubocop: bundle exec rubocop --format quiet
Recently these have been failing episodically (unpredictably) with some kind of outdated configuration complaint. “Rerun from failed” makes the error go away.
Here’s an example output:
Error: `Performance` cops have been extracted to the `rubocop-performance` gem.
(obsolete configuration found in .rubocop_todo.yml, please update it)
`Rails` cops have been extracted to the `rubocop-rails` gem.
(obsolete configuration found in .rubocop_todo.yml, please update it)
Exited with code exit status 2
All the examples I’ve seen are running with the v2 container runtime (Docker Executor Infrastructure Upgrade ) however it also runs ok in the v2 container runtime and most of our runs now use this, so I’m not convinced it’s linked.
However I can’t work out what’s going on - I would expect a rubocop run to be totally deterministic. Is there any chance I should be using rubocop with the “–no-server” flag on circleci?
Apologies - nothing to do with CircleCI. It’s a rubocop issue, solved in rubocop:master:
opened 02:35PM - 05 Mar 25 UTC
closed 05:55PM - 05 Mar 25 UTC
bug
Every so often, rubocop fails for me, reporting
```
Error: `Performance` cops … have been extracted to the `rubocop-performance` gem.
(obsolete configuration found in .rubocop.yml, please update it)
```
(I've also seen the error with `Rails cops have been extracted to the rubocop-rails gem.`)
I am using the rubocop-performance gem, and my .rubocop.yml loads it as a plugin. This only occurs on a tiny percentage of runs, apparently at random.
--------
## Expected behavior
No random failures
## Actual behavior
```shellsession
$ while bundle exec rubocop --debug bin ; end
#... many successful runs ...
For /Users/jon/Developer/haml-lint: configuration from /Users/jon/Developer/haml-lint/.rubocop.yml
Default configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-1.73.2/config/default.yml
Plugin configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-rails-2.30.3/config/default.yml
Plugin configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-rake-0.7.1/config/default.yml
Plugin configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-rspec-3.5.0/config/default.yml
Plugin configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-performance-1.24.0/config/default.yml
configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/config/default.yml
configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/config/default.yml
configuration from /Users/jon/Developer/haml-lint/.devenv/state/.bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/config/default.yml
Error: `Performance` cops have been extracted to the `rubocop-performance` gem.
(obsolete configuration found in .rubocop.yml, please update it)
Finished in 0.28030199999921024 seconds
```
## Steps to reproduce the problem
* Check out https://github.com/jdelStrother/haml-lint-extracted-cops
* (ignore the repo name - I originally thought this was an issue in haml-lint, but have since narrowed it down to just rubocop)
* `bundle install`
* Run in a loop with something like `while bundle exec rubocop bin ; do true; done`
* be patient, this can take hundreds of runs before the issue appears
## RuboCop version
Include the output of `rubocop -V` or `bundle exec rubocop -V` if using Bundler.
If you see extension cop versions (e.g. `rubocop-performance`, `rubocop-rspec`, and others)
output by `rubocop -V`, include them as well. Here's an example:
```
$ bundle exec rubocop -V
1.73.2 (using Parser 3.3.7.1, rubocop-ast 1.38.1, analyzing as Ruby 3.4, running on ruby 3.3.5) [arm64-darwin24]
- rubocop-rails 2.30.3
- rubocop-rake 0.7.1
- rubocop-rspec 3.5.0
- rubocop-performance 1.24.0
- rubocop-capybara 2.21.0
- rubocop-factory_bot 2.26.1
- rubocop-rspec_rails 2.30.0
```
I've also seen the problem occur on ruby 3.3, and on a linux VM inside of Github Actions.
master
← koic:fix_false_alarm_for_extracted_cop
opened 04:16AM - 10 Mar 25 UTC
Follow-up to https://github.com/rubocop/rubocop/issues/13950#issuecomment-270911… 2256
This prevents an unexpected warning that occurred because the config obsoletion was not considered in the plugin system introduced in #13792.
-----------------
Before submitting the PR make sure the following are checked:
* [x] The PR relates to *only* one subject with a clear title and description in grammatically correct, complete sentences.
* [x] Wrote [good commit messages][1].
* [ ] Commit message starts with `[Fix #issue-number]` (if the related issue exists).
* [x] Feature branch is up-to-date with `master` (if not - rebase it).
* [x] Squashed related commits together.
* [x] Added tests.
* [x] Ran `bundle exec rake default`. It executes all tests and runs RuboCop on its own code.
* [x] Added an entry (file) to the [changelog folder](https://github.com/rubocop/rubocop/blob/master/changelog/) named `{change_type}_{change_description}.md` if the new code introduces user-observable changes. See [changelog entry format](https://github.com/rubocop/rubocop/blob/master/CONTRIBUTING.md#changelog-entry-format) for details.
[1]: https://chris.beams.io/posts/git-commit/
1 Like