rcov 0.9.11 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/bin/rcov +26 -3
  2. data/ext/rcovrt/1.8/callsite.c +38 -53
  3. data/ext/rcovrt/1.8/rcovrt.c +84 -100
  4. data/ext/rcovrt/extconf.rb +7 -12
  5. data/lib/rcov/formatters/html_erb_template.rb +7 -7
  6. data/lib/rcov/formatters/html_profiling.rb +51 -0
  7. data/lib/rcov/formatters/ruby_annotation.rb +110 -0
  8. data/lib/rcov/templates/index.html.erb +18 -14
  9. data/lib/rcov/version.rb +2 -6
  10. metadata +35 -75
  11. data/BLURB +0 -111
  12. data/LICENSE +0 -53
  13. data/Rakefile +0 -103
  14. data/THANKS +0 -110
  15. data/doc/readme_for_api.markdown +0 -22
  16. data/doc/readme_for_emacs.markdown +0 -52
  17. data/doc/readme_for_rake.markdown +0 -51
  18. data/doc/readme_for_vim.markdown +0 -34
  19. data/editor-extensions/rcov.el +0 -131
  20. data/editor-extensions/rcov.vim +0 -38
  21. data/ext/rcovrt/1.9/callsite.c +0 -234
  22. data/ext/rcovrt/1.9/rcovrt.c +0 -264
  23. data/setup.rb +0 -1588
  24. data/test/assets/sample_01.rb +0 -7
  25. data/test/assets/sample_02.rb +0 -5
  26. data/test/assets/sample_03.rb +0 -20
  27. data/test/assets/sample_04.rb +0 -10
  28. data/test/assets/sample_05-new.rb +0 -17
  29. data/test/assets/sample_05-old.rb +0 -13
  30. data/test/assets/sample_05.rb +0 -17
  31. data/test/assets/sample_06.rb +0 -8
  32. data/test/call_site_analyzer_test.rb +0 -171
  33. data/test/code_coverage_analyzer_test.rb +0 -220
  34. data/test/expected_coverage/diff-gcc-all.out +0 -7
  35. data/test/expected_coverage/diff-gcc-diff.out +0 -11
  36. data/test/expected_coverage/diff-gcc-original.out +0 -5
  37. data/test/expected_coverage/diff-no-color.out +0 -12
  38. data/test/expected_coverage/diff.out +0 -12
  39. data/test/expected_coverage/gcc-text.out +0 -10
  40. data/test/expected_coverage/sample_03_rb.html +0 -651
  41. data/test/expected_coverage/sample_03_rb.rb +0 -28
  42. data/test/expected_coverage/sample_04_rb.html +0 -641
  43. data/test/file_statistics_test.rb +0 -471
  44. data/test/functional_test.rb +0 -91
  45. data/test/test_helper.rb +0 -4
  46. data/test/turn_off_rcovrt.rb +0 -4
@@ -1,3 +1,8 @@
1
+ if RUBY_VERSION =~ /1.9/
2
+ puts "**** Ruby 1.9 is not supported. Please switch to simplecov ****"
3
+ Kernel.exit 1
4
+ end
5
+
1
6
  require 'mkmf'
2
7
 
3
8
  dir_config("gcov")
@@ -5,17 +10,7 @@ if ENV["USE_GCOV"] and Config::CONFIG['CC'] =~ /gcc/ and
5
10
  have_library("gcov", "__gcov_open")
6
11
 
7
12
  $CFLAGS << " -fprofile-arcs -ftest-coverage"
8
- if RUBY_VERSION =~ /1.9/
9
- $CFLAGS << ' -DRUBY_19_COMPATIBILITY'
10
- create_makefile("rcovrt", "1.9/")
11
- else
12
- create_makefile("rcovrt", "1.8/")
13
- end
13
+ create_makefile("rcovrt", "1.8/")
14
14
  else
15
- if RUBY_VERSION =~ /1.9/
16
- $CFLAGS << ' -DRUBY_19_COMPATIBILITY'
17
- create_makefile("rcovrt", "1.9/")
18
- else
19
- create_makefile("rcovrt", "1.8/")
20
- end
15
+ create_makefile("rcovrt", "1.8/")
21
16
  end
@@ -19,10 +19,10 @@ module Rcov
19
19
  end
