summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-02-10 17:20:27 +0000
committerFedja Beader <fedja@protonmail.ch>2025-02-10 17:20:27 +0000
commitcfde4abec304f5f19f1400d3960b2e509e7929eb (patch)
treead6a0d227a827de33c22d729cf58ec0285d38609
parent901c586e5d046c2c2aa684cf977141ba474c1368 (diff)
downloadplus-cfde4abec304f5f19f1400d3960b2e509e7929eb.tar.gz
plus-cfde4abec304f5f19f1400d3960b2e509e7929eb.tar.bz2
plus-cfde4abec304f5f19f1400d3960b2e509e7929eb.tar.xz
plus-cfde4abec304f5f19f1400d3960b2e509e7929eb.zip
Properly fail the failing cpplint.py part of linters CI job
Squashed with: * Split out change * Let's get this to properly fail, first. put unfiltered file name into a variable and append .log to make it viewable online + direct URL for cpplint.py like before IT's LOGFILE, not ERRFILE.. sigh Nevermind, it actually is ERRFILE + add unfiltered version to init Downgrade version, py3 later Let's get unfiltered log to print if find fails Related: mana/plus!122 **** mana/plus!123
-rwxr-xr-xtools/ci/jobs/cpplint.sh22
-rwxr-xr-xtools/ci/scripts/init.sh2
2 files changed, 15 insertions, 9 deletions
diff --git a/tools/ci/jobs/cpplint.sh b/tools/ci/jobs/cpplint.sh
index b51694b3b..fd73705dc 100755
--- a/tools/ci/jobs/cpplint.sh
+++ b/tools/ci/jobs/cpplint.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
-export LOGFILE=cpplint.log
+set -e # Fail if any command fails
+set -u # Fail if any variable is unset when used
+export LOGFILE=cpplint.log
source ./tools/ci/scripts/init.sh
# Re-download if not executable or older than a day
@@ -45,16 +47,18 @@ args+=("--filter=\
find src \
-type f \
-name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.cc" \
- -exec ./cpplint.py "${args[@]}" {} \+ 2>${ERRFILE}2
+ -exec ./cpplint.py "${args[@]}" {} \+ 2>"$ERRFILE_UNFILTERED" \
+ || { cat "$ERRFILE_UNFILTERED"; exit 1; }
-grep ": " ${ERRFILE}2 | grep -v -e "src/debug/" \
- -e "unittests/doctest.h" \
- -e "unittests/catch.hpp" \
- -e "debug/fast_mutex" \
- -e "sdl2gfx/SDL2" \
- >${ERRFILE}
+# if grep does not find any messages, it exits non-zero
+grep ": " "$ERRFILE_UNFILTERED" \
+ | grep -v -e "src/debug/" \
+ -e "unittests/doctest.h" \
+ -e "unittests/catch.hpp" \
+ -e "debug/fast_mutex" \
+ -e "sdl2gfx/SDL2" \
+ >${ERRFILE} || true
-rm ${ERRFILE}2
run_check_warnings
diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh
index 54b0ac64f..8e84054ff 100755
--- a/tools/ci/scripts/init.sh
+++ b/tools/ci/scripts/init.sh
@@ -2,8 +2,10 @@
export dir=$(pwd)
export ERRFILE=${dir}/logs/${LOGFILE}
+export ERRFILE_UNFILTERED=${ERRFILE%.log}.unfiltered.log
rm -f "$ERRFILE"
+rm -f "$ERRFILE_UNFILTERED"
function do_init {
$CC --version