This is an automated email from the ASF dual-hosted git repository. arm pushed a commit to branch previous_sbom_results in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit b9e4de297bcddc9716b6af8bb699ab609320bb5a Author: Alastair McFarlane <[email protected]> AuthorDate: Tue Dec 23 16:43:45 2025 +0000 Add some colour to the report and add icon helper to htm --- atr/get/sbom.py | 13 ++++++------- atr/htm.py | 5 +++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/atr/get/sbom.py b/atr/get/sbom.py index a90c2b2..552c916 100644 --- a/atr/get/sbom.py +++ b/atr/get/sbom.py @@ -22,7 +22,6 @@ from typing import TYPE_CHECKING, Any import asfquart.base as base import cmarkgfm -import htpy import markupsafe import atr.blueprints.get as get @@ -178,18 +177,18 @@ def _outdated_tool_section(block: htm.Block, task_result: results.SBOMToolScore) def _conformance_section(block: htm.Block, task_result: results.SBOMToolScore) -> None: + block.h2["Conformance report"] warnings = [sbom.models.conformance.MissingAdapter.validate_python(json.loads(w)) for w in task_result.warnings] errors = [sbom.models.conformance.MissingAdapter.validate_python(json.loads(e)) for e in task_result.errors] if warnings: - block.h2["Warnings"] + block.h3[htm.icon("bi-exclamation-triangle-fill", ".me-2.text-warning"), "Warnings"] _missing_table(block, warnings) if errors: - block.h2["Errors"] + block.h3[htm.icon("x-octagon-fill", ".me-2.text-danger"), "Errors"] _missing_table(block, errors) if not (warnings or errors): - block.h2["Conformance report"] block.p["No NTIA 2021 minimum data field conformance warnings or errors found."] @@ -204,11 +203,11 @@ def _license_section(block: htm.Block, task_result: results.SBOMToolScore) -> No if task_result.license_errors is not None: errors, prev_errors = _load_license_issues(task_result.license_errors, task_result.prev_license_errors) if warnings: - block.h3["Warnings"] + block.h3[htm.icon("exclamation-triangle-fill", ".me-2.text-warning"), "Warnings"] _license_table(block, warnings, prev_warnings) if errors: - block.h3["Errors"] + block.h3[htm.icon("x-octagon-fill", ".me-2.text-danger"), "Errors"] _license_table(block, errors, prev_errors) if not (warnings or errors): @@ -460,7 +459,7 @@ def _vulnerability_component_details_osv( if (previous_vulns is not None) and is_new: if vuln_id in previous_vulns: # If it's there, the sev must have changed - vuln_header.append(htpy.i(".bi.bi-arrow-left.me-2")) + vuln_header.append(htm.icon("arrow-left", ".me-2")) vuln_header.append( htm.span(f".badge{_severity_to_style(previous_vulns[vuln_id])}.text-strike")[ previous_vulns[vuln_id] diff --git a/atr/htm.py b/atr/htm.py index 5b64ea3..c0d925c 100644 --- a/atr/htm.py +++ b/atr/htm.py @@ -44,6 +44,7 @@ h1 = htpy.h1 h2 = htpy.h2 h3 = htpy.h3 html = htpy.html +i = htpy.i li = htpy.li p = htpy.p pre = htpy.pre @@ -279,6 +280,10 @@ class Block: return BlockElementCallable(self, ul) +def icon(name: str, classes="") -> Element: + return i(f".bi.bi-{name}{classes}") + + def ul_links(*items: tuple[str, str]) -> Element: li_items = [li[a(href=item[0])[item[1]]] for item in items] return ul[*li_items] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
