Conventions¶
Enforced project-wide. A finding that matches a convention is handled by it, not tracked as a bug.
Coding¶
- Named parameters. Mark unused ones
[[maybe_unused]]instead of leaving them unnamed. Enforced byreadability-named-parameter. fmtfor formatted I/O. Replacefscanf,fprintf,printfandsprintf:fmt::print(logfile, "{}\t{}\n", pts, pre);. Needsfind_package(fmt REQUIRED)andfmt::fmt.- Checked numeric casts. Use
safe_cast<int>(container.size()), notstatic_cast. Enforced bybugprone-narrowing-conversions. - GStreamer bindings. Type-binding code is exempt from
cppcoreguidelines-pro-type-cstyle-cast,bugprone-casting-through-void,bugprone-assignment-in-if-conditionandcppcoreguidelines-pro-type-vararg, because theGST_*andG_DEFINE_TYPEmacros trip them. Use// NOLINT(check-name)on those lines, never a global suppression.
PR gate¶
Every check is a required status check, so findings are fixed before merge. In Settings > Branches, require clang-format, clang-tidy, cppcheck and flawfinder, and require branches to be up to date.
| Tool | False-positive suppression |
|---|---|
| clang-tidy | // NOLINTNEXTLINE(check-name) or // NOLINT(check-name) |
| cppcheck | Entry in cppcheck.suppress |
| flawfinder | // Flawfinder: ignore on the same line |
| clang-format | // clang-format off and // clang-format on |
Full-codebase scan¶
For a legacy codebase or an audit, run inside the builder container:
find . -name '*.cpp' | xargs clang-tidy -p build/
cppcheck --enable=all --suppressions-list=cppcheck.suppress .
flawfinder --minlevel=2 --columns --context .
Refreshing pinned requirements¶
Dependabot opens weekly grouped PRs for .github/requirements, tests/ts-tools and tests/jscpd-tools. It cannot see the hashed heredocs in cpp-quality.yml and infra-lint.yml: run scripts/refresh-locks.sh, then paste each printed block over its REQUIREMENTS heredoc by hand.