tools: exit with error if py needs to format

Make CI fail if format not pass.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-08-09 15:46:16 +08:00 committed by Xiang Xiao
parent 7a352d2b83
commit 01cce0c544
1 changed files with 3 additions and 3 deletions

View File

@ -83,9 +83,9 @@ check_file() {
fi fi
if [ ${@##*.} == 'py' ]; then if [ ${@##*.} == 'py' ]; then
black --check $@ black --check $@ || fail=1
flake8 --config ${TOOLDIR}/../.github/linters/setup.cfg $@ flake8 --config ${TOOLDIR}/../.github/linters/setup.cfg $@ || fail=1
isort $@ isort $@ || fail=1
elif [ "$(is_rust_file $@)" == "1" ]; then elif [ "$(is_rust_file $@)" == "1" ]; then
if ! command -v rustfmt &> /dev/null; then if ! command -v rustfmt &> /dev/null; then
fail=1 fail=1