> CRAP1(m) = comp(m)^2 * (1 – cov(m)/100)^3 + comp(m)
and
> Here’s why we think that CRAP1 is a good anti-pattern to detect. Writing automated tests (e.g., using JUnit) for complex and convoluted code is particularly challenging, so crappy code usually comes with few, if any, automated tests.
This is so wrong.
The formula uses code coverage as a fundamental metric, when in reality, a lot of people write code "correct from construction", so coverage is not even applicable. Many times too, people only care the use cases they care about work perfectly.
There are also many other reasons code is not tested, not because it's complex, but because it's simple.
If the code is simple, the tests aren't much extra work.
High test coverage doesn't mean your code is good, but it at least reduces the rate at which you accidentally break stuff.