nsxiv9cb9a54
[ci]: make it easy to run analysis locally (#395)
allows for developers to more easily run the analysis locally before opening a pull request if they wish. also disables a noisy warning (bugprone-assignment-in-if-condition) producing too many false positives.
+23 −18
3 files changed
- A etc/woodpecker/analysis.sh +21 −0
- M etc/woodpecker/analysis.yml +1 −18
- M etc/woodpecker/clang-tidy-checks +1 −0
| @@ -0,0 +1,21 @@ | |||
| 1 | + | #!/bin/sh -e | |
| 2 | + | ||
| 3 | + | std="c99" | |
| 4 | + | ||
| 5 | + | run_cppcheck() { | |
| 6 | + | cppcheck --std="$std" --enable=performance,portability \ | |
| 7 | + | --force --quiet --inline-suppr --error-exitcode=1 \ | |
| 8 | + | --max-ctu-depth=8 -j"$(nproc)" \ | |
| 9 | + | $(make OPT_DEP_DEFAULT="$1" dump_cppflags) \ | |
| 10 | + | --suppress=varFuncNullUB --suppress=uninitvar \ | |
| 11 | + | *.c | |
| 12 | + | } | |
| 13 | + | ||
| 14 | + | run_tidy() { | |
| 15 | + | checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)" | |
| 16 | + | clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \ | |
| 17 | + | -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) | |
| 18 | + | } | |
| 19 | + | ||
| 20 | + | run_cppcheck "0"; run_cppcheck "1"; | |
| 21 | + | run_tidy "0"; run_tidy "1"; | |
| @@ -8,21 +8,4 @@ pipeline: | |||
| 8 | 8 | imlib2-dev xorgproto \ | |
| 9 | 9 | libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null | |
| 10 | 10 | make config.h version.h | |
| 11 | − | std="c99" | |
| 12 | − | run_cppcheck() { | |
| 13 | − | cppcheck --std="$std" --enable=performance,portability \ | |
| 14 | − | --force --quiet --inline-suppr --error-exitcode=1 \ | |
| 15 | − | --max-ctu-depth=8 -j"$(nproc)" \ | |
| 16 | − | $(make OPT_DEP_DEFAULT="$1" dump_cppflags) \ | |
| 17 | − | --suppress=varFuncNullUB --suppress=uninitvar \ | |
| 18 | − | *.c | |
| 19 | − | } | |
| 20 | − | run_tidy() { | |
| 21 | − | checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)" | |
| 22 | − | clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \ | |
| 23 | − | -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) | |
| 24 | − | } | |
| 25 | − | run_cppcheck "0" | |
| 26 | − | run_cppcheck "1" | |
| 27 | − | run_tidy "0" | |
| 28 | − | run_tidy "1" | |
| 11 | + | ./etc/woodpecker/analysis.sh | |
| @@ -8,6 +8,7 @@ misc-*,android-cloexec-*,cert-*,llvm-include-order | |||
| 8 | 8 | -bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-incorrect-roundings | |
| 9 | 9 | -bugprone-implicit-widening-of-multiplication-result,-bugprone-integer-division | |
| 10 | 10 | -android-cloexec-fopen,-android-cloexec-pipe,-cert-err33-c | |
| 11 | + | -bugprone-assignment-in-if-condition | |
| 11 | 12 | ||
| 12 | 13 | # false positive warnings | |
| 13 | 14 | -clang-analyzer-valist.Uninitialized | |