Skip to content

Reporting: --min-classes filter + 0-disables tier semantics + new defaults - #14

Merged
larspohlmann merged 9 commits into
developfrom
feature/13-min-classes-and-zero-disables
Aug 12, 2026
Merged

larspohlmann merged 9 commits into
developfrom
feature/13-min-classes-and-zero-disables

Conversation

@larspohlmann

Copy link
Copy Markdown
Owner

Closes #13

Summary

Reworks the threshold model: adds a --min-classes filter, makes 0 mean "off" for each tier, raises defaults (code + dogfood config), and updates all docs.

Changes

--min-classes <n> (new): suppresses chains traversing fewer than n distinct classes. Default 0 = off. Gates both tiers in Thresholds::severityOf(). Config key: minClasses. No diff/baseline interaction (composes at severity time).

0 disables a tier: --limit 0 disables the error tier (limit > 0 && hops >= limit). --warn-limit 0 is normalized to null (off). The warnLimit >= limit guard fires only when both are > 0.

New defaults (frozen-semantics revision): --limit default 3 → 6, --warn-limit default null → 4. Applied to both code-level defaults and phptramp.dist.json (dogfood config). The repo's src/ currently has max 2-hop chains, so the dogfood gate reports nothing under the new thresholds — accepted as the cost of the new defaults.

Output: JSON gains "minClasses" after "warnLimit". Text footer shows min-classes when > 0.

Docs: help text, README CLI block + config table + --warn-limit section, docs/plan.md frozen-semantics item 4 — all updated.

Verification

  • composer check green (427 tests, 1459 assertions)
  • composer infection:diff MSI 94% (≥ 80% gate; escaped mutants are pre-existing, not in touched files)
  • 5 new end-to-end fixtures pin the new behavior
  • All 15 existing fixtures updated with "minClasses": 0
  • All tests relying on old defaults now set --limit/--warn-limit explicitly

Commits (8)

  1. feat(#13): min-classes filter and 0-disables semantics in Thresholds
  2. feat(#13): add --min-classes CLI flag
  3. feat(#13): emit minClasses in JSON and wire through to Thresholds
  4. feat(#13): show min-classes in text footer when set
  5. feat(#13): minClasses config key
  6. feat(#13): raise default limit to 6 and warn-limit to 4
  7. docs(#13): document --min-classes and new defaults
  8. test(#13): fixtures for min-classes and 0-disables behavior

Add minClasses param (default 0 = off): severityOf returns null when
finding.classes < minClasses. limit: 0 disables the error tier
(limit > 0 && hops >= limit). warnLimit: 0 is normalized to null
(off). The warn-limit-below-limit guard fires only when both are
positive, so --limit 0 --warn-limit 4 is allowed.

Revises docs/plan.md frozen semantics: default --limit 3 -> 6,
--warn-limit null -> 4 (applied in a later task on Options/ArgvParser).
Parsed into Options.minClasses (int, default 0 = off). No threshold
or default changes yet — just the flag plumbing.
ReporterFactory and Application pass Options.minClasses to the
Thresholds constructor. JsonReporter adds "minClasses" to the
top-level JSON document after "warnLimit". All 15 fixture
expected-findings.json files updated with "minClasses": 0.
limitClause() appends ', min-classes: <n> classes' only when
minClasses > 0, mirroring how warn-limit is shown only when set.
Strict unknown-key error now accepts "minClasses" (int). Mapped
into Options.minClasses like the other threshold keys.
FROZEN-SEMANTICS REVISION: docs/plan.md 'Default --limit is 3' is
now 6; --warn-limit default changes from null to 4. Applied to both
the code-level defaults and the repo's own phptramp.dist.json so the
dogfood config matches what consumers get out of the box. The repo's
src/ currently has max 2-hop chains, so the dogfood gate reports
nothing under the new thresholds — accepted as the cost of the new
defaults.

Every test that relied on the old defaults now sets --limit and
--warn-limit explicitly. FixtureTest default args add --warn-limit 0
to keep the guard from throwing on --limit 1. Five fixture
phptramp-args.json files and config-driven/phptramp.json add
warnLimit:0 for the same reason. OptionsTest and ReporterFactoryTest
likewise pick up explicit warnLimit:0 where they construct Options
with limit: 2.
Help text, README CLI block, config table, and docs/plan.md
frozen-semantics section updated. Default --limit 3 -> 6,
--warn-limit null -> 4, --min-classes 0 = off. The 0-disables
semantics and the relaxed guard are documented in the --warn-limit
section.
Five new fixtures:
- min-classes-gated: chain below min-classes is suppressed
- min-classes-boundary: chain at exactly min-classes is reported
- limit-zero-disables-error: --limit 0 with --warn-limit 4 fires
  warnings only (error tier off)
- warn-limit-zero-disables-warn: --warn-limit 0 disables warnings
- warn-limit-below-limit-allowed: --limit 0 --warn-limit 0 is
  accepted (relaxed guard)
@larspohlmann
larspohlmann merged commit 79b7d3d into develop Aug 12, 2026
5 checks passed
@larspohlmann
larspohlmann deleted the feature/13-min-classes-and-zero-disables branch August 12, 2026 09:09
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.

Reporting: --min-classes filter + 0-disables tier semantics + new defaults

1 participant