tools/checkpatch: Should check the spell and encoding for rust file too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-02-01 07:22:39 +08:00 committed by Petro Karashchenko
parent 8a80c6ab28
commit 0a66cbdcdd

View File

@ -62,29 +62,25 @@ check_file() {
if [ "$(is_rust_file $@)" == "1" ]; then
if ! command -v rustfmt &> /dev/null; then
fail=1
else
if ! rustfmt --edition 2021 --check $@ 2>&1; then
fail=1
fi
fi
else
if ! $TOOLDIR/nxstyle $@ 2>&1; then
elif ! rustfmt --edition 2021 --check $@ 2>&1; then
fail=1
fi
elif ! $TOOLDIR/nxstyle $@ 2>&1; then
fail=1
fi
if [ $spell != 0 ]; then
if ! codespell -q 7 ${@: -1}; then
fail=1
fi
if [ $spell != 0 ]; then
if ! codespell -q 7 ${@: -1}; then
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
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
}