I have a large code base and am using RuboCop to make it adhere to standards. I've started using RuboCop v0.90.0 this week, and am seeing behaviour that I cannot explain.
When executing rubocop -x (for only formatting offenses) to auto-correct offenses, a lot of "auto-correctable" offenses will be noticed but not fixed.
$ rubocop -x
...
753 files inspected, 522 offenses detected, 5 offenses corrected, 517 offenses auto-correctable
Running rubocop -x again will then fix 2 or 3 more offenses, and so on. It is not really practical to fix all offenses this way. Seeing the same behaviour for rubocop -a, by the way.
We are also using rubocop-rails and rubocop-rspec, and have custom RuboCop configuration files to enable and disable Cops.
Things I tried that did not fix this:
- disabled both
rubocop-railsandrubocop-rspec - also disabled all custom RuboCop configuration files
- running on smaller sets of files (eg
rubocop -x app/models/)
Can anyone point me in the right direction to try and solve this? (Very hesitant to call this a RuboCop bug as I'm seeing nothing like this in their Issues list, and we do have a large and ugly code base.)
Edit with some more results
rubocop -Agives me537 files inspected, 5161 offenses detected, 3876 offenses corrected, 482 offenses auto-correctableas a result. I would still not expect this "482 offenses auto-correctable" after running with-A.rubocop -A --only Layout/SpaceInsideBlockBracesfor example seems to fix all offenses for this Cop, butrubocop -A --only Layout/LineLengthdoes nothing at all. That might be something. I have to think about running this for some more Cops and seeing results.- Nope,
rubocop -A --only Layout/SpaceInsideBlockBracesonly detects 1 new offense every run, fixes that one, and the next run finds a new offense and fixes that one. Hmmmmmm.