checkpatch: Added encoding check with cvt2utf
This commit is contained in:
parent
cdfca12ab6
commit
290a9157eb
@ -23,6 +23,7 @@ check=check_patch
|
||||
fail=0
|
||||
range=0
|
||||
spell=0
|
||||
encoding=0
|
||||
message=0
|
||||
|
||||
usage() {
|
||||
@ -30,7 +31,8 @@ usage() {
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "-h"
|
||||
echo "-c spell check with codespell(install with: pip install codespell)"
|
||||
echo "-c spell check with codespell (install with: pip install codespell)"
|
||||
echo "-u encoding check with cvt2utf (install with: pip install cvt2utf)"
|
||||
echo "-r range check only (coupled with -p or -g)"
|
||||
echo "-p <patch file names> (default)"
|
||||
echo "-m Change-Id check in commit message (coupled with -g)"
|
||||
@ -75,6 +77,15 @@ check_file() {
|
||||
fail=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $encoding != 0 ]; then
|
||||
md5="$(md5sum $@)"
|
||||
cvt2utf convert --nobak "$@" &> /dev/null
|
||||
if [ "$md5" != "$(md5sum $@)" ]; then
|
||||
echo "$@: error: Non-UTF8 characters detected!"
|
||||
fail=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -147,6 +158,9 @@ while [ ! -z "$1" ]; do
|
||||
-c )
|
||||
spell=1
|
||||
;;
|
||||
-u )
|
||||
encoding=1
|
||||
;;
|
||||
-f )
|
||||
check=check_file
|
||||
;;
|
||||
|
@ -283,6 +283,7 @@ function python-tools {
|
||||
# cache restoration.
|
||||
pip3 install --force-reinstall \
|
||||
CodeChecker \
|
||||
cvt2utf \
|
||||
cxxfilt \
|
||||
esptool==3.3.1 \
|
||||
imgtool==1.9.0 \
|
||||
|
@ -279,6 +279,8 @@ ENV PIP_NO_CACHE_DIR=0
|
||||
RUN pip3 install setuptools wheel
|
||||
# Install CodeChecker and use it to statically analyze the code.
|
||||
RUN pip3 install CodeChecker
|
||||
# Install cvt2utf to check for non-UTF characters.
|
||||
RUN pip3 install cvt2utf
|
||||
# Install pytest
|
||||
RUN pip3 install cxxfilt
|
||||
RUN pip3 install esptool
|
||||
|
Loading…
Reference in New Issue
Block a user