Adding makandra-rubocop to an existing code base
Most of the time it is a tedious task to apply a code style guide to an existing code base as there are likely to be a lot of conflicts. At makandra we are using makandra-rubocop to have code style checks. Here is some advice on how to add makandra-rubocop efficiently.
Run rubocop in parallel
To bost performance rubocop can process in parallel (just not in combination with every switch):
$ rubocop --parallel # or short: $ rubocop -p
Apply Cops separately
If you want to review each correction, it is easier to run each Cop separately. This way you know what kind of change to expect and don't have to find out what changed.
1. List conflicting cops
$ rubocop --parallel --format offenses 1815/1815 files |========================== 100 ===========================>| Time: 00:00:00 1074 Lint/Void 418 Naming/VariableNumber 255 Style/StringLiterals ... -- 4727 Total
2. Correct a single Cop
$ rubocop --auto-correct --only Style/StringLiterals
2.1 Or correct an entire category
$ rubocop --auto-correct --only Style
3. Review changes
$ git add -p