Skip to content

Commit

Permalink
CI: add a cppcheck master config (which may only fails on push, not p…
Browse files Browse the repository at this point in the history
…ull requests)
  • Loading branch information
rouault committed Jan 12, 2025
1 parent 0b5659c commit 4a77a6a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ jobs:
- name: Run cppcheck test
run: ./scripts/cppcheck.sh

cppcheck_master:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Requirements
run: |
sudo apt update
sudo apt install -y --no-install-recommends cmake g++ make
- name: Build cppcheck
run: |
git clone https://github.com/danmar/cppcheck
cd cppcheck
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install
cd ../..
- name: Run cppcheck test (on push events)
if: ${{ github.event_name == 'push' }}
run: |
./scripts/cppcheck.sh
- name: Run cppcheck test, but ignore failures (on pull request)
if: ${{ github.event_name == 'pull_request' }}
run: |
cd build
# Do not fail the job. This is just used as a tool to monitor how we are regarding recent cppcheck
./scripts/cppcheck.sh || /bin/true
other_checks:
runs-on: ubuntu-24.04
steps:
Expand Down
5 changes: 5 additions & 0 deletions scripts/cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ grep -v "unmatchedSuppression" ${LOG_FILE} \
| grep -v -e "molodensky.*unreadVariable,Variable 'point.*' is assigned a value that is never used" \
| grep -v -e "vgridshift.*unreadVariable,Variable 'point.*' is assigned a value that is never used" \
| grep -v -e "defines member function with name.*also defined in its parent" \
| grep -v "passedByValueCallback,Function parameter 'lpz' should be passed by const reference" \
| grep -v "passedByValueCallback,Function parameter 'xyz' should be passed by const reference" \
| grep -v "passedByValueCallback,Function parameter 'geod' should be passed by const reference" \
| grep -v "passedByValueCallback,Function parameter 'cart' should be passed by const reference" \
| grep -v "passedByValueCallback,Function parameter 'in' should be passed by const reference" \
> ${LOG_FILE}.tmp
mv ${LOG_FILE}.tmp ${LOG_FILE}

Expand Down

0 comments on commit 4a77a6a

Please sign in to comment.