You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harry Levine edited this page May 12, 2018
·
3 revisions
How to use RuboCop
RuboCop is a Ruby static code analyzer. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.
To run it locally with Docker, you will call make rubocop. This will list out any offenses that need to be addressed, before a pull request can be merged to production.
By default, it will be ran as part of the make test command.
How to auto-correct offending files for a cop
Some of RuboCop's cops offer an auto-correct option. Here are the steps to implement that feature, for a given cop.
For this example, we'll use the Style/StringLiterals style cop.
Confirm that the cop is present in the .rubocop_todo.yml file
In the .rubocop_todo.yml file, confirm that the cop supports --auto-correct