You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
I would like to see support for the CRAP metric. The metric basically assigns a method a numeric value for risk for bugs. It combines the cyclomatic complexity and code coverage in order to be able to.
A: The current version of CRAP combines the two change risk anti-patterns we just discussed: excessive method complexity and lack of automated tests for those methods.
Given a Java method m, CRAP for m is calculated as follows:
Where comp(m) is the cyclomatic complexity of method m, and cov(m) is the test code coverage provided by automated tests (e.g. JUnit tests, not manual QA). Cyclomatic complexity is a well-known and widely used metric and it’s calculated as one plus the number of unique decisions in the method. For code coverage we use basis path coverage. Low CRAP numbers indicate code with relatively low change and maintenance risk – because it’s not too complex and/or it’s well-protected by automated and repeatable tests. High CRAP numbers indicate code that’s risky to change because of a hazardous combination of high complexity and low, or no, automated test coverage.
Generally speaking, you can lower your CRAP score either by adding automated tests or by refactoring to reduce complexity. Preferably both; and it’s a good idea to write the tests firsts so you can refactor more safely.
DCM version
unrelated to the version
What problem do you want to solve?
I would like to see support for the CRAP metric. The metric basically assigns a method a numeric value for risk for bugs. It combines the cyclomatic complexity and code coverage in order to be able to.
It's described in http://www.crap4j.org/faq.html
Some more resources:
What do you think is the correct solution?
Implement the CRAP metric
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: