github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/scripts/check_spelling.sh (about) 1 #!/bin/bash 2 # 3 # Copyright IBM Corp. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 CHECK=$(git diff --name-only HEAD * | grep -v .png$ | grep -v .git | grep -v ^CHANGELOG \ 9 | grep -v ^vendor/ | grep -v ^build/ | sort -u) 10 11 if [[ -z "$CHECK" ]]; then 12 CHECK=$(git diff-tree --no-commit-id --name-only -r $(git log -2 \ 13 --pretty=format:"%h") | grep -v .png$ | grep -v .git | grep -v ^CHANGELOG \ 14 | grep -v ^vendor/ | grep -v ^build/ | sort -u) 15 fi 16 17 echo "Checking changed go files for spelling errors ..." 18 errs=`echo $CHECK | xargs misspell -source=text` 19 if [ -z "$errs" ]; then 20 echo "spell checker passed" 21 exit 0 22 fi 23 echo "The following files are have spelling errors:" 24 echo "$errs" 25 exit 0