Make html branch info dependent on cmdline argument --branch (#978)

- remove the usual 100% when no --branch option is passed
This commit is contained in:
Edmundo Ferreira 2023-03-21 14:23:44 +01:00 коммит произвёл GitHub
Родитель 4bc9db563b
Коммит 92544ca4ae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 14 добавлений и 6 удалений

Просмотреть файл

@ -11,7 +11,9 @@
<th>{{ kind }}</th>
<th class="has-text-centered" colspan="3">Line Coverage</th>
<th class="has-text-centered" colspan="2">Functions</th>
<th class="has-text-centered" colspan="2">Branches</th>
{% if branch_enabled %}
<th class="has-text-centered" colspan="2">Branches</th>
{% endif %}
</tr>
</thead>
<tbody>

Просмотреть файл

@ -21,7 +21,9 @@
<nav class="level">
{{ self::summary_line(kind="lines", covered=stats.covered_lines, total=stats.total_lines, precision=precision) }}
{{ self::summary_line(kind="functions", covered=stats.covered_funs, total=stats.total_funs, precision=precision) }}
{{ self::summary_line(kind="branches", covered=stats.covered_branches, total=stats.total_branches, precision=precision) }}
{% if branch_enabled %}
{{ self::summary_line(kind="branches", covered=stats.covered_branches, total=stats.total_branches, precision=precision) }}
{% endif %}
</nav>
{% endmacro %}
@ -30,8 +32,10 @@
{%- set lines_sev = lines_per | severity(kind="lines") -%}
{%- set functions_per = percent(num=stats.covered_funs, den=stats.total_funs) -%}
{%- set functions_sev = functions_per | severity(kind="functions") -%}
{%- set branches_per = percent(num=stats.covered_branches, den=stats.total_branches) -%}
{%- set branches_sev = branches_per | severity(kind="branches") -%}
{% if branch_enabled %}
{%- set branches_per = percent(num=stats.covered_branches, den=stats.total_branches) -%}
{%- set branches_sev = branches_per | severity(kind="branches") -%}
{% endif %}
<tr>
<th><a href="{{ url }}">{{ name }}</a></th>
<!-- -->
@ -53,7 +57,9 @@
<td class="has-text-centered has-background-{{ functions_sev }} p-2">{{ functions_per | round(precision=precision) }}%</td>
<td class="has-text-centered has-background-{{ functions_sev }} p-2">{{ stats.covered_funs }} / {{ stats.total_funs }} </td>
<!-- -->
<td class="has-text-centered has-background-{{ branches_sev }} p-2">{{ branches_per | round(precision=precision) }}%</td>
<td class="has-text-centered has-background-{{ branches_sev }} p-2">{{ stats.covered_branches }} / {{ stats.total_branches }}</td>
{% if branch_enabled %}
<td class="has-text-centered has-background-{{ branches_sev }} p-2">{{ branches_per | round(precision=precision) }}%</td>
<td class="has-text-centered has-background-{{ branches_sev }} p-2">{{ stats.covered_branches }} / {{ stats.total_branches }}</td>
{% endif %}
</tr>
{% endmacro %}