diff options
author | Fedja Beader <fedja@protonmail.ch> | 2023-09-10 13:33:28 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2023-09-10 13:33:28 +0200 |
commit | 3f68449293de30d84e39fef761ca5a4734f99c32 (patch) | |
tree | b42fdeb4d513d47e2a1602f1b57876c7dc25317c | |
parent | 1999cc4ec6a8d14730edb3c98dbf72011fce9ba6 (diff) | |
download | manaplus-3f68449293de30d84e39fef761ca5a4734f99c32.tar.gz manaplus-3f68449293de30d84e39fef761ca5a4734f99c32.tar.bz2 manaplus-3f68449293de30d84e39fef761ca5a4734f99c32.tar.xz manaplus-3f68449293de30d84e39fef761ca5a4734f99c32.zip |
Reduce number of grep invocations + prettify + wrap param expansion in quotes
-rwxr-xr-x | tools/ci/jobs/clang_tidy.sh | 11 | ||||
-rwxr-xr-x | tools/ci/jobs/deheader2.sh | 30 | ||||
-rwxr-xr-x | tools/ci/jobs/nsiqcppstyle.sh | 29 | ||||
-rwxr-xr-x | tools/ci/scripts/deheader.sh | 39 | ||||
-rwxr-xr-x | tools/ci/scripts/deheaderS.sh | 40 | ||||
-rwxr-xr-x | tools/ci/scripts/init.sh | 12 |
6 files changed, 86 insertions, 75 deletions
diff --git a/tools/ci/jobs/clang_tidy.sh b/tools/ci/jobs/clang_tidy.sh index 0c50d90fa..9e83cbcdf 100755 --- a/tools/ci/jobs/clang_tidy.sh +++ b/tools/ci/jobs/clang_tidy.sh @@ -18,11 +18,12 @@ check_error $? cd .. grep "warning:" logs/clang_tidy.txt \ -| grep -v "/src/unittests/doctest.h" \ -| grep -v "/src/unittests/catch.hpp" \ -| grep -v "/src/sdl2gfx/" \ -| grep -v "/src/debug/" \ ->${ERRFILE} + | grep -v \ + -e "/src/unittests/doctest.h" \ + -e "/src/unittests/catch.hpp" \ + -e "/src/sdl2gfx/" \ + -e "/src/debug/" \ + ">${ERRFILE}" run_check_warnings diff --git a/tools/ci/jobs/deheader2.sh b/tools/ci/jobs/deheader2.sh index afd0f02c3..5862e555e 100755 --- a/tools/ci/jobs/deheader2.sh +++ b/tools/ci/jobs/deheader2.sh @@ -14,20 +14,22 @@ if [[ -n "${DATA}" ]]; then exit 1 fi -grep "deheader:" ${LOGFILE} \ -| grep -v "deheader: remove <climits> from ./src/being/localplayer.cpp" \ -| grep -v "deheader: remove <fstream> from ./src/utils/files.cpp" \ -| grep -v "deheader: remove <climits> from ./src/resources/map/map.cpp" \ -| grep -v "deheader: remove <sys/time.h> from ./src/resources/wallpaper.cpp" \ -| grep -v "deheader: remove <linux/tcp.h> from ./src/net/sdltcpnet.cpp" \ -| grep -v "deheader: remove <netdb.h> from ./src/net/sdltcpnet.cpp" \ -| grep -v "deheader: remove <netinet/in.h> from ./src/net/sdltcpnet.cpp" \ -| grep -v "deheader: remove <climits> from ./src/resources/map/map.cpp" \ -| grep -v "deheader: remove <vector> from ./src/utils/vector.h" \ -| grep -v "has more than one inclusion of \"resources/dye/dyepalette_replace" \ -| grep -v "/sdl2gfx/" \ -| grep -v "doctest.h" \ -| grep -v "deheader: remove <climits> from ./src/units.cpp" > ${LOGFILE2} +grep "deheader:" "${LOGFILE}" \ + | grep -v \ + -e "deheader: remove <climits> from ./src/being/localplayer.cpp" \ + -e "deheader: remove <fstream> from ./src/utils/files.cpp" \ + -e "deheader: remove <climits> from ./src/resources/map/map.cpp" \ + -e "deheader: remove <sys/time.h> from ./src/resources/wallpaper.cpp" \ + -e "deheader: remove <linux/tcp.h> from ./src/net/sdltcpnet.cpp" \ + -e "deheader: remove <netdb.h> from ./src/net/sdltcpnet.cpp" \ + -e "deheader: remove <netinet/in.h> from ./src/net/sdltcpnet.cpp" \ + -e "deheader: remove <climits> from ./src/resources/map/map.cpp" \ + -e "deheader: remove <vector> from ./src/utils/vector.h" \ + -e "has more than one inclusion of \"resources/dye/dyepalette_replace" \ + -e "/sdl2gfx/" \ + -e "doctest.h" \ + -e "deheader: remove <climits> from ./src/units.cpp" \ + > "${LOGFILE2}" export DATA=$(cat ${LOGFILE2}) if [[ -n "${DATA}" ]]; then diff --git a/tools/ci/jobs/nsiqcppstyle.sh b/tools/ci/jobs/nsiqcppstyle.sh index e1969e182..a6db88cc9 100755 --- a/tools/ci/jobs/nsiqcppstyle.sh +++ b/tools/ci/jobs/nsiqcppstyle.sh @@ -8,22 +8,23 @@ rm -rf nsiqcppstyle.git ./tools/ci/scripts/retry.sh git clone https://gitlab.com/4144/nsiqcppstyle nsiqcppstyle.git ./nsiqcppstyle.git/nsiqcppstyle --ci --show-url src \ -| grep -v "catch.hpp" \ -| grep -v "doctest.h" \ -| grep -v "sdl2gfx" \ -| grep -v "/debug/" \ ->logs/nsiqcppstyle1.log + | grep -v -e "catch.hpp" \ + -e "doctest.h" \ + -e "sdl2gfx" \ + -e "/debug/" \ + > logs/nsiqcppstyle1.log cat logs/nsiqcppstyle1.log \ -| grep -v -E "gamemodifiers[.]cpp(.+): Incorrect align on long parameter list in front of '(N_|{|})'" \ -| grep -v -E "graphics_calcImageRect[.]hpp(.+): function [(]calcTileVertexesInline[)] has non named parameter" \ -| grep -v -E "dye[.]cpp(.+): Do not use goto keyword" \ -| grep -v -E "item/item[.]cpp(.+): function [(]dragDrop[)] has non named parameter" \ -| grep -v -E "windowmenu[.]cpp(.+): function [(]addButton[)] has non named parameter" \ -| grep -v -E "windowmenu[.]cpp(.+): Incorrect align on long parameter list in front of '(.|Visible_true)', it should be aligen in column 15" \ -| grep -v -E "channeltab[.]h(.+): Incorrect align on long parameter list in front of 'const'" \ -| grep -v -E "/enums/simpletypes/(.+): function [(]defIntEnum[)] has non named parameter" \ ->${ERRFILE} + | 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" \ + -e "dye[.]cpp(.+): Do not use goto keyword" \ + -e "item/item[.]cpp(.+): function [(]dragDrop[)] has non named parameter" \ + -e "windowmenu[.]cpp(.+): function [(]addButton[)] has non named parameter" \ + -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" \ + > "${ERRFILE}" export data=$(cat ${ERRFILE}) if [ "$DATA" != "" ]; then diff --git a/tools/ci/scripts/deheader.sh b/tools/ci/scripts/deheader.sh index 03ea0ee18..9914da900 100755 --- a/tools/ci/scripts/deheader.sh +++ b/tools/ci/scripts/deheader.sh @@ -22,21 +22,24 @@ fi echo $1 >>${LOGFILE} echo $1 -${dir}/deheader -q -i "\"debug.h\"" \ --i "\"utils/checkutils.h\"" \ --i "\"utils/sdlcheckutils.h\"" \ --i "\"sdlshared.h\"" \ --i "\"localconsts.h\"" \ --i "\"utils/fuzzer.h\"" \ --i "\"$name\"" \ --c "$CXX" \ --d "$FLAGS" \ --s "-std=gnu++1z" \ --m "-c -Werror -Wall -Wextra -Wundef -Wmissing-declarations -DUCHAR_TYPE=uint16_t -DLOCALEDIR=\\\"\\\" -I/usr/include $INCLUDES -I${dir}/src" $1 2>&1 | \ -grep -v "deheader: ./src/net/sdltcpnet.cpp has more than one inclusion of <netinet/tcp.h>" | \ -grep -v "deheader: remove <netinet/tcp.h> from ./src/net/sdltcpnet.cpp" | \ -grep -v "deheader: remove <climits> from ./src/resources/db/unitsdb.cpp" | \ -grep -v "portability requires" | \ -grep -v "SDL2_rotozoom.cpp" | \ -grep -v "doctest.h" | \ -tee -a ${LOGFILE} +"${dir}/deheader" -q \ + -i "\"debug.h\"" \ + -i "\"utils/checkutils.h\"" \ + -i "\"utils/sdlcheckutils.h\"" \ + -i "\"sdlshared.h\"" \ + -i "\"localconsts.h\"" \ + -i "\"utils/fuzzer.h\"" \ + -i "\"$name\"" \ + -c "$CXX" \ + -d "$FLAGS" \ + -s "-std=gnu++1z" \ + -m "-c -Werror -Wall -Wextra -Wundef -Wmissing-declarations -DUCHAR_TYPE=uint16_t -DLOCALEDIR=\\\"\\\" -I/usr/include $INCLUDES -I${dir}/src" \ + "$1" 2>&1 \ + | grep -v \ + -e "deheader: ./src/net/sdltcpnet.cpp has more than one inclusion of <netinet/tcp.h>" \ + -e "deheader: remove <netinet/tcp.h> from ./src/net/sdltcpnet.cpp" \ + -e "deheader: remove <climits> from ./src/resources/db/unitsdb.cpp" \ + -e "portability requires" \ + -e "SDL2_rotozoom.cpp" \ + -e "doctest.h" \ + | tee -a "${LOGFILE}" diff --git a/tools/ci/scripts/deheaderS.sh b/tools/ci/scripts/deheaderS.sh index 6f72ddb50..b9a6730c0 100755 --- a/tools/ci/scripts/deheaderS.sh +++ b/tools/ci/scripts/deheaderS.sh @@ -22,22 +22,24 @@ fi echo $1 >>${LOGFILE} echo $1 -${dir}/deheader -q -i "\"debug.h\"" \ --i "\"utils/checkutils.h\"" \ --i "\"utils/sdlcheckutils.h\"" \ --i "\"sdlshared.h\"" \ --i "\"localconsts.h\"" \ --i "\"utils/fuzzer.h\"" \ --i "\"$name\"" \ --c "$CXX" \ --d "$FLAGS" \ --s "-std=gnu++1z" \ --S "-std=gnu++1z" \ --m "-c -Werror -Wall -Wextra -Wundef -Wmissing-declarations -DUCHAR_TYPE=uint16_t -DLOCALEDIR=\\\"\\\" -I/usr/include $INCLUDES -I${dir}/src" $1 2>&1 | \ -grep -v "deheader: ./src/net/sdltcpnet.cpp has more than one inclusion of <netinet/tcp.h>" | \ -grep -v "deheader: remove <netinet/tcp.h> from ./src/net/sdltcpnet.cpp" | \ -grep -v "deheader: remove <climits> from ./src/resources/db/unitsdb.cpp" | \ -grep -v "portability requires" | \ -grep -v "SDL2_rotozoom.cpp" | \ -grep -v "doctest.h" | \ -tee -a ${LOGFILE} +"${dir}/deheader" -q \ + -i "\"debug.h\"" \ + -i "\"utils/checkutils.h\"" \ + -i "\"utils/sdlcheckutils.h\"" \ + -i "\"sdlshared.h\"" \ + -i "\"localconsts.h\"" \ + -i "\"utils/fuzzer.h\"" \ + -i "\"$name\"" \ + -c "$CXX" \ + -d "$FLAGS" \ + -s "-std=gnu++1z" \ + -S "-std=gnu++1z" \ + -m "-c -Werror -Wall -Wextra -Wundef -Wmissing-declarations -DUCHAR_TYPE=uint16_t -DLOCALEDIR=\\\"\\\" -I/usr/include $INCLUDES -I${dir}/src" \ + "$1" 2>&1 \ + | grep -v -e "deheader: ./src/net/sdltcpnet.cpp has more than one inclusion of <netinet/tcp.h>" \ + -e "deheader: remove <netinet/tcp.h> from ./src/net/sdltcpnet.cpp" \ + -e "deheader: remove <climits> from ./src/resources/db/unitsdb.cpp" \ + -e "portability requires" \ + -e "SDL2_rotozoom.cpp" \ + -e "doctest.h" \ + | tee -a "${LOGFILE}" diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh index 4b0764488..656a4d765 100755 --- a/tools/ci/scripts/init.sh +++ b/tools/ci/scripts/init.sh @@ -242,10 +242,12 @@ function run_tarball { function run_mplint { rm $ERRFILE echo "mplint/src/mplint $*" - mplint/src/mplint $* \ - | grep -v "src/unittests/doctest.h" \ - | grep -v "src/unittests/catch.hpp" \ - | grep -v "src/debug/" \ - >$ERRFILE + mplint/src/mplint "$@" \ + | grep -v \ + -e "src/unittests/doctest.h" \ + -e "src/unittests/catch.hpp" \ + -e "src/debug/" \ + > "$ERRFILE" + run_check_warnings } |