RiskRanking-Coverage¶
Test coverage of a finding, taken from coverage reports
Required inputs: IR
Adding this rule to the list of active RiskRanking actions creates a rank factor column in the Dashboard. The name of the list entry is shown as the column name.
This rule fills its rank factor column for each finding from test coverage reports in the lcov tracefile or the Cobertura XML format. Both formats carry line and branch coverage. Function coverage is exact in lcov and derived from the first line of a method in Cobertura. MC/DC coverage is only available in lcov tracefiles written by lcov 2.2 or later. For the reports of Coco, use RiskRanking-CocoCoverage. By default, a finding scores high if the code at its location was not or only rarely executed by the tests, so findings in untested code rank above findings in tested code. A report is matched to the file of a finding by the longest common trailing part of their paths, so reports taken in another checkout apply as well.
Possible Messages
This rule has no predefined messages.
Options¶
The following places define options that affect this rule: Analysis-GlobalOptions
coverage_files¶
coverage_files : list[bauhaus.analysis.config.LayerRelativePath] = []
metric¶
metric : CoverageMetric = 'line'
missing_value¶
missing_value : float | None = 0.5
saturation_hits¶
saturation_hits : int = 1
scores_high¶
scores_high : CoverageRisk = 'untested'
show_by_default¶
show_by_default : bool = False
Option Types¶
These types are used by options listed above:
CoverageMetric¶
The kind of coverage a finding is scored by.line
How often the line of a finding was executed.branch
The share of the branches on the line of a finding that were taken.function
How often the function around a finding was called.mcdc
The share of the MC/DC condition outcomes on the line of a finding that were covered.CoverageRisk¶
Which end of the coverage scale scores high.untested
Findings in rarely executed code score high.frequently_executed
Findings in frequently executed code score high.