Skip to content

fix(cxx): cppcheck include-path harvesting and information-record classification - #723

Open
karabelaselias wants to merge 1 commit into
peteromallet:mainfrom
karabelaselias:fix/cppcheck-include-path-and-information-filter
Open

fix(cxx): cppcheck include-path harvesting and information-record classification#723
karabelaselias wants to merge 1 commit into
peteromallet:mainfrom
karabelaselias:fix/cppcheck-include-path-and-information-filter

Conversation

@karabelaselias

Copy link
Copy Markdown

Problem

On C++ projects whose sources include headers outside the scanned tree (vendored or sibling-package code), the cppcheck phase produced unactionable findings:

  1. _cppcheck_include_args derived -I dirs only from in-scope headers, so external include roots recorded in the project's own compile_commands.json were never passed to cppcheck — every external header emitted missingInclude records.
  2. cppcheck's information category (missing include paths, checker reports, normalization notes) is non-actionable by definition but was captured as findings.

Fix

  • Harvest -I paths from compile_commands.json entries matching the scanned files, falling back gracefully when the database is absent or malformed.
  • Classify information-severity records as non-actionable in the phase filter.

Verification

  • New unit tests: information-record classifier, compile-db harvesting, malformed-database handling.
  • Full upstream suite: 5818 passed, 3 skipped.
  • Real-world check: C++17 rod-solver repo (114 files) — 47 information-level records and recurring missingInclude noise dissolved after the fix.

…fy cppcheck information records

Two root causes produced unactionable cppcheck findings on C++ projects
whose sources include headers outside the scanned tree (vendored or
sibling-package code):

1. _cppcheck_include_args derived -I dirs only from in-scope headers, so
   external include roots (recorded in the project's own
   compile_commands.json) were never passed to cppcheck and every
   external header produced missingInclude records. Harvest -I paths
   from compile_commands.json entries matching the scanned files,
   falling back gracefully when the database is absent or malformed.

2. cppcheck's information category (missing include paths, checker
   reports, normalization notes) is non-actionable by definition but was
   captured as findings. Classify information-severity records as
   non-actionable in the phase filter.

Verified against a C++17 rod-solver repo (114 files) where 47
information-level records and repeated missingInclude noise dissolved
after the fix; upstream test suite green (5818 passed, 3 skipped) with
new unit tests for the classifier, compile-db harvesting, and malformed
database handling.
citizenadam added a commit to citizenadam/desloppify that referenced this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant