pyk.coverage module
- get_rule_by_id(definition: KDefinition, rule_id: str) KRule [source]
Get a rule from the definition by coverage rule id.
- Parameters:
definition – JSON-encoded definition.
rule_id – String of unique rule identifier generated by kompile –coverage.
- Returns:
JSON encoded rule which has identifier rule_id.
- translate_coverage(src_all_rules: Iterable[str], dst_all_rules: Iterable[str], dst_definition: KDefinition, src_rules_list: Iterable[str]) list[str] [source]
Translate the coverage data from one kompiled definition to another.
- Parameters:
src_all_rules – Contents of allRules.txt for definition which coverage was generated for.
dst_all_rules – Contents of allRules.txt for definition which you desire coverage for.
dst_definition – JSON encoded definition of dst kompiled definition.
src_rules_list – Actual coverage data produced.
- Returns:
List of non-functional rules applied in dst definition translated from src definition.
- translate_coverage_from_paths(src_kompiled_dir: str, dst_kompiled_dir: str, src_rules_file: PathLike) list[str] [source]
Translate coverage information given paths to needed files.
- Parameters:
src_kompiled_dir – Path to kompiled directory of source.
dst_kompiled_dir – Path to kompiled directory of destination.
src_rules_file – Path to generated rules coverage file.
- Returns:
Translated list of rules with non-semantic rules stripped out.