Krolyxon
Commit 9cb9a54

Branches

Refs →

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.
Author
NRK
Date
2022-12-02 10:50 +0000
Committer
Berke Kocaoğlu · 2022-12-02 10:50 +0000
Parent
3804b50
Commit
9cb9a54944e8ad9a42b3113286cb51bceae4b2d0

+23 −18

3 files changed

  1. A etc/woodpecker/analysis.sh +21 −0
  2. M etc/woodpecker/analysis.yml +1 −18
  3. M etc/woodpecker/clang-tidy-checks +1 −0
A etc/woodpecker/analysis.sh View
@@ -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";
M etc/woodpecker/analysis.yml View
@@ -8,21 +8,4 @@ pipeline:
88 imlib2-dev xorgproto \
99 libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null
1010 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
M etc/woodpecker/clang-tidy-checks View
@@ -8,6 +8,7 @@ misc-*,android-cloexec-*,cert-*,llvm-include-order
88 -bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-incorrect-roundings
99 -bugprone-implicit-widening-of-multiplication-result,-bugprone-integer-division
1010 -android-cloexec-fopen,-android-cloexec-pipe,-cert-err33-c
11+-bugprone-assignment-in-if-condition
1112
1213 # false positive warnings
1314 -clang-analyzer-valist.Uninitialized