Repository navigation
Reporting: --min-classes filter + 0-disables tier semantics + new defaults - #14
Merged
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13
Summary
Reworks the threshold model: adds a
--min-classesfilter, makes0mean "off" for each tier, raises defaults (code + dogfood config), and updates all docs.Changes
--min-classes <n>(new): suppresses chains traversing fewer thanndistinct classes. Default0= off. Gates both tiers inThresholds::severityOf(). Config key:minClasses. No diff/baseline interaction (composes at severity time).0disables a tier:--limit 0disables the error tier (limit > 0 && hops >= limit).--warn-limit 0is normalized tonull(off). ThewarnLimit >= limitguard fires only when both are> 0.New defaults (frozen-semantics revision):
--limitdefault3→6,--warn-limitdefaultnull→4. Applied to both code-level defaults andphptramp.dist.json(dogfood config). The repo'ssrc/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 showsmin-classeswhen> 0.Docs: help text, README CLI block + config table +
--warn-limitsection,docs/plan.mdfrozen-semantics item 4 — all updated.Verification
composer checkgreen (427 tests, 1459 assertions)composer infection:diffMSI 94% (≥ 80% gate; escaped mutants are pre-existing, not in touched files)"minClasses": 0--limit/--warn-limitexplicitlyCommits (8)
feat(#13): min-classes filter and 0-disables semantics in Thresholdsfeat(#13): add --min-classes CLI flagfeat(#13): emit minClasses in JSON and wire through to Thresholdsfeat(#13): show min-classes in text footer when setfeat(#13): minClasses config keyfeat(#13): raise default limit to 6 and warn-limit to 4docs(#13): document --min-classes and new defaultstest(#13): fixtures for min-classes and 0-disables behavior