Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RuboCop: Autocorrect Using Specific Cops

RuboCop: Autocorrect Using Specific Cops

We can autocorrect using only some cops by passing --only CopType/CopName.

rubocop --only Style/HashTransformKeys

First run with --safe-auto-correct to see the affected changes:

rubocop --safe-auto-correct --only Style/HashTransformKeys,Style/HashTransformValues,Style/HashEachMethods

Then run it with --auto-correct (-a):

rubocop -a --only Style/HashTransformKeys,Style/HashTransformValues,Style/HashEachMethods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.