Created
June 13, 2016 16:11
-
-
Save romellem/2b063de21cd1f90c585060fe803b3dac to your computer and use it in GitHub Desktop.
Git hook - Post-commit spell check (using `aspell`)
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 | |
ASPELL=$(which aspell) | |
if [ $? -ne 0 ]; then | |
echo "Aspell not installed - unable to check spelling" >&2 | |
exit | |
else | |
WORDS=$($ASPELL --mode=email --add-email-quote='#' list < "$1" | sort -u) | |
fi | |
if [ -n "$WORDS" ]; then | |
printf "\e[1;33m Possible spelling errors found in commit message:\n\e[0m\e[0;31m%s\n\e[0m\e[1;33m Use git commit --amend to change the message.\e[0m\n\n" "$WORDS" >&2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use,
./git/hooks/
Tested on Mac OS 10.10.5