Skip to content

Instantly share code, notes, and snippets.

@grigory-rechistov
Created June 23, 2020 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grigory-rechistov/d7ee6708574e54f8303ca6d703177e59 to your computer and use it in GitHub Desktop.
Save grigory-rechistov/d7ee6708574e54f8303ca6d703177e59 to your computer and use it in GitHub Desktop.
Check spelling in Git commit hook
# Add this snippet to the end of your .git/hook/commit-msg script
# Check spelling
ASPELL=$(which aspell 2> /dev/null)
if [ $? -ne 0 ]; then
echo "Aspell not installed, unable to check spelling" >&2
else
WORDS=$(grep -v "^Change-Id:" "$1"| $ASPELL --mode=email --add-email-quote='#' list | sort -u)
if [ -n "$WORDS" ]; then
echo -ne "\e[31m"
printf "### Possible spelling errors found in commit message: ###\n%s\n" "$WORDS" >&2
echo -ne "\e[0m"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment