Last active
September 18, 2020 21:48
-
-
Save mculp/c3e723aaed8f84b830708c3e1dbcb9ec to your computer and use it in GitHub Desktop.
run rubocop as a git precommit hook
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 | |
files=$(git status -s | grep -E 'A|M' | awk '{print $2}') | |
files="$files $(git status -s | grep -E 'R' | awk '{print $4}')" | |
echo $files | xargs $(which rubocop) --display-cop-names --extra-details --parallel --force-exclusion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment