From 58750362b2c6cc22c5ce62306ffa79ce86edaade Mon Sep 17 00:00:00 2001 From: Trong Nhan Mai Date: Thu, 26 Oct 2023 09:41:34 +1000 Subject: [PATCH] fix: display the repository URL status of dependencies in html report instead of the analysis status --- src/macaron/output_reporter/jinja2_extensions.py | 8 ++++---- src/macaron/output_reporter/results.py | 4 ++-- src/macaron/output_reporter/templates/macaron.html | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/macaron/output_reporter/jinja2_extensions.py b/src/macaron/output_reporter/jinja2_extensions.py index 0c1f87932..e4ef836af 100644 --- a/src/macaron/output_reporter/jinja2_extensions.py +++ b/src/macaron/output_reporter/jinja2_extensions.py @@ -147,12 +147,12 @@ def j2_filter_get_flatten_dict(data: Any, has_key: bool = False) -> dict | Any: return {"0": str(data)} -def j2_filter_get_dep_status_color(dep_status: str) -> str: - """Return the html class name for the color of the dep status. +def j2_filter_get_dep_status_color(repo_url_status: str) -> str: + """Return the html class name for the color of the dep repo url status. Parameters ---------- - dep_status : str + repo_url_status : str The dep status as string. Returns @@ -161,7 +161,7 @@ def j2_filter_get_dep_status_color(dep_status: str) -> str: The css class name with the corresponding color or an empty string if the status is not recognized. """ try: - scm_status = SCMStatus(dep_status) + scm_status = SCMStatus(repo_url_status) match scm_status: case SCMStatus.AVAILABLE: return "green_bg" diff --git a/src/macaron/output_reporter/results.py b/src/macaron/output_reporter/results.py index 95985002c..ba9adb239 100644 --- a/src/macaron/output_reporter/results.py +++ b/src/macaron/output_reporter/results.py @@ -99,13 +99,13 @@ def get_summary(self) -> dict: Examples -------- >>> record.get_summary() - {'id': 'apache/maven', 'description': 'Analysis completed', 'report': 'apache.html', 'status': 'AVAILABLE'} + {'id': 'apache/maven', 'description': 'Analysis completed', 'report': 'apache.html', 'status': SCMStatus.AVAILABLE} """ return { "id": self.record_id, "description": self.description, "report": f"{self.context.component.report_file_name}.html" if self.context else "", - "status": self.status, + "repo_url_status": self.pre_config.get_value("available") or SCMStatus.MISSING_SCM, } def get_dict(self) -> dict: diff --git a/src/macaron/output_reporter/templates/macaron.html b/src/macaron/output_reporter/templates/macaron.html index 1ab03be54..1cb794ca9 100644 --- a/src/macaron/output_reporter/templates/macaron.html +++ b/src/macaron/output_reporter/templates/macaron.html @@ -153,7 +153,7 @@ {% else %} Not available. {% endif %} - {% elif header == "status" %} + {% elif header == "repo_url_status" %} {{ item[header].value }} {% else %} {{ item[header] }} @@ -250,7 +250,7 @@ {% if dependencies.analyzed_deps != 0 %}
Dependency results
- {{ dependencies.analyzed_deps }} dependencies have been found. + {{ dependencies.analyzed_deps }} dependencies that map to {{ dependencies.unique_dep_repos }} unique repositories have been successfully analyzed.
{{ render_dep_summary(dependencies.checks_summary) | indent(4) }}