File: source_file.erb

package info (click to toggle)
ruby-simplecov-html 0.12.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,660 kB
  • sloc: javascript: 20,320; ruby: 118; makefile: 15
file content (54 lines) | stat: -rw-r--r-- 1,990 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<div class="source_table" id="<%= id source_file %>">
  <div class="header">
    <h3><%= shortened_filename source_file %></h3>
    <h4>
      <%= covered_percent(source_file.covered_percent) %>
      lines covered
    </h4>

    <% if branchable_result? %>
      <h4>
        <%= covered_percent(source_file.branches_coverage_percent) %>
        branches covered
      </h4>
    <% end %>

    <div class="t-line-summary">
      <b><%= source_file.lines_of_code %></b> relevant lines.
      <span class="green"><b><%= source_file.covered_lines.count %></b> lines covered</span> and
      <span class="red"><b><%= source_file.missed_lines.count %></b> lines missed.</span>
    </div>

    <% if branchable_result? %>
      <div class="t-branch-summary">
          <span><b><%= source_file.total_branches.count %></b> total branches, </span>
          <span class="green"><b><%= source_file.covered_branches.count %></b> branches covered</span> and
          <span class="red"><b><%= source_file.missed_branches.count %></b> branches missed.</span>
      </div>
    <% end %>

  </div>

  <pre>
    <ol>
      <% source_file.lines.each do |line| %>
        <div>
          <li class="<%= line_status?(source_file, line) %>" data-hits="<%= line.coverage ? line.coverage : '' %>" data-linenumber="<%= line.number %>">
            <% if line.covered? %><span class="hits"><%= line.coverage %></span><% end %>
            <% if line.skipped? %><span class="hits">skipped</span><% end %>

            <% if branchable_result? %>
              <% source_file.branches_for_line(line.number).each do |branch_type, hit_count| %>
                <span class="hits" title="<%= branch_type%> branch hit <%= hit_count %> times">
                  <%= branch_type %>: <%= hit_count %>
                </span>
              <% end %>
            <% end %>

            <code class="ruby"><%= CGI.escapeHTML(line.src.chomp) %></code>
          </li>
        </div>
      <% end %>
    </ol>
  </pre>
</div>