judgev0.7.0

CASOON Open Source

Know what a refactoring left behind.

judge is a Cargo subcommand that reads the checked-out source tree, workspace structure, public APIs and dependency graph of a Rust workspace and turns them into deterministic, evidence-backed findings. It skips what the compiler and Clippy already report.

cargo install cargo-judge
cargo install cargo-judge --features deep
cargo install --git https://github.com/casoon/judge cargo-judge
BUSL-1.1early stagecrates.io 0.7.0Rust 1.95+no telemetry
cargo judge
⚠ Judge summary
  Analysis context: boundary rules: 0 not checked (no judge.toml)

  Evidence: 671   Advisory: 333

  Top issue rules:
     635x  duplicate-code
     243x  complexity-inflation
      39x  integer-cast-risk
      39x  maintainability-index
      22x  panic-in-lib

● Evidence-backed findings (671)
  - swallowed-result in write_cache [swallowed-result] (high confidence) at src/rules/slopsquat.rs:356
  - swallowed-result in write_cache [swallowed-result] (high confidence) at src/rules/slopsquat.rs:359
  - duplicate-code in build_functional_core_imperative_shell_heuristic [duplicate-code] (high confidence) at src/rules/principle.rs:550
  ... 668 more finding(s) (use --details to view all)

● Advisory heuristics (no verdict or score effect) (333) [advisory]
  - complexity-inflation in known_vulnerability_finding [complexity-inflation] (low confidence) at src/advisory/advisories.rs:330
  - complexity-inflation in tests::known_vulnerability_registry_example_still_triggers_the_rule [complexity-inflation] (low confidence) at src/advisory/advisories.rs:540
  - complexity-inflation in parse_lcov [complexity-inflation] (low confidence) at src/advisory/coverage.rs:155
  ... 330 more finding(s) (use --details to view all)

Next steps:
  • clone families, grouped and prioritized
    $ cargo judge dupes
  • every finding and location
    $ cargo judge --details
  • full machine-readable report in .judge/judge.json
    $ cargo judge --format json
rules in the registry: 49 gating, 29 advisory-only
78
output formats: terminal, JSON, SARIF 2.1.0, Markdown
4
tests in the default-feature build of 0.7.0
696
network calls by default; crates.io checks are opt-in
0

What it does

  1. Deterministic findings

    The same tree gives the same findings. judge reads no Git history, authorship or telemetry, so it works on archives, CI artifacts and vendored code, and on code written by people or agents alike.

  2. Evidence, not opinions

    Every rule declares an evidence class and a verdict effect. Heuristics are reported as advisory and never change the verdict or the exit code; explain-rule shows what a rule checks and where it stops.

  3. Baselines and CI verdicts

    Save the current findings as a JSON artifact, then compare any later tree with it. compare reports introduced and resolved findings and exits with 1 when new gating findings fail the verdict.

  4. Output for people and tools

    A compact terminal triage view, versioned JSON with a header and triage assessment, SARIF for code scanning, and Markdown for pull requests. judge-mcp exposes the JSON to MCP clients.

  5. Deep tier when you need it

    With the deep feature, judge loads the workspace into rust-analyzer to find pub items no other crate uses and to show the call path that keeps an item alive.

Real output

