Skip to content

Instantly share code, notes, and snippets.

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