Skip to content

Instantly share code, notes, and snippets.

@lujanfernaud
Last active February 27, 2020 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lujanfernaud/149c3414a1d328ac51966f3826d5fe0c to your computer and use it in GitHub Desktop.
Save lujanfernaud/149c3414a1d328ac51966f3826d5fe0c to your computer and use it in GitHub Desktop.
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