What is the difference between code coverage and line coverage in sonar

Coverage is a subtle 😉 mix of the line and the branch coverage.

You can find the formula on our metric description page:

coverage = (CT + CF + LC)/(2*B + EL)
 
where
 
CT - branches that evaluated to "true" at least once
CF - branches that evaluated to "false" at least once
LC - lines covered (lines_to_cover - uncovered_lines)
 
B - total number of branches (2*B = conditions_to_cover)
EL - total number of executable lines (lines_to_cover)

Leave a Comment

File not found.