simplecov-rcov 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,65 @@
1
- class SimpleCov::Formatter::RcovFormatter
2
- PATH_RESULT = "/rcov/index.html"
1
+ require 'bundler'
2
+ Bundler.setup(:default)
3
+
4
+ require 'erb'
5
+ require 'cgi'
6
+ require 'fileutils'
7
+ require 'time'
8
+
9
+ unless defined?(SimpleCov)
10
+ raise RuntimeError, "simplecov-rcov is a formatter for simplecov. Please update your test helper and gemfile to require 'simplecov'!"
11
+ end
3
12
 
13
+ class SimpleCov::Formatter::RcovFormatter
4
14
  def format( result )
15
+ Dir[File.join(File.dirname(__FILE__), '../assets/*')].each do |path|
16
+ FileUtils.cp_r(path, asset_output_path)
17
+ end
18
+
19
+ @path_relativizer = Hash.new{|h,base|
20
+ h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html"
21
+ }
22
+
23
+ generated_on = Time.now
24
+
5
25
  @files = result.files
6
26
 
7
27
  @total_lines = result.files.map { |e| e.lines.count }.inject(:+)
8
28
  @total_lines_code = result.files.map { |e| e.covered_lines.count + e.missed_lines.count }.inject(:+)
9
29
  @total_coverage = coverage(result.files)
30
+ @total_coverage_code = coverage_code(result.files)
10
31
 
11
- template = ERB.new( File.read( "#{File.dirname(__FILE__)}/../views/index.erb.html" ) )
12
- rcov_result = template.result( binding )
32
+ FileUtils.mkdir_p( SimpleCov::Formatter::RcovFormatter.output_path )
13
33
 
14
- FileUtils.mkdir_p( File.dirname( SimpleCov::Formatter::RcovFormatter.path_result ) )
34
+ write_file(template("index.html"), File.join(SimpleCov::Formatter::RcovFormatter.output_path, "/index.html") , binding)
15
35
 
16
- File.open( SimpleCov::Formatter::RcovFormatter.path_result, "w" ) do |file_result|
17
- file_result.write rcov_result
36
+ template = template("detail.html")
37
+ result.files.each do |file|
38
+ write_file(template, File.join(SimpleCov::Formatter::RcovFormatter.output_path, relative_filename(shortened_filename(file))), binding)
18
39
  end
19
40
 
20
- puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.path_result}"
21
-
22
- return rcov_result
41
+ puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.output_path}"
23
42
  end
24
43
 
25
44
  private
26
45
 
