Created
November 18, 2021 11:27
-
-
Save grigory-rechistov-intel/d3c113d829e8ebc354c0fabbedc338d2 to your computer and use it in GitHub Desktop.
Git commit hook to check spelling
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/sh | |
# 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