SlopGuard: one number for the code your agents run on.
Coding agents iterate by changing code and running tests. Where the tests are missing, that loop has no feedback and the agent is guessing. SlopGuard scores every method on how tangled it is against how little of it is tested, and lets you gate the result in CI.



The problem
An agent works the same loop a person does: change the code, run the tests, read the result. Where there are no tests, the third step returns nothing useful, and the agent cannot tell a fix from a regression. Complexity makes it worse. A deeply nested, many-branched method blows past what any model reasons about reliably, and those are exactly the methods people avoid writing tests for. The 2 failures compound, and they compound in the places nobody is looking.
The quality of the loop is decided by your codebase, not by the model you point at it. That is the whole premise: reduce complexity, increase coverage.
One score per method
SlopGuard weighs how tangled a method is against how much of it the tests actually exercise, and returns a single number:
wCRAP = (cyc × cog) × (1 − cov/100)³ + √(cyc × cog)
3 parts, each doing a job. (cyc × cog) is the tangle: how many independent paths run through the method, times how hard it is for a human to follow. (1 − cov/100)³ is untested risk, cubed, so the risk falls off a cliff as soon as you start testing — 50% coverage removes 87.5% of it. √(cyc × cog) is the floor: even at full coverage a tangled method is still tangled, and only refactoring goes below it.
A real method from SlopGuard’s own report: cyclomatic complexity 17, cognitive complexity 15, no tests. It scores 271 against a threshold of 30. Take it to 62% coverage and it passes without a line of its logic changing.
What shipped
- Analyzers for Go, Kotlin, Python, Swift and TypeScript
- wCRAP scoring, one number per method, worst first
- A CI gate that fails the build above a threshold
- Plain text reports for people, stable versioned JSON for everything else
- A leaderboard you can hand to an agent as a work queue
- An interactive explainer, so the formula is arguable rather than magic
Why we built it
Because we ship with agents every day and needed the guardrail ourselves. The commercial claim this practice makes is speed and quality, not speed instead of it, and that claim is worth very little without something measuring the second half. SlopGuard runs against its own source, and the worst method in its own codebase is published on the home page rather than hidden.