Skip to content

tutorial: Setting up CRAP baseline comparison in CI #151

@jflowers

Description

@jflowers

Topic

Step-by-step tutorial for setting up per-function CRAP regression detection using gaze's baseline comparison feature.

Target Audience

Go developers using gaze in CI pipelines who want to detect CRAP score regressions on every PR.

Suggested Structure

  1. Prerequisites: gaze installed, Go project with tests, CI pipeline (GitHub Actions)
  2. Create initial baseline: Run gaze crap --format=json --coverprofile=coverage.out ./... > .gaze/baseline.json, commit to VCS
  3. CI integration: Add baseline comparison step to GitHub Actions workflow (auto-detection, no flags needed)
  4. Understanding output: Reading regression/improvement/new/removed classifications
  5. Tuning sensitivity: Adjusting epsilon and new-function threshold in .gaze.yaml
  6. Refreshing the baseline: When and how to update the baseline (after releases, after intentional score changes)
  7. Troubleshooting: Common issues (stale baseline, config drift, function renames)

Prerequisites

  • gaze v0.x.x+ (version with baseline comparison)
  • Go 1.24+
  • GitHub Actions (or equivalent CI)

PR Reference

unbound-force/gaze PR #120 (branch: opsx/baseline-comparison)

Metadata

Metadata

Assignees

No one assigned

    Labels

    tutorialTutorial opportunity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions