Skip to content

Commit

Permalink
Prevent Chrome from crashing on large function lists. (#858)
Browse files Browse the repository at this point in the history
---------
Co-authored-by: Tyler Mace <macetw@lat.ai>
Co-authored-by: Spacetown <40258682+spacetown@users.noreply.github.com>
  • Loading branch information
macetw committed Jan 25, 2024
1 parent 77fdee0 commit 034d3e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ 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`)
- Ignore all negative hits if :option:`--gcov-ignore-parse-errors` is used. (:issue:`852`)
- Reduce file size for detailed HTML reports by merging columns the function lists. (:issue:`840`)
- Use literal options for sorting and TXT metric. (:issue:`867`)

- The :option:`-b`, :option:`--txt-branches` and :option:`--branches` are deprecated, use :option:`--txt-metric` instead.
Expand All @@ -49,6 +49,7 @@ New features and notable changes:
- The :option:`--sort-uncovered` and :option:`--sort-percentage` are deprecated, use :option:`--sort` instead.
The reason for this is that only one sorting order shall be selectable and and an enumeration is easier to handle
than several flags.
- Split list of functions into tables with maximum 10000 rows to fix rendering issues. (:issue:`858`)

- The development branch is renamed from ``master`` to ``main``. (:issue:`829`, :issue:`873`)
- Add support for decision coverage metric in text report (:issue:`864`)
Expand Down
6 changes: 4 additions & 2 deletions gcovr/formats/html/default/functions_page.content.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{# -*- engine: jinja -*- #}
{% for function_batch in all_functions | batch(10000) %}
<table class="listOfFunctions">
<tr>
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in all_functions %}
{% for entry in function_batch %}
<tr>
{#- #}<td><a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }} ({{ entry["filename"] }}:{{ entry["line"] }})</a></td>
{#- #}<td>
Expand All @@ -19,5 +20,6 @@
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
{% endfor %}
</table>
{% endfor %}
14 changes: 8 additions & 6 deletions gcovr/formats/html/github/functions_page.content.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{# -*- engine: jinja -*- #}
{% for function_batch in all_functions | batch(10000) %}
<table class="m-3 text-mono text-small listOfFunctions" style="width:100%;">
<tr class="text-left">
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
<tr class="text-left">
<th>Function (File:Line)</th>
<th>Call count</th>
<th>Block coverage</th>
</tr>
{% for entry in all_functions %}
{% for entry in function_batch %}
<tr>
{#- #}<td><a href="{{ entry['html_filename'] }}#l{{ entry['line'] }}">{{ entry["name"] }} ({{ entry["filename"] }}:{{ entry["line"] }})</a></td>
{#- #}<td>
Expand All @@ -19,5 +20,6 @@
{#- #}<td>{{ entry["blocks"] }}%</td>
{#- -#}
</tr>
{% endfor %}
{% endfor %}
</table>
{% endfor %}

0 comments on commit 034d3e9

Please sign in to comment.