summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-02-10 20:43:01 +0000
committerFedja Beader <fedja@protonmail.ch>2025-02-10 20:43:01 +0000
commit81207f0ee92593b70047585fa1d609dc6a862e98 (patch)
tree733fb4e6472e92b9a238cb124de4318c32711255 /tools
parentcfde4abec304f5f19f1400d3960b2e509e7929eb (diff)
downloadplus-81207f0ee92593b70047585fa1d609dc6a862e98.tar.gz
plus-81207f0ee92593b70047585fa1d609dc6a862e98.tar.bz2
plus-81207f0ee92593b70047585fa1d609dc6a862e98.tar.xz
plus-81207f0ee92593b70047585fa1d609dc6a862e98.zip
Properly fail the nsiqcppstyle part of the linters CI job
From updating to buster->bullseye in !124: nsiqcppstyle was silently failing, too >_> Squashed with: * I always forget newlines at end of printfs. * Add sore thumb to remind me of untreated wounds beneath bandages * nsiqcppstyle was silently failing, too >_> *Explicitly call python2 *Grep will exit non-zero if it finds nothing. *fix* **** mana/plus!125
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ci/jobs/cpplint.sh2
-rwxr-xr-xtools/ci/jobs/nsiqcppstyle.sh20
-rwxr-xr-xtools/ci/scripts/init.sh6
3 files changed, 19 insertions, 9 deletions
diff --git a/tools/ci/jobs/cpplint.sh b/tools/ci/jobs/cpplint.sh
index fd73705dc..8bf769457 100755
--- a/tools/ci/jobs/cpplint.sh
+++ b/tools/ci/jobs/cpplint.sh
@@ -50,7 +50,7 @@ find src \
-exec ./cpplint.py "${args[@]}" {} \+ 2>"$ERRFILE_UNFILTERED" \
|| { cat "$ERRFILE_UNFILTERED"; exit 1; }
-# if grep does not find any messages, it exits non-zero
+# If grep does not find any messages, it exits non-zero. Therefore, use ||true
grep ": " "$ERRFILE_UNFILTERED" \
| grep -v -e "src/debug/" \
-e "unittests/doctest.h" \
diff --git a/tools/ci/jobs/nsiqcppstyle.sh b/tools/ci/jobs/nsiqcppstyle.sh
index fd9f0499a..e83c8e932 100755
--- a/tools/ci/jobs/nsiqcppstyle.sh
+++ b/tools/ci/jobs/nsiqcppstyle.sh
@@ -1,19 +1,25 @@
#!/usr/bin/env bash
-export LOGFILE=nsiqcppstyle.log
+set -e # Fail if any command fails
+set -u # Fail if any variable is unset when used
+export LOGFILE=nsiqcppstyle.log
source ./tools/ci/scripts/init.sh
rm -rf nsiqcppstyle.git
./tools/ci/scripts/retry.sh git clone https://gitlab.com/4144/nsiqcppstyle nsiqcppstyle.git
+# replace python -> python2 on line3. (Explicitly call python2)
+sed -i -s -e '3s/^python/python2/' ./nsiqcppstyle.git/nsiqcppstyle
+
./nsiqcppstyle.git/nsiqcppstyle --ci --show-url src \
| grep -v -e "catch.hpp" \
-e "doctest.h" \
-e "sdl2gfx" \
-e "/debug/" \
- > logs/nsiqcppstyle1.log
+ > "$ERRFILE_UNFILTERED"
+# If grep does not find any messages, it exits non-zero. Therefore, use ||true
grep -v -E \
-e "gamemodifiers[.]cpp(.+): Incorrect align on long parameter list in front of '(N_|{|})'" \
-e "graphics_calcImageRect[.]hpp(.+): function [(]calcTileVertexesInline[)] has non named parameter" \
@@ -23,10 +29,8 @@ grep -v -E \
-e "windowmenu[.]cpp(.+): Incorrect align on long parameter list in front of '(.|Visible_true)', it should be aligen in column 15" \
-e "channeltab[.]h(.+): Incorrect align on long parameter list in front of 'const'" \
-e "/enums/simpletypes/(.+): function [(]defIntEnum[)] has non named parameter" \
- logs/nsiqcppstyle1.log > "${ERRFILE}"
+ "$ERRFILE_UNFILTERED" > "$ERRFILE" || true
+
+run_check_warnings
-if [[ -s "${ERRFILE}" ]]; then
- echo "Warnings detected"
- cat ${ERRFILE}
- exit 1
-fi
+echo ok
diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh
index 8e84054ff..cd716cf94 100755
--- a/tools/ci/scripts/init.sh
+++ b/tools/ci/scripts/init.sh
@@ -217,9 +217,15 @@ function run_gcov {
function run_check_warnings {
if [[ -s "$ERRFILE" ]]; then
+ printf "Warnings detected in %s:\n" "$ERRFILE"
cat $ERRFILE
exit 1
fi
+
+ if [[ -s "$ERRFILE_UNFILTERED" ]]; then
+ printf "Warnings detected in %s. The maintainer might want take a peek, sometimes.\n" \
+ "$ERRFILE_UNFILTERED"
+ fi
}
function run_h {