The image above shows the SonarQube coverage for one of my folders, but if you take the average of the percentages of all files in that folder, it will amount to 49%, yet SonarQube will display 31.4%. If not by taking averages, how does SonarQube calculate the overall coverage? The same is true for all folders, even the top most one.
问问题
5643 次
1 回答
15
Overall coverage is calculated as
Coverage = (CT + CF + LC)/(2*B + EL)
where
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)
More details can be found in the documentation
于 2018-03-08T08:12:08.470 回答