Files
codebase-memory-mcp/scripts/lint-mem-whitelist.txt
Martin Vogel 0c223d9027 build(lint): pin analyzer suppressions to the code they argue about
The memory gate stays gating, and it now has a way to record a genuine
false positive that cannot quietly outlive its own reasoning.

A whitelist entry names one (file, function, check) and carries two
things: why the analyzer is wrong, argued from the code, and what was
tried before concluding that. The entry is pinned to the sha256 of that
function's text. Edit the function and the entry stops counting -- the
finding comes back and has to be argued again against the code as it now
is. This is the part that matters. A suppression that survives the code
it was written about reads as "reviewed" while being nothing of the
kind, which is worse than no suppression at all.

The gate fails on: a finding with no entry, a finding whose entry has
gone stale, and an entry that asserts rather than argues (there is a
floor on how much reasoning an entry must actually contain -- the
mechanical half of "argued, not asserted"; whether the argument is
correct stays a review question). An entry that matches no finding is
reported but does not fail, because analyzer versions differ across
platforms.

NOLINT is still not honoured here and the gate does not read it.

The whitelist ships empty: the analyzer is currently clean across
LINT_SRCS, so nothing is being suppressed today. The mechanism exists
for the first finding that genuinely warrants it.

Verified by exercising each path rather than only the clean one: an
unaccounted finding fails and names its enclosing function; an argued
entry with a matching hash passes; the same entry fails as STALE once
the hash no longer matches the function; and an entry that says only
"false positive" fails for not arguing its case.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-08-03 15:37:33 +02:00

33 lines
1.6 KiB
Plaintext

# clang-analyzer memory gate — argued false positives
#
# The gate (make -f Makefile.cbm lint-mem-ci) fails on any finding it cannot
# account for. A finding is accounted for by being FIXED, or — only when the
# analyzer is genuinely wrong — by an entry here.
#
# An entry is an argument about one specific function, so it is pinned to the
# sha256 of that function's text. Change the function and the entry stops
# counting: the finding returns and must be argued again against the code as
# it now stands. That is deliberate. A suppression that outlives the reasoning
# behind it is worse than no suppression, because it reads as "reviewed".
#
# Rules:
# * Argue from the code. "False positive" is not an argument; "the analyzer
# does not model that cbm_arena_alloc never returns NULL because it aborts
# on exhaustion, so the NULL branch it walks is unreachable" is.
# * Record what was tried first. A finding that could have been designed
# away should be designed away, not whitelisted.
# * Never NOLINT. The repo bans it and the gate does not honour it.
#
# Format — one block per (file, function, check):
#
# ## src/foundation/example.c :: cbm_example_fn :: clang-analyzer-unix.Malloc
# segment-sha256: <64 hex chars, from scripts/lint-mem-gate.py --hash FILE FN>
# why: |
# Argument grounded in the code.
# tried: |
# What was attempted before concluding the analyzer is wrong.
#
# ── entries ──────────────────────────────────────────────────────
#
# (none — the gate is clean. The first genuine false positive goes here.)