Skip to content

Commit 37a96bb

Browse files
authored
chore: display the repository URL status of dependencies in html report instead of the analysis status (#529)
Signed-off-by: Trong Nhan Mai <trong.nhan.mai@oracle.com>
1 parent ea1da9e commit 37a96bb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/macaron/output_reporter/jinja2_extensions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ def j2_filter_get_flatten_dict(data: Any, has_key: bool = False) -> dict | Any:
147147
return {"0": str(data)}
148148

149149

150-
def j2_filter_get_dep_status_color(dep_status: str) -> str:
151-
"""Return the html class name for the color of the dep status.
150+
def j2_filter_get_dep_status_color(repo_url_status: str) -> str:
151+
"""Return the html class name for the color of the dep repo url status.
152152
153153
Parameters
154154
----------
155-
dep_status : str
155+
repo_url_status : str
156156
The dep status as string.
157157
158158
Returns
@@ -161,7 +161,7 @@ def j2_filter_get_dep_status_color(dep_status: str) -> str:
161161
The css class name with the corresponding color or an empty string if the status is not recognized.
162162
"""
163163
try:
164-
scm_status = SCMStatus(dep_status)
164+
scm_status = SCMStatus(repo_url_status)
165165
match scm_status:
166166
case SCMStatus.AVAILABLE:
167167
return "green_bg"

src/macaron/output_reporter/results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def get_summary(self) -> dict:
9999
Examples
100100
--------
101101
>>> record.get_summary()
102-
{'id': 'apache/maven', 'description': 'Analysis completed', 'report': 'apache.html', 'status': 'AVAILABLE'}
102+
{'id': 'apache/maven', 'description': 'Analysis completed', 'report': 'apache.html', 'status': SCMStatus.AVAILABLE}
103103
"""
104104
return {
105105
"id": self.record_id,
106106
"description": self.description,
107107
"report": f"{self.context.component.report_file_name}.html" if self.context else "",
108-
"status": self.status,
108+
"repo_url_status": self.pre_config.get_value("available") or SCMStatus.MISSING_SCM,
109109
}
110110

111111
def get_dict(self) -> dict:

src/macaron/output_reporter/templates/macaron.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
{% else %}
154154
<td>Not available.</td>
155155
{% endif %}
156-
{% elif header == "status" %}
156+
{% elif header == "repo_url_status" %}
157157
<td class={{ item[header] | get_dep_status_color }}>{{ item[header].value }}</td>
158158
{% else %}
159159
<td>{{ item[header] }}</td>
@@ -250,7 +250,7 @@
250250
{% if dependencies.analyzed_deps != 0 %}
251251
<div class="table_caption" id="deps_result_title">Dependency results</div>
252252
<div class="table_sub_caption">
253-
{{ dependencies.analyzed_deps }} dependencies have been found.
253+
{{ dependencies.analyzed_deps }} dependencies that map to {{ dependencies.unique_dep_repos }} unique repositories have been successfully analyzed.
254254
</div>
255255
{{ render_dep_summary(dependencies.checks_summary) | indent(4) }}
256256
<div class="space_divider"></div>

0 commit comments

Comments
 (0)