All examples →
cargo judge refactor
refactoring candidates: 50
  1. [warn] src/rules/principle.rs — 123 reasons: abstraction-inflation, complexity-inflation, duplicate-code, maintainability-index
  2. [warn] src/commands/analysis_commands.rs — 80 reasons: complexity-inflation, duplicate-code, maintainability-index, silent-default
  3. [warn] src/rules/dead_code.rs — 74 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index, silent-default, suppression-debt
  4. [warn] src/rules/pattern.rs — 72 reasons: complexity-inflation, duplicate-code, maintainability-index
  5. [warn] src/rules/deps.rs — 65 reasons: complexity-inflation, duplicate-code, maintainability-index, silent-default
  6. [warn] src/rules/slop.rs — 42 reasons: duplicate-code, maintainability-index
  7. [warn] src/rules/complexity.rs — 36 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index, panic-in-lib, restating-comment
  8. [warn] src/rules/slop_structural_deep.rs — 31 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  9. [warn] src/rules/duplication.rs — 29 reasons: complexity-inflation, duplicate-code, maintainability-index, panic-in-lib, suppression-debt
  10. [warn] src/rules/slopsquat.rs — 27 reasons: complexity-inflation, duplicate-code, maintainability-index, swallowed-result
  11. [warn] src/rules/boundaries.rs — 25 reasons: complexity-inflation, duplicate-code, maintainability-index
  12. [warn] src/main.rs — 23 reasons: complexity-inflation, duplicate-code, maintainability-index
  13. [warn] src/rules/dep_graph.rs — 23 reasons: complexity-inflation, duplicate-code, maintainability-index, silent-default
  14. [warn] src/commands/workspace_commands.rs — 21 reasons: complexity-inflation, duplicate-code, maintainability-index
  15. [warn] src/rules/module_graph.rs — 21 reasons: complexity-inflation, duplicate-code, maintainability-index, silent-default
  16. [warn] src/commands/deep_commands.rs — 20 reasons: complexity-inflation, duplicate-code, maintainability-index
  17. [warn] src/rules/api_surface.rs — 19 reasons: duplicate-code, maintainability-index
  18. [warn] src/rules/api_surface_deep.rs — 19 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  19. [warn] src/rules/slop_structural.rs — 19 reasons: complexity-inflation, duplicate-code, maintainability-index, panic-in-lib
  20. [warn] src/finding.rs — 17 reasons: complexity-inflation, duplicate-code, maintainability-index, panic-in-lib
  21. [warn] src/reachability.rs — 17 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  22. [warn] src/deep.rs — 16 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  23. [warn] src/rules/dead_trait_impl.rs — 16 reasons: complexity-inflation, duplicate-code, maintainability-index
  24. [warn] src/rules/feature_matrix.rs — 15 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index, panic-in-lib
  25. [warn] src/rules/security.rs — 15 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  26. [warn] src/rules/boundaries_deep.rs — 14 reasons: complexity-inflation, duplicate-code, maintainability-index, panic-in-lib
  27. [warn] src/advisory/advisories.rs — 12 reasons: complexity-inflation, duplicate-code, maintainability-index, silent-default
  28. [warn] src/advisory/mutants.rs — 10 reasons: complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index
  29. [warn] src/commands/combined_analysis.rs — 10 reasons: complexity-inflation, duplicate-code, maintainability-index
  30. [warn] src/advisory/coverage.rs — 9 reasons: complexity-inflation, duplicate-code, maintainability-index, panic-in-lib
  31. [warn] src/functions.rs — 9 reasons: complexity-inflation, duplicate-code, maintainability-index, suppression-debt
  32. [warn] src/rules/slop_text.rs — 9 reasons: complexity-inflation, duplicate-code, maintainability-index
  33. [warn] src/commands/combined.rs — 8 reasons: complexity-inflation, duplicate-code, suppression-debt
  34. [warn] src/ingest.rs — 8 reasons: complexity-inflation, duplicate-code, maintainability-index
  35. [warn] src/commands/advisory_commands.rs — 7 reasons: duplicate-code, maintainability-index
  36. [warn] src/commands/health_command.rs — 6 reasons: complexity-inflation, duplicate-code
  37. [warn] src/baseline.rs — 5 reasons: complexity-inflation, duplicate-code, maintainability-index
  38. [warn] src/refactor_map.rs — 5 reasons: complexity-inflation, duplicate-code, silent-default
  39. [warn] src/advisory/clippy_import.rs — 4 reasons: duplicate-code, integer-cast-risk
  40. [warn] src/commands/baseline_output.rs — 4 reasons: duplicate-code, maintainability-index
  41. [warn] src/health_score.rs — 3 reasons: complexity-inflation, duplicate-code, maintainability-index
  42. [warn] src/sarif.rs — 3 reasons: complexity-inflation, panic-in-lib
  43. [warn] src/impact.rs — 2 reasons: complexity-inflation
  44. [warn] src/markdown.rs — 2 reasons: complexity-inflation, duplicate-code
  45. [warn] src/pattern_baseline.rs — 2 reasons: duplicate-code
  46. [warn] src/report.rs — 2 reasons: complexity-inflation, maintainability-index
  47. [warn] src/suppression.rs — 2 reasons: maintainability-index, panic-in-lib
  48. [warn] src/commands/cli.rs — 1 reasons: complexity-inflation
  49. [warn] src/rule_registry.rs — 1 reasons: complexity-inflation
  50. [warn] src/test_util.rs — 1 reasons: panic-in-lib
next actions:
  1. Inspect src/rules/principle.rs: 123 findings across [abstraction-inflation, complexity-inflation, duplicate-code, maintainability-index], highest severity warn
  2. Inspect src/commands/analysis_commands.rs: 80 findings across [complexity-inflation, duplicate-code, maintainability-index, silent-default], highest severity warn
  3. Inspect src/rules/dead_code.rs: 74 findings across [complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index, silent-default, suppression-debt], highest severity warn
  4. Inspect src/rules/pattern.rs: 72 findings across [complexity-inflation, duplicate-code, maintainability-index], highest severity warn
  5. Inspect src/rules/deps.rs: 65 findings across [complexity-inflation, duplicate-code, maintainability-index, silent-default], highest severity warn
  6. Inspect src/rules/slop.rs: 42 findings across [duplicate-code, maintainability-index], highest severity warn
  7. Inspect src/rules/complexity.rs: 36 findings across [complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index, panic-in-lib, restating-comment], highest severity warn
  8. Inspect src/rules/slop_structural_deep.rs: 31 findings across [complexity-inflation, duplicate-code, integer-cast-risk, maintainability-index], highest severity warn
  9. Inspect src/rules/duplication.rs: 29 findings across [complexity-inflation, duplicate-code, maintainability-index, panic-in-lib, suppression-debt], highest severity warn
  10. Inspect src/rules/slopsquat.rs: 27 findings across [complexity-inflation, duplicate-code, maintainability-index, swallowed-result], highest severity warn

judge 0.7.0 run on its own source tree. Every example on this site is captured the same way with examples/capture.sh; only the absolute checkout path is shortened.

examples/refactor.txt

Quickstart

From install to a CI verdict. The full walkthrough lives in the documentation.

  1. Install cargo-judge from crates.io.
  2. Run cargo judge in the workspace root for the grouped triage report.
  3. Save a baseline and let CI run cargo judge compare against it.
baseline and CICI
# Save a baseline once, on the main branch
cargo judge --save-baseline          # writes .judge/baseline.json

# In CI: compare the checked-out tree with it
cargo judge compare .judge/baseline.json
# exit 0: pass, 1: new gating findings (verdict fail), 2: error
judge.tomlBoundaries
# judge.toml in the workspace root — opt-in crate boundaries
[[boundary]]
name = "ui-must-not-touch-db"
from = ["ui"]
forbidden = ["db"]
reach = "transitive"