CLI command
diff
Compare the current snapshot to the committed baseline and optionally fail the run when regression crosses the configured rules.
Command contract
diff is the regression gate. It turns “did this get worse?” into a repeatable contract instead of a code-review debate.
Pull request checks, local verification before pushing, and approval conversations around intentional complexity increases.
No. It reads .simplicity-baseline.json and prints a textual comparison.
Returns 0 on success, or 1 when --fail-on-regression is supplied and the report detects regression. Missing baseline files also fail.
Usage
Start with the exact command shape the CLI supports today.
dotnet simplicity diff path/to/YourSolution.sln [--fail-on-regression] Local comparison
See every delta without breaking your shell workflow.
dotnet simplicity diff YourSolution.sln Pull request gate
Use the non-zero exit code to block merges when complexity grows beyond the allowed rules.
dotnet simplicity diff YourSolution.sln --fail-on-regression What it prints or produces
The diff output is built for humans first: it shows every important delta and then declares whether those changes count as regression.
- Baseline file path plus baseline and current snapshot dates.
- Metric deltas for projects, files, abstractions, dependencies, complexity, and onboarding time.
- Filter score deltas for TwoAmTest, HalfRule, and PrimaryPathFirst.
- A regression footer that either reports no regressions or lists each triggering rule.
- Optional non-zero exit code when --fail-on-regression is present and the contract is violated.
Simplicity Diff
---------------
Baseline file: /path/to/.simplicity-baseline.json
Baseline snapshot: 2026-05-01
Current snapshot: 2026-05-01
Metric delta
- Total projects: 2 -> 2 (0)
- Total files: 23 -> 23 (0)
- Abstraction layers: 1 -> 1 (0)
- Unused dependencies: 0 -> 0 (0)
- Average method complexity: 1.35 -> 1.35 (0.00)
Filter score delta
- TwoAmTest: 1.00 -> 1.00 (0.00)
- HalfRule: 1.00 -> 1.00 (0.00)
- PrimaryPathFirst: 0.79 -> 0.79 (0.00)
Regression status: no regressions detected. Operational notes
These behaviors matter when you move from a local run to team automation.
- Current regression rules are fixed in code: PrematureAbstractionRatio > +0.05, AverageMethodComplexity > +0.50, any increase in unused dependencies when the current count is non-zero, or any filter score drop worse than -0.10.
- diff fails fast with a clear message when the baseline file is missing and tells you to run baseline first.
- Use --fail-on-regression in CI only after the team agrees that the baseline file represents an intentional contract.
Related pages
Use the surrounding docs when you need setup, filter interpretation, or CI context.