Integrate metrics from metrics.json into the report pdf.
This commit is contained in:
1 parent
9d7df77923
commit
9247608a9f
5 files changed
+155
-18
No files matched your search
@@ -13,8 +13,8 @@ from __future__ import annotations
|
||||
import json
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from cc_common.api import PipelineError
|
||||
from cc_common.api import context as logging_context
|
||||
from .vendor.cc_common.api import PipelineError
|
||||
from .vendor.cc_common.api import context as logging_context
|
||||
|
||||
from .context import build_context
|
||||
from .layout import render_pdf
|
||||
@@ -40,7 +40,7 @@ REQUIRED = ("metadata",)
|
||||
NAME = "report_{scan}.pdf"
|
||||
|
||||
|
||||
def render(sources: ReportSources) -> tuple[str, bytes]:
|
||||
def render(sources: ReportSources, metrics: dict[str, Any] | None = None) -> tuple[str, bytes]:
|
||||
"""Render the report of one scan.
|
||||
|
||||
Args:
|
||||
@@ -56,6 +56,7 @@ def render(sources: ReportSources) -> tuple[str, bytes]:
|
||||
stage of their pipeline did not finish.
|
||||
"""
|
||||
documents = {name: _parsed(sources, name, candidates) for name, candidates in INPUTS.items()}
|
||||
documents["metrics"] = metrics
|
||||
missing = [name for name in REQUIRED if documents.get(name) is None]
|
||||
|
||||
if missing:
|
||||
|
||||
Reference in new issue
Block a user