20
20
 
21
21
  def coverage_threshold_classes(percentage)
22
- return 110 if percentage == 100
23
- return (1..10).find_all{|i| i * 10 > percentage}.map{|i| i.to_i * 10} * " "
22
+ return '_110' if percentage == 100
23
+ return (1..10).find_all{|i| i * 10 > percentage}.map{|i| "_#{i*10}"} * " "
24
24
  end
25
-
25
+
26
26
  def code_coverage_html(code_coverage_percentage, is_total=false)
27
27
  %{<div class="percent_graph_legend"><tt class='#{ is_total ? 'coverage_total' : ''}'>#{ "%3.2f" % code_coverage_percentage }%</tt></div>
28
28
  <div class="percent_graph">
@@ -34,11 +34,11 @@ module Rcov
34
34
  def file_filter_classes(file_path)
35
35
  file_path.split('/')[0..-2] * " "
36
36
  end
37
-
37
+
38
38
  def relative_filename(path)
39
39
  @path_relativizer[path]
40
40
  end
41
-
41
+
42
42
  def line_css(line_number)
43
43
  case fileinfo.coverage[line_number]
44
44
  when true
@@ -55,8 +55,8 @@ module Rcov
55
55
  end
56
56
 
57
57
  def get_binding
58
- binding
58
+ binding
59
59
  end
60
60
  end
61
61
  end
62
- end
62
+ end
@@ -0,0 +1,51 @@
1
+ module Rcov
2
+ module Formatters
3
+ class HTMLProfiling < HTMLCoverage
4
+ DEFAULT_OPTS = { :destdir => "profiling" }
5
+
6
+ def initialize(opts = {})
7
+ options = DEFAULT_OPTS.clone.update(opts)
8
+ super(options)
9
+ @max_cache = {}
10
+ @median_cache = {}
11
+ end
12
+
13
+ def default_title
14
+ "Bogo-profile information"
15
+ end
16
+
17
+ def default_color
18
+ if @color
19
+ "rgb(179,205,255)"
20
+ else
21
+ "rgb(255, 255, 255)"
22
+ end
23
+ end
24
+
25
+ def output_color_table?
26
+ false
27
+ end
28
+
29
+ def span_class(sourceinfo, marked, count)
30
+ full_scale_range = @fsr # dB
31
+ nz_count = sourceinfo.counts.select{ |x| x && x != 0 }
32
+ nz_count << 1 # avoid div by 0
33
+ max = @max_cache[sourceinfo] ||= nz_count.max
34
+ median = @median_cache[sourceinfo] ||= 1.0 * nz_count.sort[nz_count.size/2]
35
+ max ||= 2
36
+ max = 2 if max == 1
37
+
38
+ if marked == true
39
+ count = 1 if !count || count == 0
40
+ idx = 50 + 1.0 * (500/full_scale_range) * Math.log(count/median) / Math.log(10)
41
+ idx = idx.to_i
42
+ idx = 0 if idx < 0
43
+ idx = 100 if idx > 100
44
+ "run#{idx}"
45
+ else
46
+ nil
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,110 @@
1
+ module Rcov
2
+ module Formatters
3
+ class RubyAnnotation < BaseFormatter
4
+ DEFAULT_OPTS = { :destdir => "coverage" }
5
+
6
+ def initialize(opts = {})
7
+ options = DEFAULT_OPTS.clone.update(opts)
8
+ super(options)
9
+ @dest = options[:destdir]
10
+ @do_callsites = true
11
+ @do_cross_references = true
12
+ @mangle_filename = Hash.new{|h,base|
13
+ h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".rb"
14
+ }
15
+ end
16
+
17
+ def execute
18
+ return if @files.empty?
19
+ FileUtils.mkdir_p @dest
20
+ each_file_pair_sorted do |filename, fileinfo|
21
+ create_file(File.join(@dest, mangle_filename(filename)), fileinfo)
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def format_lines(file)
28
+ result = ""
29
+ format_line = "%#{file.num_lines.to_s.size}d"
30
+ file.num_lines.times do |i|
31
+ line = file.lines[i].chomp
32
+ marked = file.coverage[i]
33
+ count = file.counts[i]
34
+ result << create_cross_refs(file.name, i+1, line, marked) + "\n"
35
+ end
36
+ result
37
+ end
38
+
39
+ def create_cross_refs(filename, lineno, linetext, marked)
40
+ return linetext unless @callsite_analyzer && @do_callsites
41
+ ref_blocks = []
42
+ _get_defsites(ref_blocks, filename, lineno, linetext, ">>") do |ref|
43
+ if ref.file
44
+ ref.file.sub!(%r!^./!, '')
45
+ where = "at #{mangle_filename(ref.file)}:#{ref.line}"
46
+ else
47
+ where = "(C extension/core)"
48
+ end
49
+ "#{ref.klass}##{ref.mid} " + where + ""
50
+ end
51
+ _get_callsites(ref_blocks, filename, lineno, linetext, "<<") do |ref| # "
52
+ ref.file.sub!(%r!^./!, '')
53
+ "#{mangle_filename(ref.file||'C code')}:#{ref.line} " +
54
+ "in #{ref.klass}##{ref.mid}"
55
+ end
56
+
57
+ create_cross_reference_block(linetext, ref_blocks, marked)
58
+ end
59
+
60
+ def create_cross_reference_block(linetext, ref_blocks, marked)
61
+ codelen = 75
62
+ if ref_blocks.empty?
63
+ if marked
64
+ return "%-#{codelen}s #o" % linetext
65
+ else
66
+ return linetext
67
+ end
68
+ end
69
+ ret = ""
70
+ @cross_ref_idx ||= 0
71
+ @known_files ||= sorted_file_pairs.map{|fname, finfo| normalize_filename(fname)}
72
+ ret << "%-#{codelen}s # " % linetext
73
+ ref_blocks.each do |refs, toplabel, label_proc|
74
+ unless !toplabel || toplabel.empty?
75
+ ret << toplabel << " "
76
+ end
77
+ refs.each do |dst|
78
+ dstfile = normalize_filename(dst.file) if dst.file
79
+ dstline = dst.line
80
+ label = label_proc.call(dst)
81
+ if dst.file && @known_files.include?(dstfile)
82
+ ret << "[[" << label << "]], "
83
+ else
84
+ ret << label << ", "
85
+ end
86
+ end
87
+ end
88
+
89
+ ret
90
+ end
91
+
92
+ def create_file(destfile, fileinfo)
93
+ #body = format_lines(fileinfo)
94
+ #File.open(destfile, "w") do |f|
95
+ #f.puts body
96
+ #f.puts footer(fileinfo)
97
+ #end
98
+ end
99
+
100
+ def footer(fileinfo)
101
+ s = "# Total lines : %d\n" % fileinfo.num_lines
102
+ s << "# Lines of code : %d\n" % fileinfo.num_code_lines
103
+ s << "# Total coverage : %3.1f%%\n" % [ fileinfo.total_coverage*100 ]
104
+ s << "# Code coverage : %3.1f%%\n\n" % [ fileinfo.code_coverage*100 ]
105
+ # prevents false positives on Emacs
106
+ s << "# Local " "Variables:\n" "# mode: " "rcov-xref\n" "# End:\n"
107
+ end
108
+ end
109
+ end
110
+ end
@@ -31,12 +31,12 @@
31
31
  <label>Code Coverage Threshold:</label>
32
32
  <select id="coverage_filter" class="filter">
33
33
  <option value="all_coverage">Show All</option>
34
- <% (1..10).each do |i| %><option value="<%= i * 10 %>">&lt; <%= i * 10 %>% Coverage</option><% end %>
35
- <option value="110">= 100% Coverage</option>
34
+ <% (1..10).each do |i| %><option value="_<%= i * 10 %>">&lt; <%= i * 10 %>% Coverage</option><% end %>
35
+ <option value="_110">= 100% Coverage</option>
36
36
  </select>
37
37
  </fieldset>
38
38
  </div>
39
-
39
+
40
40
  <div class="report_table_wrapper">
41
41
  <table class='report' id='report_table'>
42
42
  <thead>
@@ -70,22 +70,26 @@
70
70
  </tbody>
71
71
  </table>
72
72
  </div>
73
-
73
+
74
74
  <p>Generated on <%= generated_on %> with <a href="<%= rcov::UPSTREAM_URL %>">rcov <%= rcov::VERSION %></a></p>
75
75
 
76
76
  <script type="text/javascript">
77
- $(document).ready(function(){$("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});});
77
+ $(document).ready(function(){
78
+ $("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});
79
+ }
80
+ );
78
81
  $('.filter').change(function(){
79
- ff = $('#file_filter').val();
80
- cf = $('#coverage_filter').val();
81
- $('table#report_table tbody tr').each(function(i){
82
- if ((this.className.split(" ").indexOf(ff) > -1) && (this.className.split(" ").indexOf(cf) > -1)) {
83
- this.style.display = "";
84
- } else {
85
- this.style.display = "none";
86
- };
82
+ ff = '.' + $('#file_filter').val();
83
+ cf = '.' + $('#coverage_filter').val();
84
+ rows = 'table#report_table tbody tr';
85
+ // Hide all rows that don't match the filters
86
+ $(rows).not(cf).map(function() { $(this).hide(); });
87
+ $(rows).not(ff).map(function() { $(this).hide(); });
88
+ // Show and restripe all rows that match both filters
89
+ $(rows).filter(cf).filter(ff).each(function() {
90
+ $(this).show();
87
91
  restripe();
88
- })
92
+ });
89
93
  })
90
94
  </script>
91
95
 
@@ -1,10 +1,6 @@
1
- # rcov Copyright (c) 2004-2006 Mauricio Fernandez <mfp@acm.org>
2
- #
3
- # See LICENSE for licensing information.
4
-
5
1
  module Rcov
6
- VERSION = "0.9.11"
7
- RELEASE_DATE = "2010-02-28"
2
+ VERSION = "1.0.0"
3
+ RELEASE_DATE = "2012-02-01"
8
4
  RCOVRT_ABI = [2,0,0]
9
5
  UPSTREAM_URL = "http://github.com/relevance/rcov"
10
6
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcov
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 11
10
- version: 0.9.11
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
- - Relevance
14
- - Chad Humphries (spicycode)
15
13
  - Aaron Bedra (abedra)
14
+ - Chad Humphries (spicycode)
16
15
  - Jay McGaffigan(hooligan495)
16
+ - Relevance Inc
17
17
  - Mauricio Fernandez
18
18
  autorequire:
19
19
  bindir: bin
20
- cert_chain:
21
- date: 2009-12-29 00:00:00 -05:00
22
- default_executable:
20
+ cert_chain: []
21
+
22
+ date: 2012-02-01 00:00:00 Z
23
23
  dependencies: []
24
24
 
25
- description: rcov is a code coverage tool for Ruby. It is commonly used for viewing overall test unit coverage of target code. It features fast execution (20-300 times faster than previous tools), multiple analysis modes, XHTML and several kinds of text reports, easy automation with Rake via a RcovTask, fairly accurate coverage information through code linkage inference using simple heuristics, colorblind-friendliness...
26
- email: opensource@thinkrelevance.com
25
+ description: rcov is a code coverage tool for Ruby.
26
+ email: aaron@aaronbedra.com
27
27
  executables:
28
28
  - rcov
29
29
  extensions:
@@ -31,72 +31,37 @@ extensions:
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
- - bin/rcov
35
- - lib/rcov.rb
36
- - lib/rcov/lowlevel.rb
37
- - lib/rcov/version.rb
38
- - lib/rcov/rcovtask.rb
39
- - lib/rcov/formatters.rb
40
34
  - lib/rcov/call_site_analyzer.rb
41
35
  - lib/rcov/code_coverage_analyzer.rb
42
36
  - lib/rcov/coverage_info.rb
43
37
  - lib/rcov/differential_analyzer.rb
44
38
  - lib/rcov/file_statistics.rb
45
39
  - lib/rcov/formatters/base_formatter.rb
40
+ - lib/rcov/formatters/failure_report.rb
46
41
  - lib/rcov/formatters/full_text_report.rb
47
- - lib/rcov/formatters/html_erb_template.rb
48
42
  - lib/rcov/formatters/html_coverage.rb
43
+ - lib/rcov/formatters/html_erb_template.rb
44
+ - lib/rcov/formatters/html_profiling.rb
45
+ - lib/rcov/formatters/ruby_annotation.rb
49
46
  - lib/rcov/formatters/text_coverage_diff.rb
50
47
  - lib/rcov/formatters/text_report.rb
51
48
  - lib/rcov/formatters/text_summary.rb
52
- - lib/rcov/formatters/failure_report.rb
53
- - lib/rcov/templates/index.html.erb
49
+ - lib/rcov/formatters.rb
50
+ - lib/rcov/lowlevel.rb
51
+ - lib/rcov/rcovtask.rb
52
+ - lib/rcov/version.rb
53
+ - lib/rcov.rb
54
54
  - lib/rcov/templates/detail.html.erb
55
- - lib/rcov/templates/screen.css
56
- - lib/rcov/templates/print.css
57
- - lib/rcov/templates/rcov.js
55
+ - lib/rcov/templates/index.html.erb
58
56
  - lib/rcov/templates/jquery-1.3.2.min.js
59
57
  - lib/rcov/templates/jquery.tablesorter.min.js
60
- - ext/rcovrt/extconf.rb
61
- - ext/rcovrt/1.8/rcovrt.c
62
- - ext/rcovrt/1.9/rcovrt.c
58
+ - lib/rcov/templates/print.css
59
+ - lib/rcov/templates/rcov.js
60
+ - lib/rcov/templates/screen.css
63
61
  - ext/rcovrt/1.8/callsite.c
64
- - ext/rcovrt/1.9/callsite.c
65
- - LICENSE
66
- - Rakefile
67
- - doc/readme_for_rake.markdown
68
- - doc/readme_for_vim.markdown
69
- - doc/readme_for_emacs.markdown
70
- - doc/readme_for_api.markdown
71
- - THANKS
72
- - test/functional_test.rb
73
- - test/file_statistics_test.rb
74
- - test/assets/sample_03.rb
75
- - test/assets/sample_05-new.rb
76
- - test/code_coverage_analyzer_test.rb
77
- - test/assets/sample_04.rb
78
- - test/assets/sample_02.rb
79
- - test/assets/sample_05-old.rb
80
- - test/assets/sample_01.rb
81
- - test/turn_off_rcovrt.rb
82
- - test/call_site_analyzer_test.rb
83
- - test/assets/sample_05.rb
84
- - test/assets/sample_06.rb
85
- - editor-extensions/rcov.vim
86
- - test/test_helper.rb
87
- - test/expected_coverage/diff-gcc-all.out
88
- - test/expected_coverage/diff-gcc-diff.out
89
- - test/expected_coverage/diff-gcc-original.out
90
- - test/expected_coverage/diff-no-color.out
91
- - test/expected_coverage/diff.out
92
- - test/expected_coverage/gcc-text.out
93
- - test/expected_coverage/sample_03_rb.html
94
- - test/expected_coverage/sample_03_rb.rb
95
- - test/expected_coverage/sample_04_rb.html
96
- - editor-extensions/rcov.el
97
- - setup.rb
98
- - BLURB
99
- has_rdoc: true
62
+ - ext/rcovrt/1.8/rcovrt.c
63
+ - ext/rcovrt/extconf.rb
64
+ - bin/rcov
100
65
  homepage: http://github.com/relevance/rcov
101
66
  licenses: []
102
67
 
@@ -109,14 +74,12 @@ require_paths:
109
74
  required_ruby_version: !ruby/object:Gem::Requirement
110
75
  none: false
111
76
  requirements:
112
- - - ">"
77
+ - - ">="
113
78
  - !ruby/object:Gem::Version
114
- hash: 31
79
+ hash: 3
115
80
  segments:
116
81
  - 0
117
- - 0
118
- - 0
119
- version: 0.0.0
82
+ version: "0"
120
83
  required_rubygems_version: !ruby/object:Gem::Requirement
121
84
  none: false
122
85
  requirements:
@@ -129,12 +92,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
92
  requirements: []
130
93
 
131
94
  rubyforge_project:
132
- rubygems_version: 1.3.7
95
+ rubygems_version: 1.8.15
133
96
  signing_key:
134
- specification_version: 1
97
+ specification_version: 3
135
98
  summary: Code coverage analysis tool for Ruby
136
- test_files:
137
- - test/functional_test.rb
138
- - test/file_statistics_test.rb
139
- - test/code_coverage_analyzer_test.rb
140
- - test/call_site_analyzer_test.rb
99
+ test_files: []
100
+