measures.unit_measures(spec, name)
Measure the intent coverage and the specification size of one unit.
Parameters
| spec |
RegenSpec |
The loaded spec. |
required |
| name |
str | Unit |
The unit, as a dotted module name, its unique suffix ("core.calc") or a babregen.Unit. |
required |
Returns
| UnitMeasures |
UnitMeasures |
The counts. Files that do not exist count zero lines; the check reports them (COMPILE05, EVAL01, PROV01). |
Raises
|
SpecError |
If name matches no unit or more than one. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from babregen import load_spec, make_sample_repo, unit_measures
with TemporaryDirectory() as tmp:
spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
print(unit_measures(spec, "core.calc"))
UnitMeasures(unit='samplepkg.core.calc', pace='fast', intent_items=1, covered_items=1, decisions=1, consumers=2, implementation_lines=10, unit_record_lines=23, decision_lines=9, evaluation_lines=9)