Skip to content

feat(enrichment): deep-nesting / arrow-anti-pattern heuristic analyzer #2030

Description

@JSONbored

New REES local analyzer that flags deeply-nested control flow newly added in the diff (indentation/brace depth beyond a threshold inside a single added block) — the 'arrow anti-pattern' readability smell, distinct from cyclomatic complexity. Structural, pure compute over added lines, no network.

Deliverables

  • Add DeepNestingFinding ({ file, line, depth: number, threshold: number }) + deepNesting? key to review-enrichment/src/types.ts
  • Create review-enrichment/src/analyzers/deep-nesting.ts: track brace/indent depth across contiguous added lines within a hunk, flag the peak when it exceeds a configurable maxDepth; 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/deep-nesting.test.ts covering an over-threshold nest flagged, a shallow block not flagged, both sides of the depth comparison, and the cap

References

  • review-enrichment/src/analyzers/actions-pin.ts (contiguous added-line hunk walk)
  • review-enrichment/src/analyzers/registry.ts:158-175 (limits shape)
  • review-enrichment/src/types.ts:289-311

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

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions