Calculate average code coverage for multiple projects

I use two versions (7.9.2 and 8.9.0) and pull data from both instance.
I am trying to calculate the code coverage for multiple Jenkins pipeline inside a BI platform to show average code coverage at the application or division level. The data ingestion service pull all the necessary code coverage related measures using SonarQube REST API. Do the CT and CF have corresponding measure values? If not, how do I generate from an existing measures?

Coverage = (*CT + CF* + LC)/(2*B + EL)

  • CT = conditions that have been evaluated to ‘true’ at least once
  • CF = conditions that have been evaluated to ‘false’ at least once
  • LC = covered lines = lines to cover - uncovered_lines
  • B = total number of conditions
  • EL = total number of executable lines ( lines_to_cover )


Welcome to the community!

I don’t believe we store those interim figures, but you can get the full list of metrics available on your instance from the api/metrics/search web service. I usually call it with a query string of ?ps=500 (page size=500) just so I don’t have to fool with paginated results.


Thank you Ann. I used the paged API (total page 2) to check all condition related metrics and couldn’t find related to CT and CF.