tools/checkpatch.sh: Add code spell check to checkpatch.sh (#371)

This commit is contained in:
Xiang Xiao 2020-02-25 03:28:05 -06:00 committed by GitHub
parent 7fa1486181
commit cec7949a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -20,15 +20,17 @@ TOOLDIR=$(dirname $0)
fail=0
range=0
spell=0
usage() {
echo "USAGE: ${0} [options] [list|-]"
echo ""
echo "Options:"
echo "-h"
echo "-r range check only (used with -p and -c)"
echo "-c spell check with codespell(install with: pip install codespell"
echo "-r range check only (used with -p and -g)"
echo "-p <patch list> (default)"
echo "-c <commit list>"
echo "-g <commit list>"
echo "-f <file list>"
echo "- read standard input mainly used by git pre-commit hook as below:"
echo " git diff --cached | ./tools/checkpatch.sh -"
@ -40,6 +42,14 @@ check_file() {
if [ $ret != 0 ]; then
fail=$ret
fi
if [ $spell != 0 ]; then
codespell -q 7 ${@: -1}
ret=$?
if [ $ret != 0 ]; then
fail=$ret
fi
fi
}
check_ranges() {
@ -98,6 +108,9 @@ while [ ! -z "$1" ]; do
usage
exit 0
;;
-c )
spell=1
;;
-r )
range=1
;;
@ -106,7 +119,7 @@ while [ ! -z "$1" ]; do
patches=$@
break
;;
-c )
-g )
shift
commits=$@
break