Commit ba17e701 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat(deprecated-warnings): link deprecated warnings to file on heptapod

parent 7004c42c373d
Pipeline #17393 passed with stages
in 5 minutes and 7 seconds
......@@ -17,6 +17,14 @@ def download_heptapod_trig():
f.write(logigraphe.artifact('branch/default', 'heptapod.trig', 'generate_dataset_for_heptapod'))
def download_files_to_url_cache():
gl = gitlab.Gitlab('https://forge.extranet.logilab.fr', oauth_token=os.environ["GITLAB_TOKEN"])
logigraphe = gl.projects.get(526)
with open("files_to_url_cache.json", "wb") as f:
f.write(logigraphe.artifact('branch/default', 'files_to_url_cache.json', 'build_cache'))
def get_all_cubes():
cnx = gitlab.Gitlab('https://forge.extranet.logilab.fr', os.environ["GITLAB_TOKEN"])
......@@ -49,6 +57,9 @@ def get_all_cubes():
yield cnx.projects.get(id=project_id)
download_files_to_url_cache()
files_to_url_cache = json.load(open("files_to_url_cache.json"))
all_artifacts = defaultdict(list)
for cube in get_all_cubes():
......@@ -89,5 +100,5 @@ for key, value in all_artifacts.items():
result = sorted(result.items(), key=lambda x: -x[1]["count"])
rendered_template = jinja2.Template(open("template/deprecated-warnings.html", "r").read()).render(warnings=result)
rendered_template = jinja2.Template(open("template/deprecated-warnings.html", "r").read()).render(warnings=result, files_to_url=files_to_url_cache)
open("public/deprecated-warnings.html", "w").write(rendered_template)
......@@ -15,7 +15,17 @@
File where it's raised:
<ul>
{% for path in warning_data["path"]|sort %}
<li>{{ path }}</li>
<li>
{% if path.split(":")[0] in files_to_url %}
<a href="{{ files_to_url[path.split(":")[0]] }}#L{{ path.split(":")[1] }}" target="_blank">
{% endif %}
{{ path }}
{% if path.split(":")[0] in files_to_url %}
</a>
{% endif %}
</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