RiskRanking-CocoCoverage¶
Test coverage of a finding, taken from Coco 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 the test coverage that Coco measured, exported with cmreport --cobertura. Besides line and function coverage, a finding can be scored by statement block, decision, condition, MC/DC or multiple condition coverage, whichever coverage level cmreport wrote the report with. A report does not record its coverage level, so each level needs a report and an entry of its own. 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 : CocoCoverageMetric = '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:
CocoCoverageMetric¶
The kind of Coco coverage a finding is scored by.line
How often the line of a finding was executed.function
How often the function around a finding was called.coverage_level
The share of the outcomes on the line of a finding that were covered, at the coverage level the report was written with: --coverage-statement-block, --coverage-decision, --coverage-condition (the default), --coverage-mcdc or --coverage-mcc.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.