Skip to content

AST migration removed test-file exemption for unsafe_type_assertion #26

Closed

Description

@CodeDeficient

Finding

The old regex-based unsafe_type_assertion detection at ai-slop-detector.ts:1120-1127 explicitly skipped findings in files whose path contained test, spec, or __tests__. The AST migration (PR #24) removed this exemption.

Accepted behavior change

This is an accepted non-critical finding per the PR review. The user considers the exemption overly broad and prefers no special-casing — severityOverrides can suppress the rule for test directories if needed.

Related

Activity

  1. coderabbitai commented on Jul 27, 2026

    @coderabbitai
    🔗 Related PRs

    #9 - fix: resolve all false positives (issues #2, #6, #7, #8) [closed]
    #15 - feat: add positional path arguments for single-file/directory targeting [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 plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 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:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. CodeDeficient commented on Jul 27, 2026

    @CodeDeficient
    OwnerAuthor

    Resolved by eef4363 — test-file exclusion for unsafe_type_assertion was restored via skipTests:true on the pattern definition. The scope is narrower than the pre-migration heuristic (uses standard isTestFile classification: .test., .spec., tests, mocks, test-) but the exemption itself is back. Validated by test at ai-slop-detector.behavior.test.ts:413-431.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions