Skip to content

Commit 6f83a2b

Browse files
authored
properly checks for exit codes, prints out number of checks failed
1 parent 117afb8 commit 6f83a2b

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

_bin/run-all-checks.sh

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
dir=$(cd "$(dirname "$0")/.." && pwd)
44
bin="$dir/_bin"
55
root="$dir/_site"
6-
any_failed=0
6+
failed=0
77
test -d "$root" || {
88
echo "Please generate the site first."
99
echo " bundle exec jekyll serve"
@@ -12,37 +12,60 @@ test -d "$root" || {
1212

1313
echo "[Checking page generation]"
1414
"$bin/check-page-generation.sh"
15-
test $? -eq 0 && echo "--> Page generation looks good."
16-
test $? -neq 0 && any_failed=1
15+
if [ $? -ne 0 ]; then
16+
failed=$((failed+1))
17+
else
18+
echo "--> Page generation looks good."
19+
fi
1720

1821
echo
1922
echo "[Checking user IDs]"
2023
"$bin/check-user-ids.sh"
21-
test $? -eq 0 && echo "--> User IDs look good."
22-
test $? -neq 0 && any_failed=1
24+
if [ $? -ne 0 ]; then
25+
failed=$((failed+1))
26+
else
27+
echo "--> User IDs look good."
28+
fi
29+
2330

2431
echo
2532
echo "[Checking include usage]"
2633
"$bin/check-include-usage.sh"
27-
test $? -eq 0 && echo "--> Includes look good."
28-
test $? -neq 0 && any_failed=1
34+
if [ $? -ne 0 ]; then
35+
failed=$((failed+1))
36+
else
37+
echo "--> Includes look good."
38+
fi
39+
2940

3041
echo
3142
echo "[Checking include documentation]"
3243
"$bin/check-include-help.sh"
33-
test $? -eq 0 && echo "--> Include docs look good."
34-
test $? -neq 0 && any_failed=1
44+
if [ $? -ne 0 ]; then
45+
failed=$((failed+1))
46+
else
47+
echo "--> Include docs look good."
48+
fi
49+
3550

3651
echo
3752
echo "[Checking HTML element id values]"
3853
"$bin/check-html-ids.sh"
39-
test $? -eq 0 && echo "--> HTML element ids look good."
40-
test $? -neq 0 && any_failed=1
54+
if [ $? -ne 0 ]; then
55+
failed=$((failed+1))
56+
else
57+
echo "--> HTML element ids look good."
58+
fi
59+
4160

4261
# echo
4362
# echo "[Checking site HTML]"
4463
# "$bin/check-site-html.sh"
45-
# test $? -eq 0 && echo "--> Site HTML looks good! Congratulations."
46-
# test $? -neq 0 && any_failed=1
64+
# if [ $? -ne 0 ]; then
65+
# failed=$((failed+1))
66+
# else
67+
# echo "--> Site HTML looks good! Congratulations."
68+
# fi
4769

48-
exit $any_failed
70+
echo "$failed checks failed."
71+
exit $failed

0 commit comments

Comments
 (0)