46
+ def write_file(template, output_filename, binding)
47
+ rcov_result = template.result( binding )
48
+
49
+ File.open( output_filename, "w" ) do |file_result|
50
+ file_result.write rcov_result
51
+ end
52
+ end
53
+
54
+ def template(name)
55
+ ERB.new(File.read(File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")), nil, '-')
56
+ end
57
+
58
+ def lines(file_list)
59
+ return 0.0 if file_list.length == 0
60
+ file_list.map { |e| e.lines.count }.inject(:+)
61
+ end
62
+
27
63
  def lines_covered(file_list)
28
64
  return 0.0 if file_list.length == 0
29
65
  file_list.map {|f| f.covered_lines.count }.inject(&:+)
@@ -40,12 +76,77 @@ class SimpleCov::Formatter::RcovFormatter
40
76
 
41
77
  def coverage(file_list)
42
78
  return 100.0 if file_list.length == 0 or lines_of_code(file_list) == 0
43
- lines_missed = file_list.map {|f| f.missed_lines.count }.inject(&:+)
79
+ never_lines = file_list.map {|f| f.never_lines.count }.inject(&:+)
80
+
81
+ (lines_covered(file_list) + never_lines) * 100 / lines(file_list).to_f
82
+ end
83
+
84
+ def coverage_code(file_list)
85
+ return 100.0 if file_list.length == 0 or lines_of_code(file_list) == 0
44
86
 
45
87
  lines_covered(file_list) * 100 / lines_of_code(file_list).to_f
46
88
  end
47
89
 
48
- def self.path_result
49
- File.join( SimpleCov.coverage_path, SimpleCov::Formatter::RcovFormatter::PATH_RESULT )
90
+ def self.output_path
91
+ File.join( SimpleCov.coverage_path, "/rcov" )
92
+ end
93
+
94
+ def asset_output_path
95
+ return @asset_output_path if @asset_output_path
96
+ @asset_output_path = File.join(SimpleCov::Formatter::RcovFormatter.output_path, 'assets', SimpleCov::Formatter::RcovFormatter::VERSION)
97
+ FileUtils.mkdir_p(@asset_output_path)
98
+ @asset_output_path
99
+ end
100
+
101
+ def project_name
102
+ SimpleCov.project_name
103
+ end
104
+
105
+ def assets_path(name)
106
+ File.join('./assets', SimpleCov::Formatter::RcovFormatter::VERSION, name)
107
+ end
108
+
109
+ def code_coverage_html(code_coverage_percentage, is_total=false)
110
+ %{<div class="percent_graph_legend"><tt class='#{ is_total ? 'coverage_total' : ''}'>#{ "%3.2f" % code_coverage_percentage }%</tt></div>
111
+ <div class="percent_graph">
112
+ <div class="covered" style="width:#{ code_coverage_percentage.round }px"></div>
113
+ <div class="uncovered" style="width:#{ 100 - code_coverage_percentage.round }px"></div>
114
+ </div>}
115
+ end
116
+
117
+ def total_coverage_for_report(file)
118
+ return 100.0 if file.lines.count == 0
119
+ (file.covered_lines.count + file.never_lines.count) * 100 / file.lines.count.to_f
120
+ end
121
+
122
+ def coverage_threshold_classes(percentage)
123
+ return 110 if percentage == 100
124
+ return (1..10).find_all{|i| i * 10 > percentage}.map{|i| i.to_i * 10} * " "
125
+ end
126
+
127
+ def shortened_filename(file)
128
+ file.filename.gsub("#{SimpleCov.root}/", '')
129
+ end
130
+
131
+ def relative_filename(path)
132
+ @path_relativizer[path]
133
+ end
134
+
135
+ def file_filter_classes(file_path)
136
+ file_path.split('/')[0..-2] * " "
137
+ end
138
+
139
+ def line_css_for(coverage)
140
+ unless coverage.nil?
141
+ if coverage > 0
142
+ "marked"
143
+ else
144
+ "uncovered"
145
+ end
146
+ else
147
+ "inferred"
148
+ end
50
149
  end
51
150
  end
151
+
152
+ require 'simplecov-rcov/version'
@@ -0,0 +1,8 @@
1
+ module SimpleCov
2
+ module Formatter
3
+ class RcovFormatter
4
+ VERSION = "0.2.0"
5
+ UPSTREAM_URL = "https://github.com/fguillen/simplecov-rcov"
6
+ end
7
+ end
8
+ end
@@ -1,40 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'simplecov-rcov/version'
2
4
 
3
5
  Gem::Specification.new do |s|
4
- s.name = %q{simplecov-rcov}
5
- s.version = "0.1.4"
6
+ s.name = %q{simplecov-rcov}
7
+ s.version = SimpleCov::Formatter::RcovFormatter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Fernando Guillen http://fernandoguillen.info", "Wes Morgan http://github.com/cap10morgan", "Wandenberg Peixoto http://github.com/wandenberg"]
10
+ s.email = ["fguillen.mail@gmail.com", "cap10morgan@gmail.com"]
11
+ s.homepage = %q{http://github.com/fguillen/simplecov-rcov}
12
+ s.summary = %q{Rcov style formatter for SimpleCov}
13
+ s.description = %q{Rcov style formatter for SimpleCov}
14
+ s.date = %q{2011-02-10}
6
15
 
7
16
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Fernando Guillen http://fernandoguillen.info, Wes Morgan http://github.com/cap10morgan"]
9
- s.date = %q{2011-02-10}
10
- s.description = %q{Rcov style formatter for SimpleCov}
11
- s.email = ["fguillen.mail@gmail.com", "cap10morgan@gmail.com"]
12
17
  s.extra_rdoc_files = ["README.md", "lib/simplecov-rcov.rb"]
13
- s.files = ["Gemfile", "Gemfile.lock", "Manifest", "README.md", "Rakefile", "lib/simplecov-rcov.rb", "simplecov-rcov.gemspec", "test/fixtures/app/controllers/sample.rb", "test/fixtures/app/models/airplane.rb", "test/fixtures/app/models/dog.rb", "test/fixtures/app/models/house.rb", "test/fixtures/app/models/robot.rb", "test/fixtures/app/models/user.rb", "test/fixtures/file_tr.html", "test/fixtures/sample.rb", "test/fixtures/totals_tr.html", "test/helper.rb", "test/simplecov-rcov_test.rb", "views/index.erb.html"]
14
- s.homepage = %q{http://github.com/fguillen/simplecov-rcov}
15
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simplecov-rcov", "--main", "README.md"]
16
- s.require_paths = ["lib"]
17
19
  s.rubyforge_project = %q{simplecov-rcov}
18
20
  s.rubygems_version = %q{1.3.7}
19
- s.summary = %q{Rcov style formatter for SimpleCov}
20
- s.test_files = ["test/simplecov-rcov_test.rb"]
21
21
 
22
- if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 3
25
-
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<simplecov>, [">= 0"])
28
- s.add_development_dependency(%q<echoe>, [">= 0"])
29
- s.add_development_dependency(%q<mocha>, [">= 0"])
30
- else
31
- s.add_dependency(%q<simplecov>, [">= 0"])
32
- s.add_dependency(%q<echoe>, [">= 0"])
33
- s.add_dependency(%q<mocha>, [">= 0"])
34
- end
35
- else
36
- s.add_dependency(%q<simplecov>, [">= 0"])
37
- s.add_dependency(%q<echoe>, [">= 0"])
38
- s.add_dependency(%q<mocha>, [">= 0"])
39
- end
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
40
26
  end
@@ -0,0 +1,30 @@
1
+ <tr class="inferred">
2
+ <td><pre><a name="line2">2</a> # Foo class</pre></td>
3
+ </tr>
4
+ <tr class="marked">
5
+ <td><pre><a name="line3">3</a> class Foo</pre></td>
6
+ </tr>
7
+ <tr class="marked">
8
+ <td><pre><a name="line4">4</a> def initialize</pre></td>
9
+ </tr>
10
+ <tr class="marked">
11
+ <td><pre><a name="line5">5</a> @foo = 'baz'</pre></td>
12
+ </tr>
13
+ <tr class="marked">
14
+ <td><pre><a name="line6">6</a> end</pre></td>
15
+ </tr>
16
+ <tr class="uncovered">
17
+ <td><pre><a name="line7">7</a> </pre></td>
18
+ </tr>
19
+ <tr class="marked">
20
+ <td><pre><a name="line8">8</a> def bar</pre></td>
21
+ </tr>
22
+ <tr class="uncovered">
23
+ <td><pre><a name="line9">9</a> @foo</pre></td>
24
+ </tr>
25
+ <tr class="inferred">
26
+ <td><pre><a name="line10">10</a> end</pre></td>
27
+ </tr>
28
+ <tr class="inferred">
29
+ <td><pre><a name="line11">11</a> end</pre></td>
30
+ </tr>
@@ -1,7 +1,15 @@
1
- <tr class="all_files">
2
- <td class="left_align"><a href="#./test/fixtures/app/models/user.rb">./test/fixtures/app/models/user.rb</a></td>
1
+ <tr class="all_files all_coverage 80 90 100 test fixtures app models odd">
2
+ <td class="left_align"><a href="test-fixtures-app-models-user_rb.html">test/fixtures/app/models/user.rb</a></td>
3
3
  <td class='right_align'><tt>10</tt></td>
4
4
  <td class='right_align'><tt>7</tt></td>
5
- <td class="left_align"><tt class=''>71.43%</tt></td>
6
- <td class="left_align"><tt class=''>71.43%</tt></td>
5
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>80.00%</tt></div>
6
+ <div class="percent_graph">
7
+ <div class="covered" style="width:80px"></div>
8
+ <div class="uncovered" style="width:20px"></div>
9
+ </div></td>
10
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>71.43%</tt></div>
11
+ <div class="percent_graph">
12
+ <div class="covered" style="width:71px"></div>
13
+ <div class="uncovered" style="width:29px"></div>
14
+ </div></td>
7
15
  </tr>
@@ -2,6 +2,14 @@
2
2
  <td class="left_align">TOTAL</td>
3
3
  <td class='right_align'><tt>60</tt></td>
4
4
  <td class='right_align'><tt>34</tt></td>
5
- <td class="left_align"><tt class=''>67.65%</tt></td>
6
- <td class="left_align"><tt class='coverage_total'>67.65%</tt></td>
5
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>81.67%</tt></div>
6
+ <div class="percent_graph">
7
+ <div class="covered" style="width:82px"></div>
8
+ <div class="uncovered" style="width:18px"></div>
9
+ </div></td>
10
+ <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>67.65%</tt></div>
11
+ <div class="percent_graph">
12
+ <div class="covered" style="width:68px"></div>
13
+ <div class="uncovered" style="width:32px"></div>
14
+ </div></td>
7
15
  </tr>
@@ -0,0 +1,45 @@
1
+ require "#{File.expand_path(File.dirname(__FILE__))}/helper"
2
+
3
+ class SimplecovRcovFormatterTest < Test::Unit::TestCase
4
+ def test_format
5
+ SimpleCov.stubs(:coverage_path).returns('/tmp')
6
+ index = File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/index.html")
7
+ if File.exists?( index )
8
+ File.delete( index )
9
+ end
10
+
11
+ @original_result = {
12
+ source_fixture( 'sample.rb' ) => [nil, 1, 1, 1, nil, 0, 1, 1, nil, nil],
13
+ source_fixture( 'app/models/user.rb' ) => [nil, 1, 1, 1, 1, 0, 1, 0, nil, nil],
14
+ source_fixture( 'app/models/robot.rb' ) => [1, 1, 1, 1, nil, nil, 1, 0, nil, nil],
15
+ source_fixture( 'app/models/house.rb' ) => [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil],
16
+ source_fixture( 'app/models/airplane.rb' ) => [0, 0, 0, 0, 0],
17
+ source_fixture( 'app/models/dog.rb' ) => [1, 1, 1, 1, 1],
18
+ source_fixture( 'app/controllers/sample.rb' ) => [nil, 1, 1, 1, nil, nil, 0, 0, nil, nil]
19
+ }
20
+
21
+ @result = SimpleCov::Result.new( @original_result )
22
+ SimpleCov::Formatter::RcovFormatter.new().format( @result )
23
+
24
+ assert( File.exists?( index ) )
25
+
26
+ rcov_result = File.read( index )
27
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/totals_tr.html"), rcov_result )
28
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/file_tr.html"), rcov_result )
29
+
30
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-sample_rb.html") ) )
31
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-user_rb.html") ) )
32
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-robot_rb.html") ) )
33
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-house_rb.html") ) )
34
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-airplane_rb.html") ) )
35
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-dog_rb.html") ) )
36
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-controllers-sample_rb.html") ) )
37
+
38
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/detail_trs.html"), File.read(File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-user_rb.html")) )
39
+
40
+ end
41
+
42
+ def source_fixture( filename )
43
+ File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', filename ) )
44
+ end
45
+ end
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title><%= shortened_filename(file) %></title>
5
+ <link href="<%= assets_path('screen.css')%>" media="all" rel="stylesheet" type="text/css" />
6
+ <link href="<%= assets_path('print.css')%>" media="print" rel="stylesheet" type="text/css" />
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
8
+ <script type="text/javascript" src="<%= assets_path('rcov.js')%>"></script>
9
+ </head>
10
+ <body>
11
+ <h1><%= "#{project_name} C0 Coverage Information - Simploco - RCov" %></h1>
12
+ <h2><%= shortened_filename(file) %></h2>
13
+
14
+ <div class="report_table_wrapper">
15
+ <table class='report' id='report_table'>
16
+ <thead>
17
+ <tr>
18
+ <th class="left_align">Name</th>
19
+ <th class="right_align">Total Lines</th>
20
+ <th class="right_align">Lines of Code</th>
21
+ <th class="left_align">Total Coverage</th>
22
+ <th class="left_align">Code Coverage</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <tr>
27
+ <td class="left_align"><a href="<%= relative_filename(shortened_filename(file)) %>"><%= shortened_filename(file) %></a></td>
28
+ <td class='right_align'><tt><%= file.lines.count %></tt></td>
29
+ <td class='right_align'><tt><%= file.covered_lines.count + file.missed_lines.count %></tt></td>
30
+ <td class="left_align"><%= code_coverage_html(total_coverage_for_report(file)) %></td>
31
+ <td class="left_align"><%= code_coverage_html(file.covered_percent) %></td>
32
+ </tr>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+
37
+ <h3>Key</h3>
38
+
39
+ <div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>
40
+
41
+ <h3>Coverage Details</h3>
42
+
43
+ <table class="details">
44
+ <tbody>
45
+ <%- file.lines.each do |line| -%>
46
+ <tr class="<%= line_css_for(line.coverage) %>">
47
+ <td><pre><a name="line<%= line.number.next %>"><%= line.number.next %></a> <%= CGI::escapeHTML(line.src.chomp) %></pre></td>
48
+ </tr>
49
+ <%- end -%>
50
+ </tbody>
51
+ </table>
52
+
53
+ <p>Generated on <%= generated_on %> with <a href="<%= SimpleCov::Formatter::RcovFormatter::UPSTREAM_URL %>">SimpleCov-RCov <%= SimpleCov::Formatter::RcovFormatter::VERSION %></a></p>
54
+
55
+ </body>
56
+ </html>
@@ -0,0 +1,88 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
5
+ <title><%= "#{project_name} C0 Coverage Information - SimpleCov - RCov style" %></title>
6
+ <link href="<%= assets_path('screen.css')%>" media="all" rel="stylesheet" type="text/css" />
7
+ <link href="<%= assets_path('print.css')%>" media="print" rel="stylesheet" type="text/css" />
8
+ <script type="text/javascript" src="<%= assets_path('jquery-1.3.2.min.js')%>"></script>
9
+ <script type="text/javascript" src="<%= assets_path('jquery.tablesorter.min.js')%>"></script>
10
+ <script type="text/javascript" src="<%= assets_path('rcov.js')%>"></script>
11
+ </head>
12
+ <body>
13
+ <h1><%= "#{project_name} C0 Coverage Information - SimpleCov - RCov style" %></h1>
14
+
15
+ <noscript><style type="text/css">.if_js { display:none; }</style></noscript>
16
+
17
+ <div class="filters if_js">
18
+ <fieldset>
19
+ <label>File Filter:</label>
20
+ <select id="file_filter" class="filter">
21
+ <option value="all_files">Show All</option>
22
+ <% @files.map{|f| shortened_filename(f).split('/')[0..-2]}.flatten.uniq.sort.each do |f| %><option value="<%= f %>"><%= f %>/</option><% end %>
23
+ </select>
24
+ </fieldset>
25
+ <fieldset>
26
+ <label>Code Coverage Threshold:</label>
27
+ <select id="coverage_filter" class="filter">
28
+ <option value="all_coverage">Show All</option>
29
+ <% (1..10).each do |i| %><option value="<%= i * 10 %>">&lt; <%= i * 10 %>% Coverage</option><% end %>
30
+ <option value="110">= 100% Coverage</option>
31
+ </select>
32
+ </fieldset>
33
+ </div>
34
+
35
+ <div class="report_table_wrapper">
36
+ <table class='report' id='report_table'>
37
+ <thead>
38
+ <tr>
39
+ <th class="left_align">Name</th>
40
+ <th class="right_align">Total Lines</th>
41
+ <th class="right_align">Lines of Code</th>
42
+ <th class="left_align">Total Coverage</th>
43
+ <th class="left_align">Code Coverage</th>
44
+ </tr>
45
+ </thead>
46
+ <tfoot>
47
+ <tr>
48
+ <td class="left_align">TOTAL</td>
49
+ <td class='right_align'><tt><%= @total_lines %></tt></td>
50
+ <td class='right_align'><tt><%= @total_lines_code %></tt></td>
51
+ <td class="left_align"><%= code_coverage_html(@total_coverage) %></td>
52
+ <td class="left_align"><%= code_coverage_html(@total_coverage_code, true) %></td>
53
+ </tr>
54
+ </tfoot>
55
+ <tbody>
56
+ <% @files.each_with_index do |file,i| %>
57
+ <tr class="all_files all_coverage <%= coverage_threshold_classes(file.covered_percent) %> <%= file_filter_classes(shortened_filename(file)) %> <%= i.odd? ? 'odd' : 'even' %>">
58
+ <td class="left_align"><a href="<%= CGI::escapeHTML(relative_filename(shortened_filename(file))) %>"><%= CGI::escapeHTML(shortened_filename(file)) %></a></td>
59
+ <td class='right_align'><tt><%= file.lines.count %></tt></td>
60
+ <td class='right_align'><tt><%= file.covered_lines.count + file.missed_lines.count %></tt></td>
61
+ <td class="left_align"><%= code_coverage_html(total_coverage_for_report(file)) %></td>
62
+ <td class="left_align"><%= code_coverage_html(file.covered_percent) %></td>
63
+ </tr>
64
+ <% end %>
65
+ </tbody>
66
+ </table>
67
+ </div>
68
+
69
+ <p>Generated on <%= generated_on %> with <a href="<%= SimpleCov::Formatter::RcovFormatter::UPSTREAM_URL %>">SimpleCov-RCov <%= SimpleCov::Formatter::RcovFormatter::VERSION %></a></p>
70
+
71
+ <script type="text/javascript">
72
+ $(document).ready(function(){$("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});});
73
+ $('.filter').change(function(){
74
+ ff = $('#file_filter').val();
75
+ cf = $('#coverage_filter').val();
76
+ $('table#report_table tbody tr').each(function(i){
77
+ if ((this.className.split(" ").indexOf(ff) > -1) && (this.className.split(" ").indexOf(cf) > -1)) {
78
+ this.style.display = "";
79
+ } else {
80
+ this.style.display = "none";
81
+ };
82
+ restripe();
83
+ })
84
+ })
85
+ </script>
86
+
87
+ </body>
88
+ </html>