Skip to content

Pre-change CRAP gate: --gate-on-change flag (Group 2b) #268

Closed

Description

@jflowers

Moved from zero-dot-force/vibe-check#6.

Summary

Add a --gate-on-change flag to Gaze that computes CRAP scores only for functions modified in the current changeset, failing CI if any touched function has a CRAP score above the threshold.

RFC: https://github.com/orgs/unbound-force/discussions/483 — Group 2b
Phase: 2 (Accessibility)

Context

Currently CRAP scores are computed for the entire codebase. The Boy Scout Rule demands that code you touch must meet quality standards, even if legacy code does not. This flag scopes enforcement to changed functions only.

Implementation

--gate-on-change Flag

  • Accepts a git ref or diff specification (e.g., --gate-on-change=origin/main)
  • Identifies functions modified in the diff
  • Computes CRAP scores only for those functions
  • Fails if any modified function exceeds the CRAP threshold
  • Reports which specific functions failed and their scores

Integration

  • Works with existing gaze CRAP computation
  • Compatible with CI pipelines (GitHub Actions, etc.)
  • JSON output includes a changed_functions section

Acceptance Criteria

  • --gate-on-change flag added to gaze
  • Correctly identifies functions modified in a changeset (git diff based)
  • Computes CRAP scores only for changed functions
  • Fails CI with clear output when changed functions exceed threshold
  • JSON output includes changed_functions section with per-function scores
  • Works with both staged changes and branch comparisons

Dependencies

  • Related: CRAP delta in Review Council (Group 2c)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions