Hi - we are looking for clarification on how the “coverage” metric is calculated. We’ve read the very helpful documentation at Code metrics | SonarQube Server Documentation (thank you for this!) and wanted some clarification.
coverage = (CT + LC)/(B + EL)
conditionCoverage = (CT + CF) / (2*B)
Three questions:
-
We’ve tried to find CT (conditions that have been evaluated to ‘true’ at least once) in the UI and via the API for one of our projects and cannot find it. Does it appear in the UI or via the API anyplace?
-
We’ve tried to find CF (conditions that have been evaluated to ‘false’ at least once) in the UI and via the API for one of our projects and cannot find it. Does it appear in the UI or via the API anyplace?
-
Are java exceptions considered another branch? Do they factor into the calculations of either branch coverage or coverage?
Thank you very much! SonarQube is a great product!
I personally very much appreciate the high quality documentation and thank you for that in particular.
Must-share information:
Version: SQ version Community Edition v10.6 (92116)
Deployment: Docker
Achieve: We would like to understand the coverage metrics better
What have we tried: We’ve tried using the UI as well as use the restful endpoints to gather more information on our projects.