ci/tools: add rustfmt to checkfmt and ci config

This commit is contained in:
Piet
2022-02-26 00:06:47 +01:00
committed by Xiang Xiao
parent 6a12befcd5
commit b13fa5fc05
+28 -6
View File
@@ -42,14 +42,36 @@ usage() {
exit $@ exit $@
} }
check_file() { is_rust_file() {
if ! $TOOLDIR/nxstyle $@ 2>&1; then file_ext=${@##*.}
fail=1 file_ext_r=${file_ext/R/r}
fi file_ext_rs=${file_ext_r/S/s}
if [ $spell != 0 ]; then if [ "$file_ext_rs" == "rs" ]; then
if ! codespell -q 7 ${@: -1}; then echo 1
else
echo 0
fi
}
check_file() {
if [ "$(is_rust_file $@)" == "1" ]; then
if ! command -v rustfmt &> /dev/null; then
fail=1 fail=1
else
if ! rustfmt --edition 2021 --check $@ 2>&1; then
fail=1
fi
fi
else
if ! $TOOLDIR/nxstyle $@ 2>&1; then
fail=1
fi
if [ $spell != 0 ]; then
if ! codespell -q 7 ${@: -1}; then
fail=1
fi
fi fi
fi fi
} }