Skip to content

Commit

Permalink
Rework function list to redice size. (#840)
Browse files Browse the repository at this point in the history
* Use one column for Function, File and Line

Co-authored-by: Tyler <macetw@gmail.com>
  • Loading branch information
Spacetown and macetw committed Dec 1, 2023
1 parent d2c7217 commit 190e7b9
Show file tree
Hide file tree
Showing 871 changed files with 3,934 additions and 45,227 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ New features and notable changes:
- Use different color for partial covered lines in HTML report. (:issue:`839`)
- Add support to generate LCOV info files. (:issue:`830`)
- Add support for FIPS enabled OS when used with Python 3.9. (:issue:`850`)
- Reduce file size for detailed HTML reports by using CSS to link the function lists. (:issue:`840`)

Bug fixes and small improvements:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,39 +69,12 @@ <h1>GCC Code Coverage Report</h1>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
<tr>
<td>
<a href="#l3">foo(int)</a>
</td>
<td>
<a href="#l3">3</a>
</td>
<td>
<a href="#l3"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l3">75.0%</a>
</td>
</tr>
<tr>
<td>
<a href="#l15">main</a>
</td>
<td>
<a href="#l15">15</a>
</td>
<td>
<a href="#l15"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l15">100.0%</a>
</td>
</tr>
<tr><td><a href="#l3">foo(int) (line 3)</a></td><td>called 1 time, returned 1 time</td><td>75.0%</td></tr>
<tr><td><a href="#l15">main (line 15)</a></td><td>called 1 time, returned 1 time</td><td>100.0%</td></tr>
</table>
</details>

Expand Down
40 changes: 3 additions & 37 deletions doc/examples/example_html.details.functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,46 +67,12 @@ <h1>GCC Code Coverage Report</h1>
<main>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>File</th>
<th>Line</th>
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
<tr>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l3">foo(int)</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l3">example.cpp</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l3">3</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l3"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l3">75.0%</a>
</td>
</tr>
<tr>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l15">main</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l15">example.cpp</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l15">15</a>
</td>
<td>
<a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l15"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l15">100.0%</a>
</td>
</tr>
<tr><td><a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l3">foo(int) (example.cpp:3)</a></td><td>called 1 time, returned 1 time</td><td>75.0%</td></tr>
<tr><td><a href="example_html.details.example.cpp.9597a7a3397b8e3a48116e2a3afb4154.html#l15">main (example.cpp:15)</a></td><td>called 1 time, returned 1 time</td><td>100.0%</td></tr>
</table>
<hr/>
</main>
Expand Down
39 changes: 13 additions & 26 deletions gcovr/formats/html/default/functions_page.content.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
{# -*- engine: jinja -*- #}
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>File</th>
<th>Line</th>
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in all_functions %}
<tr>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["filename"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["line"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">
{%- if entry["excluded"] %} excluded
{%- else %}
{%- if entry["count"] == 0 %} not called
{%- else %} called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["blocks"] }}%</a>
</td>
</tr>
{#- #}<td><a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }} ({{ entry["filename"] }}:{{ entry["line"] }})</a></td>
{#- #}<td>
{%- if entry["excluded"] %}excluded
{%- else %}
{%- if entry["count"] == 0 %}not called
{%- else %}called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
{#- #}</td>
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
</table>
33 changes: 12 additions & 21 deletions gcovr/formats/html/default/source_page.navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,23 @@
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in function_list %}
<tr>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["name"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["line"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">
{%- if entry["excluded"] %} excluded
{%- else %}
{%- if entry["count"] == 0 %} not called
{%- else %} called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["blocks"] }}%</a>
</td>
{#- #}<td><a href="#l{{ entry['line'] }}">{{ entry["name"] }} (line {{ entry["line"] }})</a></td>
{#- #}<td>
{%- if entry["excluded"] %}excluded
{%- else %}
{%- if entry["count"] == 0 %}not called
{%- else %}called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
{#- #}</td>
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
</table>
Expand Down
41 changes: 14 additions & 27 deletions gcovr/formats/html/github/functions_page.content.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
{# -*- engine: jinja -*- #}
<table class="m-3 text-mono text-small" style="width:100%;">
<table class="m-3 text-mono text-small listOfFunctions" style="width:100%;">
<tr class="text-left">
<th>Function</th>
<th>File</th>
<th>Line</th>
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in all_functions %}
<tr>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["filename"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["line"] }}</a>
</td>
<td>
<a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">
{%- if entry["excluded"] %} excluded
{%- else %}
{%- if entry["count"] == 0 %} not called
{%- else %} called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["blocks"] }}%</a>
</td>
</tr>
{#- #}<td><a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }} ({{ entry["filename"] }}:{{ entry["line"] }})</a></td>
{#- #}<td>
{%- if entry["excluded"] %}excluded
{%- else %}
{%- if entry["count"] == 0 %}not called
{%- else %}called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
{#- #}</td>
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
</table>
35 changes: 13 additions & 22 deletions gcovr/formats/html/github/source_page.navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,25 @@
<div class="m-3">
<details>
<summary>List of functions</summary>
<table class="functionslist text-mono text-small wb-break-word">
<table class="functionslist text-mono text-small wb-break-word listOfFunctions">
<tr class="text-left">
<th class="css-truncate css-truncate-target">Function</th>
<th>Line</th>
<th class="css-truncate css-truncate-target">Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in function_list %}
<tr>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["name"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["line"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">
{%- if entry["excluded"] %} excluded
{%- else %}
{%- if entry["count"] == 0 %} not called
{%- else %} called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["blocks"] }}%</a>
</td>
{#- #}<td><a href="#l{{ entry['line'] }}">{{ entry["name"] }} (line {{ entry["line"] }})</a></td>
{#- #}<td>
{%- if entry["excluded"] %}excluded
{%- else %}
{%- if entry["count"] == 0 %}not called
{%- else %}called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}, returned {{ entry["returned"] }} time{% if entry["returned"] > 1 %}s{% endif %}
{%- endif -%}
{%- endif -%}
{#- #}</td>
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
</table>
Expand Down
10 changes: 10 additions & 0 deletions gcovr/formats/html/github/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
transform: translateY(-2px);
}

.listOfFunctions tr > td > a {
text-decoration: none;
color: inherit;
}

.listOfFunctions tr:hover > td
{
background-color: #ddd;
}

td.linenos .normal {
color: inherit;
background-color: transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,11 @@ <h1>GCC Code Coverage Report</h1>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
<tr>
<td>
<a href="#l1">_Z3barv</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l1">100.0%</a>
</td>
</tr>
<tr><td><a href="#l1">_Z3barv (line 1)</a></td><td>called 1 time, returned 1 time</td><td>100.0%</td></tr>
</table>
</details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,11 @@ <h1>GCC Code Coverage Report</h1>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
<tr>
<td>
<a href="#l1">_Z3foov</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time, returned 1 time</a>
</td>
<td>
<a href="#l1">100.0%</a>
</td>
</tr>
<tr><td><a href="#l1">_Z3foov (line 1)</a></td><td>called 1 time, returned 1 time</td><td>100.0%</td></tr>
</table>
</details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,11 @@ <h1>GCC Code Coverage Report</h1>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Function (Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
<tr>
<td>
<a href="#l10">main</a>
</td>
<td>
<a href="#l10">10</a>
</td>
<td>
<a href="#l10"> called 2 times, returned 2 times</a>
</td>
<td>
<a href="#l10">100.0%</a>
</td>
</tr>
<tr><td><a href="#l10">main (line 10)</a></td><td>called 2 times, returned 2 times</td><td>100.0%</td></tr>
</table>
</details>

Expand Down
Loading

0 comments on commit 190e7b9

Please sign in to comment.