Skip to content

Commit 7b7c93d

Browse files
authored
check/all - exit with error status if any of checks failed (#6561)
Also show status summary of executed checks.
1 parent be43d2b commit 7b7c93d

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

check/all

+24-8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $?
3535
topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $?
3636
cd "${topdir}" || exit $?
3737

38+
errors=()
39+
3840
# Parse arguments.
3941
apply_arg=""
4042
only_changed=0
@@ -57,29 +59,43 @@ for arg in "$@"; do
5759
done
5860

5961
echo "Running misc"
60-
check/misc
62+
check/misc || errors+=( "check/misc failed" )
6163

6264
if [ ${only_changed} -ne 0 ]; then
6365
echo "Running incremental pylint"
64-
check/pylint-changed-files
66+
check/pylint-changed-files || errors+=( "check/pylint-changed-files failed" )
6567
else
6668
echo "Running pylint"
67-
check/pylint
69+
check/pylint || errors+=( "check/pylint failed" )
6870
fi
6971

7072
echo "Running mypy"
71-
check/mypy
73+
check/mypy || errors+=( "check/mypy failed" )
7274

7375
echo "Running incremental format"
74-
check/format-incremental "${rev}" "${apply_arg}"
76+
check/format-incremental "${rev}" "${apply_arg}" || errors+=( "check/format-incremental failed" )
7577

7678
if [ ${only_changed} -ne 0 ]; then
7779
echo "Running pytest and incremental coverage on changed files"
78-
check/pytest-changed-files-and-incremental-coverage "${rev}"
80+
check/pytest-changed-files-and-incremental-coverage "${rev}" ||
81+
errors+=( "check/pytest-changed-files-and-incremental-coverage failed" )
7982
else
8083
echo "Running pytest and incremental coverage"
81-
check/pytest-and-incremental-coverage "${rev}"
84+
check/pytest-and-incremental-coverage "${rev}" ||
85+
errors+=( "check/pytest-and-incremental-coverage failed" )
8286
fi
8387

8488
echo "Running doctest"
85-
check/doctest
89+
check/doctest || errors+=( "check/doctest failed" )
90+
91+
echo
92+
if [[ "${#errors[@]}" == 0 ]]; then
93+
echo "All checks passed."
94+
result=0
95+
else
96+
printf "Some checks failed.\n\n"
97+
printf " %s\n" "${errors[@]}"
98+
result=1
99+
fi
100+
101+
exit "${result}"

0 commit comments

Comments
 (0)