judgev0.7.1

Baselines and CI

Save findings as an artifact, compare later trees with it, and turn the verdict into a CI gate.

A baseline is a JSON snapshot of the findings of one tree. judge compares later trees with it without reading Git history, so it works the same on a laptop, in CI and on an unpacked archive.

Save a baseline

cargo judge --save-baseline
# baseline saved: .judge/baseline.json (N findings)

Compare

cargo judge compare .judge/baseline.json

The report lists unchanged, resolved and introduced findings and a verdict. Introduced advisory findings are listed separately and have no verdict effect. The baseline compare example shows a real run: judge 0.7.0 compared with a baseline saved right after its own source reorganisation.

For a pull-request comment, render the delta as Markdown:

cargo judge compare .judge/baseline.json --format markdown

The verdict

The verdict fails when the comparison introduces gating findings with warning or failure severity. Heuristic (advisory) findings never fail it.

Focus
From baseline to CI verdict
From baseline to CI verdictcargo judge --save-baseline writes the findings of an accepted tree to .judge/baseline.json. cargo judge compare checks a later tree against it and sorts the findings into unchanged, resolved and introduced. If an introduced finding is gating and has warning or failure severity, the verdict fails and judge exits with 1; otherwise the verdict passes and judge exits with 0. Introduced advisory findings are listed but never change the verdict.Accepted tree → baseline.json: writesbaseline.json → cargo judge compare: readsLater tree → cargo judge compare: analysescargo judge compare → New gating findings?New gating findings? → verdict: fail: yesNew gating findings? → verdict: pass: nowritesreadsanalysesyesnoAccepted tree – cargo judge --save-baselineAccepted treecargo judge --save-baselinebaseline.json – in .judge/baseline.jsonin .judge/Later tree – after the refactoringLater treeafter the refactoringcargo judge compare – unchanged, resolved, newcargo judge compareunchanged, resolved, newNew gating findings? – warning or failure severityNew gating findings?warning or failure severityverdict: fail – exit 1verdict: failexit 1verdict: pass – exit 0verdict: passexit 0

Source: src/baseline.rs (Delta::verdict), src/commands/baseline_output.rs, src/main.rs (exit codes)

Show chart data
Data for From baseline to CI verdict
StepKindLeads to
Accepted treestartbaseline.json (writes)
baseline.jsondata storecargo judge compare (reads)
Later treestartcargo judge compare (analyses)
cargo judge comparestepNew gating findings?
New gating findings?decisionverdict: fail (yes), verdict: pass (no)
verdict: failend
verdict: passend
Focus
From baseline to CI verdict
From baseline to CI verdictcargo judge --save-baseline writes the findings of an accepted tree to .judge/baseline.json. cargo judge compare checks a later tree against it and sorts the findings into unchanged, resolved and introduced. If an introduced finding is gating and has warning or failure severity, the verdict fails and judge exits with 1; otherwise the verdict passes and judge exits with 0. Introduced advisory findings are listed but never change the verdict.Accepted tree → baseline.json: writesbaseline.json → cargo judge compare: readsLater tree → cargo judge compare: analysescargo judge compare → New gating findings?New gating findings? → verdict: fail: yesNew gating findings? → verdict: pass: nowritesreadsanalysesyesnoAccepted tree – cargo judge --save-baselineAccepted treecargo judge --save-baselinebaseline.json – in .judge/baseline.jsonin .judge/Later tree – after the refactoringLater treeafter the refactoringcargo judge compare – unchanged, resolved, newcargo judge compareunchanged, resolved, newNew gating findings? – warning or failure severityNew gating findings?warning or failure severityverdict: fail – exit 1verdict: failexit 1verdict: pass – exit 0verdict: passexit 0

Source: src/baseline.rs (Delta::verdict), src/commands/baseline_output.rs, src/main.rs (exit codes)

