Skip to content

feat(enrichment): empty-catch / error-swallow analyzer #2014

Description

@JSONbored

New REES local analyzer that flags newly-added catch blocks that swallow the error (empty body, or body that neither rethrows, logs, nor references the caught binding) — a top source of silent failures the headless reviewer often misses. Pure compute over added diff lines, no network, no GitHub token. Follows the established actions-pin.ts pattern exactly.

Deliverables

  • Add ErrorSwallowFinding interface ({ file, line, kind: 'empty-catch'|'unused-binding'|'return-null' }) and an errorSwallow? key to BriefFindings in review-enrichment/src/types.ts
  • Create review-enrichment/src/analyzers/error-swallow.ts: parse added hunk lines for catch (e) {} / catch blocks that never reference the binding or rethrow; scoped to JS/TS/Python (except: pass) source files; cap findings via a maxFindings limit
  • Register a descriptor in review-enrichment/src/analyzers/registry.ts (category: 'quality', cost: 'local', requires: ['files'], defaultEnabled: true) with an inline render() emitting a value-safe file:line list
  • Add review-enrichment/test/error-swallow.test.ts (node:test against dist/) covering: empty catch flagged, catch that logs/rethrows NOT flagged, the maxFindings cap, and clean input yields none
  • Verify a public-safe brief block renders file:line with no code content

References

  • review-enrichment/src/analyzers/actions-pin.ts (pure-local pattern to copy)
  • review-enrichment/src/analyzers/secret/descriptor.ts (inline render() pattern)
  • review-enrichment/src/analyzers/registry.ts:158-175 (redos descriptor as a local-analyzer template)
  • review-enrichment/src/types.ts:289-311 (BriefFindings)
  • review-enrichment/src/analyzers/types.ts (AnalyzerDescriptor contract)

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