-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add HTML report output, report docs
- Loading branch information
Showing
12 changed files
with
253 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% if is_third_party %} | ||
{# no links for third party code since we don't know where to link to #} | ||
{% if annotation.extra and annotation.extra.object_id %} | ||
{{ annotation.extra.object_id }} {% if annotation.line_number > 0 %}line {{ annotation.line_number }}{% endif %}: {{ annotation.annotation_token }} {% include "annotation_data.tpl" %} | ||
{% else %} | ||
{% if loop.changed(annotation.line_number)%}{{ filename }}:{{ annotation.line_number }}<br />{% endif %}: | ||
{{ annotation.annotation_token }} {% include "annotation_data.tpl" %} | ||
{% endif %} | ||
{% elif annotation.extra and annotation.extra.object_id %} | ||
<a href="{{ source_link_prefix }}{{ filename }}#L{{ annotation.line_number }}" target="_blank">{{ annotation.extra.object_id }} {% if annotation.line_number > 0 %}line {{ annotation.line_number }}{% endif %}</a>: {{ annotation.annotation_token }} {% include "annotation_data.tpl" %} | ||
{% else %} | ||
<a href="{{ source_link_prefix }}{{ filename }}#L{{ annotation.line_number }}" target="_blank">`{{ filename }}:{{ annotation.line_number }}: {{ annotation.annotation_token }} {% include "annotation_data.tpl" %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% if annotation.annotation_data is sequence and annotation.annotation_data is not string %} | ||
{% for a in annotation.annotation_data %} | ||
<a href="choice-{{ slugify(a) }}.html">{{ a }}</a>{% if not loop.last %}, {% endif %} | ||
{% endfor %} | ||
|
||
{% else %} | ||
{{ annotation.annotation_data }} | ||
{% endif %} |
27 changes: 27 additions & 0 deletions
27
code_annotations/report_templates/html/annotation_list.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% extends "base.tpl" %} | ||
{% block content %} | ||
Annotations found in {{ report|length }} files. | ||
|
||
{% for filename in report %} | ||
{% set is_third_party = third_party_package_location in filename %} | ||
|
||
<h2 id="file-{{ slugify(filename) }}">{{ filename }}</h2> | ||
<div class="file-annotations"> | ||
{{ report[filename]|length }} annotations {% if is_third_party %}(installed package){% endif %}<br /> | ||
</div> | ||
|
||
{% for annotation in report[filename] %} | ||
{% if loop.changed(annotation.report_group_id) %} | ||
{% if not loop.first %}</ul></div>{% endif %} | ||
<div class="group-annotations"><ul> | ||
{% endif %} | ||
<li>{% include 'annotation.tpl' %}</li> | ||
{% if loop.last %} | ||
</ul></div> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
|
||
{% endfor %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<html> | ||
<head> | ||
<title>{{ doc_title }}</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<style> | ||
body { | ||
font-family: 'Trebuchet MS', sans-serif; | ||
} | ||
.title { | ||
text-align: center; | ||
} | ||
.table { | ||
display: table; | ||
border-spacing: 12px; | ||
} | ||
.row { | ||
display: table-row; | ||
margin-bottom: 0; | ||
margin-top: 0; | ||
width: 100%; | ||
} | ||
.cell1 { | ||
display: table-cell; | ||
width: 20%; | ||
margin-right: 1%; | ||
border: 1px solid #ccc; | ||
margin 12px; | ||
background-color: #ffffee; | ||
} | ||
.cell2 { | ||
display: table-cell; | ||
width: 79%; | ||
margin-right: 1%; | ||
margin 12px; | ||
} | ||
.group-annotations { | ||
border: 1px solid #ccc; | ||
margin: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 class="title">{{ doc_title }}</h1> | ||
|
||
<div class="table"> | ||
<div class="row"> | ||
<div class="cell1"> | ||
<h3><a href="index.html">Home</a></h3> | ||
|
||
<h3>Annotations</h3> | ||
|
||
<ul> | ||
{% for a in all_annotations %} | ||
<li><a href="annotation-{{ slugify(a) }}.html">annotation_{{ slugify(a) }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<h3>Choices</h3> | ||
|
||
<ul> | ||
{% for choice in all_choices %} | ||
<li><a href="choice-{{ slugify(choice) }}.html">choice_{{ slugify(choice) }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
<div class="cell2"> | ||
<h2>Files in this page</h2> | ||
<ul> | ||
{% for filename in report %} | ||
<li><a href="#file-{{ slugify(filename) }}">{{ filename }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
{% block content %}{% endblock %} | ||
</div> | ||
</div> | ||
</div> | ||
{% block footer %} | ||
<div class="footer"> | ||
<br /><br /> | ||
<hr /> | ||
Built at {{ create_time.strftime('%Y-%m-%d %H:%M:%S %Z') }} | ||
</div> | ||
{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
tests/test_configurations/.annotations_test_success_with_report_docs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/test_configurations/.annotations_test_success_with_report_docs_html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
source_path: tests/extensions/javascript_test_files/ | ||
report_path: test_reports | ||
safelist_path: .annotation_safe_list.yml | ||
report_template_dir: code_annotations/report_templates/rst | ||
rendered_report_dir: test_reports/ | ||
rendered_report_format: html | ||
rendered_report_source_link_prefix: https://github.com/openedx/edx-platform/tree/master/ | ||
trim_filename_prefixes: | ||
- /foo/bar | ||
third_party_package_location: site-packages | ||
|
||
coverage_target: 50.0 | ||
annotations: | ||
".. no_pii:": | ||
".. ignored:": | ||
choices: [irrelevant, terrible, silly-silly] | ||
"pii_group": | ||
- ".. pii:": | ||
- ".. pii_types:": | ||
choices: [id, name, other] | ||
- ".. pii_retirement:": | ||
choices: [retained, local_api, consumer_api, third_party] | ||
extensions: | ||
python: | ||
- pyt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters