fix(cli): emit parseable suppress tokens in every human footer section#1835
Merged
Merged
Conversation
section_suppress_rule in the human report emitted hardcoded token strings that fallow_types::suppress::parse_suppression_target did not recognize for eight sections (unused-exports, unused-types, unused-dependencies, unused-enum-members, unused-class-members, unresolved-imports, unlisted-dependencies, duplicate-exports): the strings existed only as config keys or MCP names, never as IssueKind codes or aliases. Following the printed hint produced a comment that suppressed nothing and then surfaced a stale-suppression finding. Derive each section's token from the issue registry instead. A section-title to IssueKind map feeds issue_kind_to_kebab (the kind's suppress_token, falling back to its code), so the emitted token always parses back to the same kind. is_file_level_only is likewise derived from the registry's suppress_file_level flag, fixing two drifts: duplicate-export (file-level-only per its detector) now prints the file-level form, and circular-dependency / boundary-violation (which honor next-line suppression) now print the next-line form. Dependency sections whose findings live in package.json emit no hint rather than a token pointing at an impossible inline comment. A roundtrip guard test asserts every token section_suppress_rule can emit parses via parse_suppression_target and uses the file-level form exactly when the registry marks the kind file-level-only, so this surface stays locked down. Fixes #1828
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.
The human footer's suppress hints came from a hand-maintained token list that had drifted from the suppression parser: eight sections printed tokens
IssueKind::parsedoes not recognize (config keys or plurals with no registered alias), so following the printed hint suppressed nothing and then surfaced a stale-suppression finding on top.The mapping is now derived from the issue registry: one section-title-to-
IssueKindmap remains hand-maintained, and the printed token plus the file-level hint form come from each kind's registry row, so the hint can never drift from what the parser accepts. Consequences beyond the eight broken tokens: the dependency sections print no hint anymore (their findings live in package.json, where inline comments cannot exist),circular-dependencyandboundary-violationhints corrected from file-level to next-line andduplicate-exportfrom next-line to file-level (all three registry-mandated and verified against the detectors), and alias-form tokens normalized to the canonical singular (existing user comments with the plural aliases keep parsing).A roundtrip guard test now asserts every emittable token parses and uses the registry's file-level form, so this bug class cannot ship again.
Fixes #1828
Validated end-to-end with the built binary: the new hints suppress their findings with zero stale-suppression fallout; the old tokens reproduce the reported bug (nothing suppressed, two stale findings).