# src/test/lint/Makefile -- T11 static + style gate.
#
#   make            run styleLint, asciiCheck, staticGate (fails on new findings)
#   make baseline   regenerate all three baselines from the current tree
#   make style      styleLint only
#   make ascii      asciiCheck only
#   make static     staticGate (cppcheck + -fanalyzer; slow)
#   make cppcheck   staticGate cppcheck pass only
#   make selftest   test staticGate's baseline merge logic (fast)
#
# cppcheckBaseline.txt / analyzerBaseline.txt list accepted findings as
# "<count> <key>", each preceded by its justification comment:
#   # FP: <reason>          triaged false positive
#   # THIRDPARTY: <reason>  upstream code, not modified by DVX
#   # UNTRIAGED ...         accepted by an update, nobody has looked yet
# "make baseline" (staticGate.sh --update) MERGES rather than rewriting:
# comments stay with keys that still occur, keys now at 0 are dropped
# (their comments are printed), and every new or grown key gets an
# UNTRIAGED line.  "make static" warns loudly about UNTRIAGED entries but
# only fails on new/increased findings, so triage each UNTRIAGED entry
# (fix it or write the FP reason) before committing a baseline update.
#
# staticGate needs cppcheck and fails (it never passes silently) when it
# is missing.  Install cppcheck, or run e.g.
#   make STATIC_SKIP_CPPCHECK=1
# to skip only the cppcheck pass deliberately (reported on stderr).

.PHONY: all style ascii static cppcheck baseline selftest

all: style ascii selftest static

style:
	python3 ./styleLint.py

ascii:
	./asciiCheck.sh

static:
	./staticGate.sh

cppcheck:
	./staticGate.sh --cppcheck-only

selftest:
	./staticGate.sh --self-test

baseline:
	python3 ./styleLint.py --update-baseline --summary
	./asciiCheck.sh --update
	./staticGate.sh --update
