Skip to content

Add cppcheck to CI/CD #733

@zjeffer

Description

@zjeffer

To improve code quality, performance, and avoid bugs, we could run cppcheck: http://cppcheck.net/ and check for improvements (similar to clang-tidy).

I've tested it out on the repo with the following options:

cppcheck --enable=all --inconclusive --force --inline-suppr --library=qt --project=build/compile_commands.json --suppress="*:3rdParty*" --suppress="*:build/*" -i 3rdParty/ -i build --suppress=missingIncludeSystem --suppress=missingInclude --quiet -j$(nproc) --disable=unusedFunction --check-level=exhaustive 2>&1 | tee cppcheck.txt

Some of the suppressions are because we don't care about 3rdParty code, and because some false positives are popping up (missing includes when they aren't actually missing).

Here's the output: cppcheck.txt

Cppcheck can be integrated into PRs with GitHub actions so that when a user submits a PR, a cppcheck bot will 'review' the PR and leave comments to improve the code. We should also run it periodically to check for improvements.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions