From a7ed220914c7bae292fe99210db8a46337afe5c3 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Fri, 21 Jul 2023 06:15:24 +0300 Subject: [PATCH 1/2] Fix github CI clang-format related check_c-cpp job --- .github/workflows/push.yml | 2 +- scripts/deploy.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ca127c55ed..639ecc9c1b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -143,7 +143,7 @@ jobs: steps: - name: Install dependencies (apk) - run: apk add --no-cache make git diffutils findutils clang-extra-tools + run: apk add --no-cache make git diffutils findutils clang-extra-tools bash - uses: actions/checkout@v3 with: diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 56db72dfa6..bf44352bc8 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -97,7 +97,7 @@ check_style_file() # it used to trace missing { and } for if/else/do/while/for BUT IT'S VERY SPECULATIVE, very-very hacky & dirty. test -z "${LIST}" || silent_opt="-q" # if file is problematic but filename only requested make final grep in pipe silent ... - grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep "${silent_opt}" -e "^.*$" + grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep $(eval "${silent_opt}") -e "^.*$" if [ "${?}" -ne 1 ]; then # ... and only print the filename test -z "${LIST}" || echo "${src}" From 22a8ea258f52d1009a00e2cd6fec2a99de6faf46 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Fri, 21 Jul 2023 06:37:38 +0300 Subject: [PATCH 2/2] shellcheck fix --- scripts/deploy.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index bf44352bc8..97fd0c74f5 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -95,9 +95,12 @@ check_style_file() # * https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces # - since reference env is alpine 3.16 with clang-format 13, implement custom parser to do the similar thing here with grep: # it used to trace missing { and } for if/else/do/while/for BUT IT'S VERY SPECULATIVE, very-very hacky & dirty. - test -z "${LIST}" || silent_opt="-q" - # if file is problematic but filename only requested make final grep in pipe silent ... - grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep $(eval "${silent_opt}") -e "^.*$" + # - if file is problematic but filename only requested make final grep in pipe silent ... UPD: make code messy but shellcheck happy + if [ -z "${LIST}" ]; then + grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -e "^.*$" + else + grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -q -e "^.*$" + fi; if [ "${?}" -ne 1 ]; then # ... and only print the filename test -z "${LIST}" || echo "${src}"