Skip to content

Instantly share code, notes, and snippets.

@kouheiszk
Last active August 29, 2018 01:28
Show Gist options
  • Save kouheiszk/ed0052ada723e8bae2ece954ff548e9e to your computer and use it in GitHub Desktop.
Save kouheiszk/ed0052ada723e8bae2ece954ff548e9e to your computer and use it in GitHub Desktop.
#!/bin/bash
rules=$(bundle exec rubocop --parallel --cache true --format json | jq '[.files[].offenses | map(.cop_name)] | flatten | unique' | jq -r '.[] | .')
for rule in $rules; do
echo "Start fix auto correct: $rule"
bundle exec rubocop --auto-correct --cache true --only $rule
if [[ ! -z $(git status -s) ]]; then
git commit -am ":cop: auto correct $rule"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment