Skip to content

chore: display the repository URL status of dependencies in html report instead of the analysis status #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/macaron/output_reporter/jinja2_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/macaron/output_reporter/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/macaron/output_reporter/templates/macaron.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
{% else %}
<td>Not available.</td>
{% endif %}
{% elif header == "status" %}
{% elif header == "repo_url_status" %}
<td class={{ item[header] | get_dep_status_color }}>{{ item[header].value }}</td>
{% else %}
<td>{{ item[header] }}</td>
Expand Down Expand Up @@ -250,7 +250,7 @@
{% if dependencies.analyzed_deps != 0 %}
<div class="table_caption" id="deps_result_title">Dependency results</div>
<div class="table_sub_caption">
{{ dependencies.analyzed_deps }} dependencies have been found.
{{ dependencies.analyzed_deps }} dependencies that map to {{ dependencies.unique_dep_repos }} unique repositories have been successfully analyzed.
</div>
{{ render_dep_summary(dependencies.checks_summary) | indent(4) }}
<div class="space_divider"></div>
Expand Down