tools/checkpatch.sh: Add code spell check to checkpatch.sh (#371)
This commit is contained in:
parent
7fa1486181
commit
cec7949a39
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user