monopam: lint :with-test scope deps
Extend [monopam lint] to check test-scoped opam deps -- previously the
unused/missing checks operated only on runtime deps (anything tagged
[:with-test], [:with-doc], or [build] was excluded from the comparison).
That left two real classes of issue silently unflagged:
- A test uses library X via [(test (libraries ... X ...))] but X has no
opam dep at all (neither runtime nor [:with-test]). Builds locally
because dune sees the union of all deps, but [opam install --with-test]
from a fresh switch would fail.
- An opam dep is declared [:with-test] but no stanza in any dune file
references it. Stale [:with-test] from a removed test, typically.
Two new issue kinds in [Monopam.Lint]:
- [Missing_test] -- emitted for the first case above. Reported as
"[<subtree>] missing :with-test: <pkgs>" in plain output.
- [Unused_test] -- emitted for the second case. Reported as
"[<subtree>] unused :with-test: <pkgs>".
Also exposed in the table renderer (separate "Missing test" / "Unused
test" columns) and the summary line.
Implementation:
- [opam_pkg] gains a [test : String_set.t] field. New
[scope_in_item / is_with_test] helpers parse the
[{with-test & ...}] grammar without conflating [:with-test] with
[:with-doc] or [:build] (which the existing [is_scoped] still
collapses).
- [extract_used_libs] takes a [?scope:[\`Both | \`Runtime | \`Test]]
argument that filters by stanza kind ([library]/[executable]/
[executables] vs [test]/[tests]). [(mdx ...)] stanzas surface as a
test-scope use of [mdx], so packages that declare [(mdx :with-test)]
in opam aren't falsely flagged as unused-test.
- [check_package] takes a [~dune_test_pkgs] set in addition to
[~dune_pkgs]. The test-scope checks subtract [dune_pkgs] (any-stanza
uses), [runtime_deps], [own_set], and [implicit_deps] -- so a
[:with-test] dep used by a fuzz [(executable ...)] that runs only
via [(rule (alias runtest))] is still considered "used".
[lint.mli] kind doc-comments updated to spell out the new variants.