Skip to content

Commit 3b5f383

Browse files
committed
CI: add a cppcheck master config (which may only fails on push, not pull requests)
1 parent 0b5659c commit 3b5f383

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/workflows/code_checks.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,39 @@ jobs:
3232
- name: Run cppcheck test
3333
run: ./scripts/cppcheck.sh
3434

35+
cppcheck_master:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Install Requirements
42+
run: |
43+
sudo apt update
44+
sudo apt install -y --no-install-recommends git cmake g++ make
45+
46+
- name: Build cppcheck
47+
run: |
48+
git clone https://github.com/danmar/cppcheck
49+
cd cppcheck
50+
mkdir build
51+
cd build
52+
cmake .. -DCMAKE_BUILD_TYPE=Release
53+
make -j$(nproc)
54+
sudo make install
55+
cd ../..
56+
57+
- name: Run cppcheck test (on push events)
58+
if: ${{ github.event_name == 'push' }}
59+
run: |
60+
./scripts/cppcheck.sh
61+
62+
- name: Run cppcheck test, but ignore failures (on pull request)
63+
if: ${{ github.event_name == 'pull_request' }}
64+
run: |
65+
# Do not fail the job. This is just used as a tool to monitor how we are regarding recent cppcheck
66+
./scripts/cppcheck.sh || /bin/true
67+
3568
other_checks:
3669
runs-on: ubuntu-24.04
3770
steps:

scripts/cppcheck.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ grep -v "unmatchedSuppression" ${LOG_FILE} \
5959
| grep -v -e "molodensky.*unreadVariable,Variable 'point.*' is assigned a value that is never used" \
6060
| grep -v -e "vgridshift.*unreadVariable,Variable 'point.*' is assigned a value that is never used" \
6161
| grep -v -e "defines member function with name.*also defined in its parent" \
62+
| grep -v "passedByValueCallback,Function parameter 'lpz' should be passed by const reference" \
63+
| grep -v "passedByValueCallback,Function parameter 'xyz' should be passed by const reference" \
64+
| grep -v "passedByValueCallback,Function parameter 'geod' should be passed by const reference" \
65+
| grep -v "passedByValueCallback,Function parameter 'cart' should be passed by const reference" \
66+
| grep -v "passedByValueCallback,Function parameter 'in' should be passed by const reference" \
6267
> ${LOG_FILE}.tmp
6368
mv ${LOG_FILE}.tmp ${LOG_FILE}
6469

0 commit comments

Comments
 (0)