Show chart data
Data for From baseline to CI verdict
StepKindLeads to
Accepted treestartbaseline.json (writes)
baseline.jsondata storecargo judge compare (reads)
Later treestartcargo judge compare (analyses)
cargo judge comparestepNew gating findings?
New gating findings?decisionverdict: fail (yes), verdict: pass (no)
verdict: failend
verdict: passend
Focus
From baseline to CI verdict
From baseline to CI verdictcargo judge --save-baseline writes the findings of an accepted tree to .judge/baseline.json. cargo judge compare checks a later tree against it and sorts the findings into unchanged, resolved and introduced. If an introduced finding is gating and has warning or failure severity, the verdict fails and judge exits with 1; otherwise the verdict passes and judge exits with 0. Introduced advisory findings are listed but never change the verdict.Accepted tree → baseline.json: writesbaseline.json → cargo judge compare: readsLater tree → cargo judge compare: analysescargo judge compare → New gating findings?New gating findings? → verdict: fail: yesNew gating findings? → verdict: pass: nowritesreadsanalysesyesnoAccepted tree – cargo judge --save-baselineAccepted treecargo judge--save-baselinebaseline.json – in .judge/baseline.jsonin .judge/Later tree – after the refactoringLater treeafter therefactoringcargo judge compare – unchanged, resolved, newcargo judgecompareunchanged,resolved, newNew gating findings? – warning or failure severityNew gatingfindings?warning orfailure severityverdict: fail – exit 1verdict: failexit 1verdict: pass – exit 0verdict: passexit 0

Source: src/baseline.rs (Delta::verdict), src/commands/baseline_output.rs, src/main.rs (exit codes)

Show chart data
Data for From baseline to CI verdict
StepKindLeads to
Accepted treestartbaseline.json (writes)
baseline.jsondata storecargo judge compare (reads)
Later treestartcargo judge compare (analyses)
cargo judge comparestepNew gating findings?
New gating findings?decisionverdict: fail (yes), verdict: pass (no)
verdict: failend
verdict: passend
Focus
From baseline to CI verdict
From baseline to CI verdictcargo judge --save-baseline writes the findings of an accepted tree to .judge/baseline.json. cargo judge compare checks a later tree against it and sorts the findings into unchanged, resolved and introduced. If an introduced finding is gating and has warning or failure severity, the verdict fails and judge exits with 1; otherwise the verdict passes and judge exits with 0. Introduced advisory findings are listed but never change the verdict.Accepted tree → baseline.json: writesbaseline.json → cargo judge compare: readsLater tree → cargo judge compare: analysescargo judge compare → New gating findings?New gating findings? → verdict: fail: yesNew gating findings? → verdict: pass: nowritesreadsanalysesyesnoAccepted tree – cargo judge --save-baselineAccepted treecargo judge--save-baselinebaseline.json – in .judge/baseline.jsonin .judge/Later tree – after the refactoringLater treeafter therefactoringcargo judge compare – unchanged, resolved, newcargo judgecompareunchanged,resolved, newNew gating findings? – warning or failure severityNew gatingfindings?warning orfailure severityverdict: fail – exit 1verdict: failexit 1verdict: pass – exit 0verdict: passexit 0

Source: src/baseline.rs (Delta::verdict), src/commands/baseline_output.rs, src/main.rs (exit codes)

Show chart data
Data for From baseline to CI verdict
StepKindLeads to
Accepted treestartbaseline.json (writes)
baseline.jsondata storecargo judge compare (reads)
Later treestartcargo judge compare (analyses)
cargo judge comparestepNew gating findings?
New gating findings?decisionverdict: fail (yes), verdict: pass (no)
verdict: failend
verdict: passend
Exit code Meaning
0 Verdict passes.
1 Verdict fails on introduced gating findings.
2 Error: unreadable or unsupported baseline, broken judge.toml, analyzer failure. No verdict is given on incomplete analysis.

In CI

Commit the baseline (or restore it as a CI artifact) and let a job compare against it. A GitHub Actions step could look like this:

- name: judge
  run: |
    cargo install cargo-judge --locked
    cargo judge compare .judge/baseline.json

Refresh the baseline deliberately, with cargo judge --save-baseline, when you accept the new state.

cargo judge health --score prints a score from 0 to 100 and a letter grade (A ≥ 90, B ≥ 80, C ≥ 70, D ≥ 60, F below). Deductions are severity-weighted and normalised by authored-LOC density; advisory findings are not scored.

  • The score is a configurable trend index, not an objective quality ranking. The delta against a baseline is the message, not the absolute number.
  • A trend is shown only with --baseline PATH, and only when the baseline used the same score formula version and the same crate profiles. Anything else is reported as not comparable.
  • Without a basis for a score, for example no authored lines of code, the score is reported as unavailable and judge exits with 2 — never a fake perfect score.

Per-crate weighting profiles are opt-in in judge.toml:

[[crate_profile]]
name = "parsers"
crates = ["my-parser"]
deduction_multiplier = 0.5

Edit this page on GitHub · Docs for v0.7.1