pyk.coverage module

get_rule_by_id(definition: KDefinition, rule_id: str) KRule[source]

Get a rule from the definition by coverage rule id.

Input:

  • definition: json encoded definition.

  • rule_id: string of unique rule identifier generated by kompile –coverage.

Output: json encoded rule which has identifier rule_id.

strip_coverage_logger(rule: KRule) KRule[source]
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.

Input:

  • 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.

Output: 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.

Input:

  • 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.

Output: Translated list of rules with non-semantic rules stripped out.