Commit 75e5b19f authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat(deprecated): display if a warning originates from the code of the repository

parent 2fb33521e2b1
Pipeline #23811 failed with stages
in 3 minutes and 21 seconds
...@@ -204,6 +204,13 @@ for gitlab_project, warnings in all_artifacts.items(): ...@@ -204,6 +204,13 @@ for gitlab_project, warnings in all_artifacts.items():
if warning_key not in result[warning_text]["projects"][gitlab_project]["warnings"]: if warning_key not in result[warning_text]["projects"][gitlab_project]["warnings"]:
result[warning_text]["projects"][gitlab_project]["warnings"][warning_key] = warning result[warning_text]["projects"][gitlab_project]["warnings"][warning_key] = warning
try:
gitlab_project.files.get(warning["filename"], ref="branch/default")
except gitlab.exceptions.GitlabGetError:
warning["file_in_current_repo"] = False
else:
warning["file_in_current_repo"] = True
# this is done to display a summary of the warning at the top # this is done to display a summary of the warning at the top
if warning["category"] != "DeprecationWarning": if warning["category"] != "DeprecationWarning":
if "test_file" in warning and "/site-packages/" in warning["test_file"]: if "test_file" in warning and "/site-packages/" in warning["test_file"]:
......
...@@ -133,3 +133,12 @@ table.qa td.readthedocs a { ...@@ -133,3 +133,12 @@ table.qa td.readthedocs a {
text-decoration: none; text-decoration: none;
padding-top: 300px; padding-top: 300px;
} }
.alert-info {
background-color: #D1ECF1;
color: #0c5460;
padding: .75rem 1.25rem;
border: 1px solid #bee5eb;
border-radius: .25rem;
margin-bottom: 1rem;
}
...@@ -69,6 +69,12 @@ ...@@ -69,6 +69,12 @@
{% if path in files_to_url %}(<a href="{{ files_to_url[path] }}#L{{ lineno }}" target="_blank">file on branch/default</a>){% endif %} {% if path in files_to_url %}(<a href="{{ files_to_url[path] }}#L{{ lineno }}" target="_blank">file on branch/default</a>){% endif %}
</p> </p>
{% if warning["file_in_current_repo"] %}
<div class="alert-info">
This warning originates from the source code of this respository
</div>
{% endif %}
{% if "file_content" in warning %} {% if "file_content" in warning %}
{{ highlight_code(warning["file_content"], lineno) }} {{ highlight_code(warning["file_content"], lineno) }}
{% endif %} {% endif %}
......
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