Created
December 29, 2022 12:42
-
-
Save ekohl/b41006003553dce67b9c551f306f8080 to your computer and use it in GitHub Desktop.
A script to fix things in rubocop_todo.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -x | |
bundle exec rubocop --auto-gen-config --no-auto-gen-timestamp --no-offense-counts | |
TODO=$(~/.local/bin/yq -r '. | keys[]' .rubocop_todo.yml | grep -vE 'Layout/LineLength|Lint/UriEscapeUnescape|Naming/MethodParameterName|Layout/DefEndAlignment|Layout/IndentationConsistency') | |
echo > .rubocop_todo.yml | |
if [[ -n "$(git status --porcelain)" ]] ; then | |
git commit -m '[TMP] clean Rubocop TODO' .rubocop_todo.yml | |
fi | |
for COP in $TODO ; do | |
bundle exec rubocop --auto-correct-all --only $COP | |
if [[ -n "$(git status --porcelain)" ]] ; then | |
git commit -am "Fix Rubocop $COP" | |
fi | |
done | |
bundle exec rubocop --auto-gen-config --no-auto-gen-timestamp --no-offense-counts | |
git commit -m 'Regenerate Rubocop TODO' .rubocop_todo.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment