From 358cc51cc72de27ee5b90e27211dac127ec73f39 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Sat, 9 Sep 2023 18:04:51 +0200 Subject: Reduce number of find and grep invocations --- tools/ci/jobs/cpplint.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tools/ci/jobs/cpplint.sh b/tools/ci/jobs/cpplint.sh index 496e51eb5..d327e49d1 100755 --- a/tools/ci/jobs/cpplint.sh +++ b/tools/ci/jobs/cpplint.sh @@ -11,7 +11,9 @@ if [[ ! -x cpplint.py \ chmod +x cpplint.py fi -CHECKER="./cpplint.py --filter=\ +declare -a args + +args+=("--filter=\ -build/include,\ -whitespace/braces,-whitespace/operators,-runtime/references,\ -runtime/threadsafe_fn,-readability/streams,\ @@ -35,20 +37,20 @@ CHECKER="./cpplint.py --filter=\ -readability/casting,\ -readability/inheritance,\ -runtime/string,\ --build/c++tr1" - -find src -type f -name "*.cpp" -exec $CHECKER {} \; 2>${ERRFILE}2 -find src -type f -name "*.hpp" -exec $CHECKER {} \; 2>>${ERRFILE}2 -find src -type f -name "*.h" -exec $CHECKER {} \; 2>>${ERRFILE}2 -find src -type f -name "*.cc" -exec $CHECKER {} \; 2>>${ERRFILE}2 - -grep ": " ${ERRFILE}2 | \ -grep -v "src/debug/" | \ -grep -v "unittests/doctest.h" | \ -grep -v "unittests/catch.hpp" | \ -grep -v "debug/fast_mutex" | \ -grep -v "sdl2gfx/SDL2" \ ->${ERRFILE} +-build/c++tr1"\ +) + +find src \ + -type f \ + -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.cc" \ + -exec ./cpplint.py "${args[@]}" {} \; 2>${ERRFILE}2 + +grep ": " ${ERRFILE}2 | grep -v -e "src/debug/" \ + -e "unittests/doctest.h" \ + -e "unittests/catch.hpp" \ + -e "debug/fast_mutex" \ + -e "sdl2gfx/SDL2" \ + >${ERRFILE} rm ${ERRFILE}2 -- cgit v1.2.3-60-g2f50