Skip to content

feat(enrichment): unsafe-any (TS) counter analyzer #2017

Description

@JSONbored

New REES local analyzer that counts and locates explicit any type annotations and as any casts newly introduced in TypeScript diffs — a type-safety erosion signal the reviewer can weigh. Pure compute over added lines in .ts/.tsx files, no network. Structural regex only (no type-checker), fail-safe.

Deliverables

  • Add UnsafeAnyFinding ({ file, line, kind: 'annotation'|'cast'|'assertion' }) + unsafeAny? key to review-enrichment/src/types.ts
  • Create review-enrichment/src/analyzers/unsafe-any.ts: match : any, <any>, as any in added TS lines, ignoring occurrences inside string/comment where cheaply detectable; cap with maxFindings
  • Register a local descriptor (category 'quality', cost 'local', requires ['files']) with inline render() in review-enrichment/src/analyzers/registry.ts
  • Add review-enrichment/test/unsafe-any.test.ts covering annotation vs cast vs assertion, non-TS files skipped, string/comment false-positive avoidance, and the cap

References

  • review-enrichment/src/analyzers/redos.ts (regex-over-added-lines local analyzer with maxLineChars/maxFindings limits)
  • review-enrichment/src/analyzers/registry.ts:158-175 (redos descriptor limits shape)
  • review-enrichment/src/analyzers/types.ts (AnalyzerCategory 'quality')

Part of #1499.


size: S · gittensor:feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions