{%- set source_file = view_object.traceability_index.document_tree.source_tree.get_source_for_file(file) -%}

{% set lines_all = view_object.get_file_stats_lines_total(source_file) %}
{% set lines_total = view_object.get_file_stats_lines_total_non_empty(source_file) %}
{% set lines_covered = view_object.get_file_stats_non_empty_lines_covered(source_file) %}
{% set lines_percent = view_object.get_file_stats_non_empty_lines_covered_percentage(source_file) %}
{% set func_total = view_object.get_file_stats_functions_total(source_file) %}
{% set func_covered = view_object.get_file_stats_functions_covered(source_file) %}
{% set func_percent = view_object.get_file_stats_functions_covered_percentage(source_file) %}

<tr class="project_coverage-file {% if lines_covered == '0' %}project_coverage-file_uncovered{% endif %}">
  <td>
    <a
      class="project_coverage-file-link"
      {% if source_file.is_referenced -%}
        href="{{ view_object.link_renderer.render_source_file_link_from_root_2(source_file) }}"
      {%- endif -%}
      title="{{ source_file.in_doctree_source_file_rel_path_posix }}"
    >
      <div class="project_coverage-file-indent" style="padding-left:{{ folder.level }}0px"></div>
      <div class="project_coverage-file-details">
        <div class="project_coverage-file-title">
          <span class="project_coverage-file-icon">
            {%- include "_res/svg_ico16_file.jinja" -%}
          </span>
          {{ file.file_name }}
        </div>
        <div class="project_coverage-file-path">
          {{ source_file.in_doctree_source_file_rel_path_posix }}
        </div>
      </div>

    </a>
  </td>

  {#
    * strictdoc/export/html/_static/project_coverage.js
    Each TD needs:
    - a data-id corresponding to a `TH > .project_coverage-sort_handler` to sort correctly
    - data-value, expect a value to be converted to a number
  #}

  <td data-id="lines_percent" data-value="{{ lines_percent }}"><span class="value_extended {% if lines_covered == '0' %}color-uncovered{% endif %}" data-ext="%">{{ lines_percent }}</span></td>
  <td data-id="lines_covered" data-value="{{ lines_covered }}"><span class="value_extended {% if lines_covered == '0' %}color-uncovered{% endif %}">{{ lines_covered }}</span></td>
  <td data-id="lines_total" data-value="{{ lines_total }}"><span class="value_extended">{{ lines_total }}</span></td>
  <td data-id="lines_all" data-value="{{ lines_all }}"><span class="value_extended color-secondary">{{ lines_all }}</span></td>
  <td data-id="func_percent" data-value="{{ func_percent }}"><span class="value_extended" data-ext="%">{{ func_percent }}</span></td>
  <td data-id="func_covered" data-value="{{ func_covered }}"><span class="value_extended">{{ func_covered }}</span></td>
  <td data-id="func_total" data-value="{{ func_total }}"><span class="value_extended">{{ func_total }}</span></td>

  {# <td>
      {%- if source_file.is_referenced -%}
        {%- set range_reqs =
          view_object.traceability_index.get_source_file_reqs(source_file.in_doctree_source_file_rel_path_posix) -%}

        {%- if range_reqs -%}
          {%- set coverage_info =
            view_object.traceability_index.get_coverage_info(source_file.in_doctree_source_file_rel_path_posix) -%}
          {% with coverage_value = coverage_info.get_coverage() %}
            {% include "screens/source_file_coverage/value_bar.jinja" %}
          {% endwith %}

        {%- else -%}
          {% with coverage_value = none %}
            {% include "screens/source_file_coverage/value_bar.jinja" %}
          {% endwith %}
        {%- endif -%}

      {%- else -%}
        {% with coverage_value = none %}
          {% include "screens/source_file_coverage/value_bar.jinja" %}
        {% endwith %}
      {%- endif -%}
    </td> #}
</tr>
