Skip to content

feat(enrichment): long-file / big-function heuristic analyzer #2019

Description

@JSONbored

New REES local analyzer that flags size/altitude smells structurally: a changed file whose new length exceeds a threshold, and functions whose body (brace/indent span) added in the diff exceeds a line threshold. Reviewer signal for maintainability, distinct from cyclomatic complexity (bundled into #1477). Pure compute, no network — length can be computed from patch hunks + additions.

Deliverables

  • Add SizeSmellFinding ({ file, line?: number, kind: 'long-file'|'big-function', measure: number, threshold: number, name?: string }) + sizeSmell? key to review-enrichment/src/types.ts
  • Create review-enrichment/src/analyzers/size-smell.ts: estimate new file length from patch hunk headers/additions; scan added lines for function declarations and estimate body length by brace/indent balance; configurable maxFileLines/maxFunctionLines limits; cap findings
  • Register a local descriptor (category 'quality', cost 'local', requires ['files']) with inline render() in review-enrichment/src/analyzers/registry.ts
  • Add review-enrichment/test/size-smell.test.ts covering long-file threshold, big-function detection, sub-threshold clean case, and the finding cap

References

  • review-enrichment/src/analyzers/actions-pin.ts (hunk header parsing for line numbers/length)
  • review-enrichment/src/analyzers/registry.ts:158-175 (limits object 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