gaze self-check

April 9, 2026 · View on GitHub

Run CRAP analysis on Gaze's own source code. Serves as both a dogfooding exercise and a code quality gate. Reports CRAPload and the worst offenders by CRAP score. GazeCRAP scores are included when contract coverage data is available from the integrated quality pipeline.

Synopsis

gaze self-check [flags]

Arguments

This command takes no positional arguments. It automatically analyzes the ./... pattern from the module root.

Module root detection: self-check walks up from the current working directory to find the nearest go.mod file. This ensures it always analyzes the full module, even when invoked from a subdirectory.

Flags

FlagTypeDefaultDescription
--formatstringtextOutput format: text or json
--max-craploadint0 (no limit)CI gate: fail if CRAPload exceeds this count
--max-gaze-craploadint0 (no limit)CI gate: fail if GazeCRAPload exceeds this count

Configuration Interaction

The gaze self-check command does not read .gaze.yaml. It uses default CRAP options (threshold: 15) and analyzes the entire module.

Internally, self-check delegates to the same CRAP pipeline as gaze crap, with the package pattern hardcoded to ./... and the module directory resolved automatically.

Examples

Basic self-check

gaze self-check

Runs CRAP analysis on Gaze's own source code and prints the report to stdout.

CI quality gate

gaze self-check --max-crapload=10 --max-gaze-crapload=5

Exits with code 1 if CRAPload exceeds 10 or GazeCRAPload exceeds 5.

JSON output

gaze self-check --format=json | jq '.summary.crapload'

The JSON output has the same structure as gaze crap --format=json.

See Also

  • Scoring — CRAP formula and CRAPload definition
  • gaze crap — CRAP analysis on any package (self-check uses this internally)
  • Improving Scores — how to reduce CRAPload