measures.UnitMeasures(
unit,
intent_items,
covered_items,
implementation_lines,
unit_record_lines,
decision_lines,
evaluation_lines,
)
Intent coverage and specification size of one unit.
Attributes
| unit |
str |
Dotted module name. |
| intent_items |
int |
Number of intent items. |
| covered_items |
int |
Intent items that name at least one evaluation, all of which exist in an evaluation file of the unit. |
| implementation_lines |
int |
Lines of the implementation. |
| unit_record_lines |
int |
Lines of the unit record (regen/units/<unit>.toml). |
| decision_lines |
int |
Lines of the decision records cited by the intent items, each counted once. |
| evaluation_lines |
int |
Lines of the evaluation files. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from spotregen import load_spec, make_sample_repo, unit_measures
with TemporaryDirectory() as tmp:
spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
m = unit_measures(spec, "core.calc")
print(m.covered_items, m.intent_items, m.specification_lines, m.ratio)