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
|
fail=0
|
||||||
range=0
|
range=0
|
||||||
|
spell=0
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "USAGE: ${0} [options] [list|-]"
|
echo "USAGE: ${0} [options] [list|-]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo "-h"
|
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 "-p <patch list> (default)"
|
||||||
echo "-c <commit list>"
|
echo "-g <commit list>"
|
||||||
echo "-f <file list>"
|
echo "-f <file list>"
|
||||||
echo "- read standard input mainly used by git pre-commit hook as below:"
|
echo "- read standard input mainly used by git pre-commit hook as below:"
|
||||||
echo " git diff --cached | ./tools/checkpatch.sh -"
|
echo " git diff --cached | ./tools/checkpatch.sh -"
|
||||||
@ -40,6 +42,14 @@ check_file() {
|
|||||||
if [ $ret != 0 ]; then
|
if [ $ret != 0 ]; then
|
||||||
fail=$ret
|
fail=$ret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $spell != 0 ]; then
|
||||||
|
codespell -q 7 ${@: -1}
|
||||||
|
ret=$?
|
||||||
|
if [ $ret != 0 ]; then
|
||||||
|
fail=$ret
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_ranges() {
|
check_ranges() {
|
||||||
@ -98,6 +108,9 @@ while [ ! -z "$1" ]; do
|
|||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-c )
|
||||||
|
spell=1
|
||||||
|
;;
|
||||||
-r )
|
-r )
|
||||||
range=1
|
range=1
|
||||||
;;
|
;;
|
||||||
@ -106,7 +119,7 @@ while [ ! -z "$1" ]; do
|
|||||||
patches=$@
|
patches=$@
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-c )
|
-g )
|
||||||
shift
|
shift
|
||||||
commits=$@
|
commits=$@
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user