Posted 9 months ago. Visible to the public.

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

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Daniel Straßner
Last edit:
8 months ago
by Michael Leimstädtner
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Daniel Straßner to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more