File: run_cppcheck.sh

package info (click to toggle)
gjs 1.86.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,724 kB
  • sloc: cpp: 39,075; javascript: 30,720; ansic: 15,971; sh: 1,759; python: 772; xml: 135; makefile: 40
file content (33 lines) | stat: -rwxr-xr-x 1,542 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
# SPDX-FileCopyrightText: 2017 Claudio André <claudioandre.br@gmail.com>
# SPDX-FileCopyrightText: 2021 Philip Chimento <philip.chimento@gmail.com>

cd ${BUILDDIR:-_build}
if ! test -f compile_commands.json; then
    echo "compile_commands.json missing. Generate it with ninja -t compdb"
    exit 1
fi

# Usage:
# add -q for just the errors and no progress reporting.
# add -f to force-check every configuration (takes a long time).
# add -j4 for faster execution with multiple jobs.
# add --enable=style to check style rules. There are some false positives.

# duplInheritedMember: does not mix well with overshadowing constexpr static
# members in CRTP classes.
# incorrectStringBooleanError: does not mix well with the assertion message
# idiom.
# nullPointerRedundantCheck, nullPointerArithmeticRedundantCheck: False positive
# when using g_assert_nonnull(). Check again when
# https://github.com/danmar/cppcheck/pull/5830 is available.
cppcheck --project=compile_commands.json --check-level=exhaustive \
    --inline-suppr --error-exitcode=1 --enable=warning,performance,portability \
    --suppress=duplInheritedMember --suppress=incorrectStringBooleanError \
    --suppress=nullPointerArithmeticRedundantCheck \
    --suppress=nullPointerRedundantCheck \
    --suppress=*:subprojects/* --suppress=*:js-resources.c \
    --suppress=*:test/mock-js-resources.c \
    --suppress=*:installed-tests/js/jsunit-resources.c \
    --library=gtk,cairo,posix,../tools/cppcheck.cfg $@