Commit 9d532509 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat(deprecated-warnings): display projects dependencies

parent 39fc83325cd5
Pipeline #19992 failed with stages
in 13 seconds
......@@ -141,15 +141,22 @@ for cube in get_all_cubes():
content = json.loads(content)
all_artifacts[cube].extend(content)
result: dict = defaultdict(lambda: {"count": 0, "path": [], "projects": defaultdict(int)})
result: dict = defaultdict(lambda: {"count": 0, "path": [],
"projects": defaultdict(lambda: {"count": 0,
"dependencies": {}})})
for key, value in all_artifacts.items():
for warning in value:
warning_text = eval(warning["args"])[0]
result[warning_text]["count"] += warning["count"]
result[warning_text]["projects"][key] += warning["count"]
result[warning_text]["projects"][key]["count"] += warning["count"]
file_name = warning["path"].split("/site-packages/")[-1].split("/builds/cubicweb/")[-1].split("/builds/open-source/")[-1]
if "dependencies" in warning and not result[warning_text]["projects"][key]["dependencies"]:
result[warning_text]["projects"][key]["dependencies"] = warning["dependencies"]
file_name = warning["path"].split("/site-packages/")[-1]\
.split("/builds/cubicweb/")[-1]\
.split("/builds/open-source/")[-1]
if file_name not in {x[0] for x in result[warning_text]["path"]}:
result[warning_text]["path"].append([f'{file_name}',
......
......@@ -23,7 +23,7 @@
{% for key, value in warning_data["full_warning"].items() %}
{% if key not in ("kind", "path", "args", "category", "count", "file_content",
"filename", "lineno", "reason", "test_file", "test_lineno",
"test_name", "operation") %}
"test_name", "operation", "dependencies") %}
<li>{{ key }}: {{ value }}</li>
{% endif %}
{% endfor %}
......@@ -48,8 +48,18 @@
From those projects:
<ul>
{% for project, count in warning_data["projects"].items() %}
<li><a target="_blank" href="{{ project.web_url }}">{{ project.name }}</a>: {{ count }}</li>
{% for project, project_data in warning_data["projects"].items() %}
<li>
<a target="_blank" href="{{ project.web_url }}">{{ project.name }}</a>: {{ project_data["count"] }}
(
{%- for i in ("Cubicweb", "Yams", "RQL", "logilab-common", "logilab-database") -%}
{%- if i.lower() in project_data["dependencies"] -%}
<i>{{ i }}</i> {{ project_data["dependencies"][i.lower()] }}
{%- if not loop.last %}, {% endif -%}
{%- endif -%}
{%- endfor -%}
)
</li>
{% endfor %}
</ul>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment