Repository navigation
Remove code-level suppression — only config-level severityOverrides may silence findings #29
Description
Policy
KarpeSlop must never suppress findings because of source-code comments.
These comments must not hide findings:
eslint-disableeslint-disable-lineeslint-disable-next-line@ts-ignore@ts-expect-error
Findings may be suppressed only through reviewed configuration (severityOverrides in .karpesloprc.json).
Comments and strings that contain assertion-like text are still excluded from AST detection as non-code. That is text parsing, not suppression — it must remain.
Evidence
Two separate suppression paths exist:
-
AST path (
ai-slop-detector.ts:183-201):lineIsSuppressed()checks the current and previous lines for directive substrings. Called at lines 232, 269, 286, and 303 before emitting assertion findings. -
Regex path (
ai-slop-detector.ts:1049-1057): The generic pattern loop skips matches when the same or previous line contains a directive substring.
Both paths must be removed.
Requirements
- Same-line
eslint-disable-linemust not suppress any finding. - Previous-line
eslint-disable-next-linemust not suppress any finding. @ts-ignoreand@ts-expect-errormust not suppress any finding.- The policy applies to all assertion types (direct, chained, object, array) and all regex-pattern findings.
severityOverrides: { "rule": "off" }must still suppress findings.- Disabling
unsafe_double_type_assertionmust not disable an independentunsafe_type_assertionfinding. .d.ts, test-file, mock-file, and configured path exclusions must remain.- Comments and strings containing assertion-like text must still produce no AST findings (text parsing, not suppression).
Constraints
- Do not add a replacement comment convention.
- Do not change default severities.
- Do not remove test-file, mock-file,
.d.ts, or configured path exclusions. - Do not weaken AST protections against comments, strings, and template literals.
- Do not modify unrelated detector rules.
- Do not silently mutate configuration.
Validation
Before implementation, tests exist that expect code-level suppression to work (e.g., findUnsafeAssertions does not report as any when preceded by eslint-disable-next-line). These must be converted to expect findings to remain visible.
Add new tests proving:
- Same-line
eslint-disable-linedoes not suppress. - Previous-line
eslint-disable-next-linedoes not suppress. @ts-ignoredoes not suppress.@ts-expect-errordoes not suppress.- All assertion forms (direct, chained, object, array) are affected.
- A representative regex-pattern finding is also affected.
severityOverridesstill suppresses the configured rule.- Disabling one chained rule does not disable independent findings.
- Comments/strings with assertion text are still not parsed as code.
Rollback
A single reverted commit restores both suppression paths.
Relationship to Original Scope
This issue was originally filed as "findUnsafeAssertions suppression matching is substring-based, not directive-aware" — a narrow accuracy fix. The user has since decided that code-level suppression should not work at all. The scope is upgraded to match that policy decision.
Activity
coderabbitai commentedon Jul 27, 2026
🔗 Related PRs
#9 - fix: resolve all false positives (issues
#2,#6,#7,#8) [closed]#23 - feat: detect unsafe TypeScript type assertions via AST (issue
#22) [open]#24 - feat: migrate unsafe_type_assertion from regex to AST detection [open]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
[-]findUnsafeAssertions suppression matching is substring-based, not directive-aware[/-][+]Remove code-level suppression — only config-level severityOverrides may silence findings[/+]Cover more rules and directives in the suppression test
Test that suppression comments do not hide customPatterns findings
Test that suppression comments do not hide findings
Cover more rules and directives in the suppression test
Test that suppression comments do not hide customPatterns findings
CodeDeficient commentedon Oct 25, 2026
The AST rebuild in #34 fixed this: findings no longer depend on inline suppression comments, and silencing is config-only via
severityOverrides. #46 adds tests that prove it for rule findings and forcustomPatternsin the CLI. Closing.Generated by Claude Code