mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
ci/tools: add rustfmt to checkfmt and ci config
This commit is contained in:
+28
-6
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user