Integrate metrics from metrics.json into the report pdf.

This commit is contained in:
Florian Frank committed 2026-09-21 21:47:29 +02:00
1 parent 9d7df77923
commit 9247608a9f
5 files changed
+155 -18

No files matched your search

+3 -2
View File
@@ -126,7 +126,8 @@ def _report(sources: ReportSources, path: Path | None, *, write_metrics: bool =
Raises:
PipelineError: The report cannot be built or the destination not written.
"""
name, content = render(sources)
metrics = build_metrics(sources)
name, content = render(sources, metrics)
destination = _destination(path, name)
try:
@@ -134,7 +135,7 @@ def _report(sources: ReportSources, path: Path | None, *, write_metrics: bool =
destination.write_bytes(content)
if write_metrics:
(destination.parent / "metrics.json").write_text(
json.dumps(build_metrics(sources), indent=2), encoding="utf-8"
json.dumps(metrics, indent=2), encoding="utf-8"
)
except OSError as error:
message = f"Cannot write the report to '{destination}': {error}"