Created
November 10, 2020 17:54
-
-
Save hcarvalhoalves/089c8878e4007361b82ae9d54e4ad2ee to your computer and use it in GitHub Desktop.
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 | |
# Add to project/.git/hooks/ w/ +x permission | |
echo "Running pre-commit linter..." | |
files=$(git diff --diff-filter=d --cached --name-only | grep -E '\.(base|clj)$' | tr '\n' ' ' | xargs) | |
lein do cljfmt fix $files, nsorg -e $files | |
if [ $? -ne 0 ]; then | |
echo "Pre-commit failed on staged files. Please check your code and try again." | |
exit 1 # exit with failure status | |
fi | |
git add $files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment