metric_fu 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.metrics +19 -1
  2. data/.travis.yml +2 -2
  3. data/Gemfile +2 -1
  4. data/HISTORY.md +24 -0
  5. data/README.md +60 -1
  6. data/TODO.md +1 -0
  7. data/bin/mf-saikuro +8 -0
  8. data/checksum/metric_fu-4.3.0.gem.sha512 +1 -0
  9. data/gemfiles/Gemfile.travis +9 -0
  10. data/lib/metric_fu.rb +1 -1
  11. data/lib/metric_fu/cli/client.rb +2 -2
  12. data/lib/metric_fu/cli/helper.rb +3 -3
  13. data/lib/metric_fu/cli/parser.rb +37 -16
  14. data/lib/metric_fu/configuration.rb +9 -1
  15. data/lib/metric_fu/constantize.rb +57 -0
  16. data/lib/metric_fu/data_structures/line_numbers.rb +19 -3
  17. data/lib/metric_fu/data_structures/location.rb +8 -3
  18. data/lib/metric_fu/formatter.rb +24 -0
  19. data/lib/metric_fu/formatter/html.rb +91 -0
  20. data/lib/metric_fu/formatter/yaml.rb +18 -0
  21. data/lib/metric_fu/initial_requires.rb +0 -1
  22. data/lib/metric_fu/io.rb +69 -0
  23. data/lib/metric_fu/load_files.rb +5 -2
  24. data/lib/metric_fu/logging/mf_debugger.rb +23 -0
  25. data/lib/metric_fu/metrics/base_template.rb +10 -4
  26. data/lib/metric_fu/metrics/cane/cane.rb +2 -1
  27. data/lib/metric_fu/metrics/cane/cane_bluff_grapher.rb +10 -9
  28. data/lib/metric_fu/metrics/cane/cane_gchart_grapher.rb +25 -0
  29. data/lib/metric_fu/metrics/flay/flay_bluff_grapher.rb +10 -9
  30. data/lib/metric_fu/metrics/flay/flay_gchart_grapher.rb +14 -11
  31. data/lib/metric_fu/metrics/flog/flog_bluff_grapher.rb +11 -10
  32. data/lib/metric_fu/metrics/flog/flog_gchart_grapher.rb +22 -15
  33. data/lib/metric_fu/metrics/generator.rb +10 -10
  34. data/lib/metric_fu/metrics/graph.rb +2 -2
  35. data/lib/metric_fu/metrics/hotspots/analysis/scoring_strategies.rb +3 -3
  36. data/lib/metric_fu/metrics/hotspots/hotspot.rb +4 -3
  37. data/lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb +19 -10
  38. data/lib/metric_fu/metrics/hotspots/hotspots.rb +1 -1
  39. data/lib/metric_fu/metrics/hotspots/template_awesome/hotspots.html.erb +45 -45
  40. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb +10 -9
  41. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_gchart_grapher.rb +21 -15
  42. data/lib/metric_fu/metrics/rcov/rcov.rb +1 -1
  43. data/lib/metric_fu/metrics/rcov/rcov_bluff_grapher.rb +10 -9
  44. data/lib/metric_fu/metrics/rcov/rcov_gchart_grapher.rb +13 -8
  45. data/lib/metric_fu/metrics/reek/reek_bluff_grapher.rb +9 -13
  46. data/lib/metric_fu/metrics/reek/reek_gchart_grapher.rb +22 -17
  47. data/lib/metric_fu/metrics/roodi/roodi_bluff_grapher.rb +10 -9
  48. data/lib/metric_fu/metrics/roodi/roodi_gchart_grapher.rb +14 -11
  49. data/lib/metric_fu/metrics/saikuro/saikuro.rb +5 -34
  50. data/lib/metric_fu/metrics/stats/stats.rb +2 -1
  51. data/lib/metric_fu/metrics/stats/stats_bluff_grapher.rb +11 -10
  52. data/lib/metric_fu/metrics/stats/stats_gchart_grapher.rb +21 -14
  53. data/lib/metric_fu/reporter.rb +37 -0
  54. data/lib/metric_fu/reporting/graphs/engines/bluff.rb +20 -0
  55. data/lib/metric_fu/reporting/graphs/engines/gchart.rb +41 -3
  56. data/lib/metric_fu/reporting/graphs/grapher.rb +9 -2
  57. data/lib/metric_fu/reporting/result.rb +51 -0
  58. data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +8 -8
  59. data/lib/metric_fu/run.rb +34 -39
  60. data/lib/metric_fu/version.rb +1 -1
  61. data/lib/metric_fu_requires.rb +50 -33
  62. data/metric_fu.gemspec +30 -39
  63. data/spec/cli/helper_spec.rb +15 -0
  64. data/spec/metric_fu/configuration_spec.rb +40 -2
  65. data/spec/metric_fu/formatter/html_spec.rb +134 -0
  66. data/spec/metric_fu/formatter/yaml_spec.rb +59 -0
  67. data/spec/metric_fu/formatter_spec.rb +49 -0
  68. data/spec/metric_fu/metrics/base_template_spec.rb +23 -23
  69. data/spec/metric_fu/metrics/cane/cane_spec.rb +2 -2
  70. data/spec/metric_fu/metrics/churn/churn_spec.rb +1 -1
  71. data/spec/metric_fu/metrics/flay/flay_spec.rb +4 -4
  72. data/spec/metric_fu/metrics/flog/flog_spec.rb +7 -7
  73. data/spec/metric_fu/metrics/generator_spec.rb +21 -21
  74. data/spec/metric_fu/metrics/graph_spec.rb +9 -9
  75. data/spec/metric_fu/metrics/hotspots/hotspots_spec.rb +1 -1
  76. data/spec/metric_fu/metrics/rcov/rcov_spec.rb +8 -8
  77. data/spec/metric_fu/metrics/reek/reek_spec.rb +1 -1
  78. data/spec/metric_fu/metrics/saikuro/saikuro_spec.rb +5 -5
  79. data/spec/metric_fu/metrics/stats/stats_spec.rb +4 -4
  80. data/spec/metric_fu/reporter_spec.rb +41 -0
  81. data/spec/metric_fu/reporting/graphs/engines/gchart_spec.rb +7 -7
  82. data/spec/metric_fu/reporting/result_spec.rb +51 -0
  83. data/spec/run_spec.rb +167 -27
  84. data/spec/spec_helper.rb +1 -0
  85. data/spec/support/matcher_create_file.rb +7 -2
  86. data/spec/support/matcher_create_files.rb +41 -0
  87. data/spec/support/suite.rb +32 -0
  88. metadata +27 -6
  89. data/lib/metric_fu/reporting/report.rb +0 -111
  90. data/spec/metric_fu/reporting/report_spec.rb +0 -148
@@ -1,16 +1,17 @@
1
1
  MetricFu.metrics_require { 'flog/flog_grapher' }
2
2
  module MetricFu
3
3
  class FlogBluffGrapher < FlogGrapher
4
- def graph!
5
- content = <<-EOS
6
- #{BLUFF_DEFAULT_OPTIONS}
7
- g.title = 'Flog: code complexity';
8
- g.data('average', [#{@flog_average.join(',')}]);
9
- g.data('top 5% average', [#{@top_five_percent_average.join(',')}])
10
- g.labels = #{MultiJson.dump(@labels)};
11
- g.draw();
12
- EOS
13
- File.open(File.join(MetricFu.output_directory, 'flog.js'), 'w') {|f| f << content }
4
+ def title
5
+ 'Flog: code complexity'
6
+ end
7
+ def data
8
+ [
9
+ ['average', @flog_average.join(',')],
10
+ ['top 5% average', @top_five_percent_average.join(',')]
11
+ ]
12
+ end
13
+ def output_filename
14
+ 'flog.js'
14
15
  end
15
16
  end
16
17
  end
@@ -1,21 +1,28 @@
1
1
  MetricFu.metrics_require { 'flog/flog_grapher' }
2
2
  module MetricFu
3
3
  class FlogGchartGrapher < FlogGrapher
4
- def graph!
5
- determine_y_axis_scale(@top_five_percent_average + @flog_average)
6
- url = Gchart.line(
7
- :size => GCHART_GRAPH_SIZE,
8
- :title => URI.escape("Flog: code complexity"),
9
- :data => [@flog_average, @top_five_percent_average],
10
- :stacked => false,
11
- :bar_colors => COLORS[0..1],
12
- :legend => ['average', 'top 5% average'],
13
- :custom => "chdlp=t",
14
- :max_value => @max_value,
15
- :axis_with_labels => 'x,y',
16
- :axis_labels => [@labels.values, @yaxis],
17
- :format => 'file',
18
- :filename => File.join(MetricFu.output_directory, 'flog.png'))
4
+ def title
5
+ "Flog: code complexity"
6
+ end
7
+ def legend
8
+ ['average', 'top 5% average']
9
+ end
10
+ def data
11
+ [@flog_average, @top_five_percent_average]
12
+ end
13
+ def output_filename
14
+ 'flog.png'
15
+ end
16
+ def gchart_line_options
17
+ super.merge({
18
+ :bar_colors => COLORS[0..1],
19
+ :legend => legend,
20
+ :custom => 'chdlp=t',
21
+ :stacked => false,
22
+ })
23
+ end
24
+ def y_axis_scale_argument
25
+ @top_five_percent_average + @flog_average
19
26
  end
20
27
  end
21
28
  end
@@ -6,7 +6,7 @@ module MetricFu
6
6
  # skeleton for producing different types of metrics.
7
7
  #
8
8
  # It drives the production of the metrics through a template
9
- # method - #generate_report(options={}). This method calls
9
+ # method - #generate_result(options={}). This method calls
10
10
  # #emit, #analyze and #to_h in order to produce the metrics.
11
11
  #
12
12
  # To implement a concrete class to generate a metric, therefore,
@@ -30,7 +30,7 @@ module MetricFu
30
30
  # in general setup the directory structure that the MetricFu system
31
31
  # expects.
32
32
  class Generator
33
- attr_reader :report, :template, :options
33
+ attr_reader :result, :template, :options
34
34
 
35
35
  def initialize(options={})
36
36
  @options = options
@@ -40,17 +40,17 @@ module MetricFu
40
40
  end
41
41
 
42
42
  # Creates a new generator and returns the output of the
43
- # #generate_report method. This is the typical way to
44
- # generate a new MetricFu report. For more information see
45
- # the #generate_report instance method.
43
+ # #generate_result method. This is the typical way to
44
+ # generate a new MetricFu result. For more information see
45
+ # the #generate_result instance method.
46
46
  #
47
47
  # @params options Hash
48
48
  # A currently unused hash to configure the Generator
49
49
  #
50
- # @see generate_report
51
- def self.generate_report(options={})
50
+ # @see generate_result
51
+ def self.generate_result(options={})
52
52
  generator = self.new(options)
53
- generator.generate_report
53
+ generator.generate_result
54
54
  end
55
55
 
56
56
  # Provides the unqualified class name of an implemented concrete
@@ -121,7 +121,7 @@ module MetricFu
121
121
  # This template method also calls before_emit, after_emit... etc.
122
122
  # methods to allow extra hooks into the processing methods, and help
123
123
  # to keep the logic of your Generators clean.
124
- def generate_report
124
+ def generate_result
125
125
  mf_debug "Executing #{self.class.to_s.gsub(/.*::/, '')}"
126
126
 
127
127
  %w[emit analyze].each do |meth|
@@ -154,7 +154,7 @@ module MetricFu
154
154
  EOF
155
155
  end
156
156
 
157
- def to_graph #:nodoc:
157
+ def to_h #:nodoc:
158
158
  raise <<-EOF
159
159
  This method must be implemented by a concrete class descending
160
160
  from Generator. See generator class documentation for more
@@ -12,9 +12,9 @@ module MetricFu
12
12
  self.clazz = []
13
13
  end
14
14
 
15
- def add(graph_type, graph_engine)
15
+ def add(graph_type, graph_engine, output_directory = MetricFu.output_directory)
16
16
  grapher_name = graph_type.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + graph_engine.to_s.capitalize + "Grapher"
17
- self.clazz.push MetricFu.const_get(grapher_name).new
17
+ self.clazz.push MetricFu.const_get(grapher_name).new.tap{|g| g.output_directory = output_directory }
18
18
  end
19
19
 
20
20
 
@@ -21,9 +21,9 @@ module MetricFu
21
21
  # remove dependency on statarray
22
22
  # scores.to_statarray.mean
23
23
  score_length = scores.length
24
- sum = 0
25
- sum = scores.inject( nil ) { |sum,x| sum ? sum+x : x }
26
- (sum.to_f / score_length.to_f)
24
+ total = 0
25
+ total= scores.inject( nil ) { |sum,x| sum ? sum+x : x }
26
+ (total.to_f / score_length.to_f)
27
27
  end
28
28
 
29
29
  extend self
@@ -19,11 +19,12 @@ module MetricFu
19
19
  end
20
20
 
21
21
  # TODO simplify calculation
22
+ # DUPLICATES CODE IN ScoringStrategies
22
23
  def get_mean(collection)
23
24
  collection_length = collection.length
24
- sum = 0
25
- sum = collection.inject( nil ) { |sum,x| sum ? sum+x : x }
26
- (sum.to_f / collection_length.to_f)
25
+ total = 0
26
+ total = collection.inject( nil ) { |sum,x| sum ? sum+x : x }
27
+ (total.to_f / collection_length.to_f)
27
28
  end
28
29
  end
29
30
  end
@@ -11,36 +11,44 @@ module MetricFu
11
11
  COMMON_COLUMNS = %w{metric}
12
12
  GRANULARITIES = %w{file_path class_name method_name}
13
13
 
14
- # UNUSED
14
+ # TODO , UNUSED
15
15
  # attr_accessor :table
16
16
 
17
17
  def tool_analyzers
18
18
  MetricFu::Hotspot.analyzers
19
19
  end
20
20
 
21
- def initialize(report_hash)
22
- # we can't depend on the Report
21
+ def initialize(result_hash)
22
+ # we can't depend on the result
23
23
  # returning a parsed yaml file as a hash?
24
- report_hash = YAML::load(report_hash) if report_hash.is_a?(String)
25
- setup(report_hash)
24
+ result_hash = YAML::load(result_hash) if result_hash.is_a?(String)
25
+ setup(result_hash)
26
26
  end
27
27
 
28
- # def worst_items
28
+ # def worst_items; previous method name
29
29
  def hotspots
30
30
  analyzed_problems.worst_items
31
31
  end
32
- # just for testing
32
+
33
33
  def analyzed_problems
34
34
  @analyzed_problems = MetricFu::HotspotAnalyzedProblems.new(@rankings, @analyzer_tables)
35
35
  end
36
+ # just for testing
37
+ # TODO remove the delegators
38
+ # and refactor the tests
36
39
  alias_method :worst_items, :hotspots
37
40
  extend Forwardable
38
41
  def_delegators :@analyzer_tables, :table
39
42
  def_delegators :@analyzed_problems, :problems_with, :location
40
43
  def_delegators :@rankings, :worst_files, :worst_methods, :worst_classes
44
+
41
45
  private
42
46
 
43
- def setup(report_hash)
47
+ # TODO clarify each of these steps in setup
48
+ # extract into its own method
49
+ # remove unnecessary constants,
50
+ # turn into methods
51
+ def setup(result_hash)
44
52
  # TODO There is likely a clash that will happen between
45
53
  # column names eventually. We should probably auto-prefix
46
54
  # them (e.g. "roodi_problem")
@@ -51,16 +59,17 @@ module MetricFu
51
59
  # to ultimately generate the hotspots
52
60
  @analyzer_tables = MetricFu::AnalyzerTables.new(analyzer_columns)
53
61
  tool_analyzers.each do |analyzer|
54
- analyzer.generate_records(report_hash[analyzer.name], @analyzer_tables.table)
62
+ analyzer.generate_records(result_hash[analyzer.name], @analyzer_tables.table)
55
63
  end
56
64
  @analyzer_tables.generate_records
57
65
  @rankings = MetricFu::HotspotRankings.new(@analyzer_tables.tool_tables)
58
66
  @rankings.calculate_scores(tool_analyzers, GRANULARITIES)
59
67
  # just for testing
68
+ # TODO does it not need to return something here?
60
69
  analyzed_problems
61
70
  end
62
71
 
63
- # UNUSED
72
+ # TODO remove, UNUSED
64
73
  # def most_common_column(column_name, size)
65
74
  # #grouping = Ruport::Data::Grouping.new(@table,
66
75
  # # :by => column_name,
@@ -12,7 +12,7 @@ module MetricFu
12
12
  end
13
13
 
14
14
  def emit
15
- @analyzer = MetricFu::HotspotAnalyzer.new(MetricFu.report.report_hash)
15
+ @analyzer = MetricFu::HotspotAnalyzer.new(MetricFu.result.result_hash)
16
16
  end
17
17
 
18
18
  def analyze
@@ -3,60 +3,60 @@
3
3
  <br/>
4
4
 
5
5
  <% if !@hotspots || @hotspots.size == 0 %>
6
- No Hotspots were found.
6
+ No Hotspots were found.
7
7
  <% elsif @hotspots && @hotspots.size > 0 %>
8
8
 
9
- <% granularities = [:files, :classes, :methods] %>
10
- <table>
11
- <tr valign="top">
12
- <% granularities.each do |granularity| %>
13
- <th width='33%'>
14
- <%= granularity.to_s.capitalize %></th>
15
- <% end %>
16
- </tr>
9
+ <% granularities = [:files, :classes, :methods] %>
10
+ <table>
11
+ <tr valign="top">
12
+ <% granularities.each do |granularity| %>
13
+ <th width='33%'>
14
+ <%= granularity.to_s.capitalize %></th>
15
+ <% end %>
16
+ </tr>
17
17
 
18
- <% items = [] %>
19
- <% granularities.each_index do |index| %>
20
- <% granularity = granularities[index] %>
21
- <% items << @hotspots[granularity] %>
22
- <% end %>
18
+ <% items = [] %>
19
+ <% granularities.each_index do |index| %>
20
+ <% granularity = granularities[index] %>
21
+ <% items << @hotspots[granularity] %>
22
+ <% end %>
23
23
 
24
- <% items_length = 0 %>
25
- <% columns = [0, 1, 2] %>
26
- <% while (items_length < items[0].length || items_length < items[1].length || items_length < items[2].length) do %>
27
- <tr valign="top">
28
- <% columns.each do |column| %>
29
- <% item = items[column].length >= items_length ? items[column][items_length] : nil %>
30
- <% if item %>
31
- <td>
32
- <b>
33
- <%= display_location(item[:location], nil) %>
34
- </b>
35
- <% if item[:location].file_path %>
36
- <% file, line = item[:location].file_path.split(/:/) %>
37
- <% if per_file_data[file] %>
38
- <small>&laquo;
39
- <b><a href="<%= file.gsub(%r{/}, '_') %>.html<%= (line.nil? ? '' : "#line#{line}") %>">annotate</a></b>
40
- &raquo;</small>
24
+ <% items_length = 0 %>
25
+ <% columns = [0, 1, 2] %>
26
+ <% while (items_length < items[0].length || items_length < items[1].length || items_length < items[2].length) do %>
27
+ <tr valign="top">
28
+ <% columns.each do |column| %>
29
+ <% item = items[column].length >= items_length ? items[column][items_length] : nil %>
30
+ <% if item %>
31
+ <% location = item[:location] %>
32
+ <% file, line = location.file_name, location.line_number %>
33
+ <td>
34
+ <b>
35
+ <%= display_location(location) %>
36
+ </b>
37
+ <% if file != '' %>
38
+ <% if per_file_data[file] %>
39
+ <small>&laquo;
40
+ <b><a href="<%= file.gsub(%r{/}, '_') %>.html<%= (line.nil? ? '' : "#line#{line}") %>">annotate</a></b>
41
+ &raquo;</small>
42
+ <% end %>
43
+ <% end %>
44
+ <br/><br/>
45
+ <!-- TODO HOTSPOTS for metric fu nice metric_link method -->
46
+ <% item[:details].each do |metric, info| %>
47
+ <%#= metric_link(@stat, metric, h(metric.to_s.capitalize)) + ": " + h(info)%><br/>
48
+ <%= "#{metric.to_s.capitalize}: #{info}" %><br/>
49
+ <% end %>
50
+ </td>
51
+ <% else %>
52
+ <td> &nbsp; </td>
41
53
  <% end %>
42
54
  <% end %>
43
- <br/><br/>
44
- <!-- TODO HOTSPOTS for metric fu nice metric_link method -->
45
- <% item[:details].each do |metric, info| %>
46
- <%#= metric_link(@stat, metric, h(metric.to_s.capitalize)) + ": " + h(info)%><br/>
47
- <%= "#{metric.to_s.capitalize}: #{info}" %><br/>
48
- <% end %>
49
- </td>
50
- <% else %>
51
- <td> &nbsp; </td>
52
- <% end %>
53
- <% end %>
54
- <% items_length += 1 %>
55
+ <% items_length += 1 %>
55
56
  </tr>
56
57
  <% end %>
57
58
 
58
- </table>
59
+ </table>
59
60
  <% end %>
60
61
 
61
-
62
62
  <p>Generated on <%= Time.now.localtime %></p>
@@ -1,15 +1,16 @@
1
1
  MetricFu.metrics_require { 'rails_best_practices/rails_best_practices_grapher' }
2
2
  module MetricFu
3
3
  class RailsBestPracticesBluffGrapher < RailsBestPracticesGrapher
4
- def graph!
5
- content = <<-EOS
6
- #{BLUFF_DEFAULT_OPTIONS}
7
- g.title = 'Rails Best Practices: design problems';
8
- g.data('rails_best_practices', [#{@rails_best_practices_count.join(',')}]);
9
- g.labels = #{MultiJson.dump(@labels)};
10
- g.draw();
11
- EOS
12
- File.open(File.join(MetricFu.output_directory, 'rails_best_practices.js'), 'w') {|f| f << content }
4
+ def title
5
+ 'Rails Best Practices: design problems'
6
+ end
7
+ def data
8
+ [
9
+ ['rails_best_practices', @rails_best_practices_count.join(',')]
10
+ ]
11
+ end
12
+ def output_filename
13
+ 'rails_best_practices.js'
13
14
  end
14
15
  end
15
16
  end
@@ -1,21 +1,27 @@
1
1
  MetricFu.metrics_require { 'rails_best_practices/rails_best_practices_grapher' }
2
2
  module MetricFu
3
3
  class RailsBestPracticesGchartGrapher < RailsBestPracticesGrapher
4
- def graph!
5
- determine_y_axis_scale(@rails_best_practices_count)
6
- url = Gchart.line(
7
- :size => GCHART_GRAPH_SIZE,
8
- :title => URI.escape("Rails Best Practices: design problems"),
9
- :data => self.rails_best_practices_count,
10
- :bar_colors => COLORS[0..1],
11
- :legend => ['Problems'],
12
- :custom => "chdlp=t",
13
- :max_value => @max_value,
14
- :axis_with_labels => 'x,y',
15
- :axis_labels => [@labels.values, @yaxis],
16
- :format => 'file',
17
- :filename => File.join(MetricFu.output_directory, 'rails_best_practices.png')
18
- )
4
+ def title
5
+ "Rails Best Practices: design problems"
6
+ end
7
+ def legend
8
+ ['Problems']
9
+ end
10
+ def data
11
+ self.rails_best_practices_count
12
+ end
13
+ def output_filename
14
+ 'rails_best_practices.png'
15
+ end
16
+ def gchart_line_options
17
+ super.merge({
18
+ :bar_colors => COLORS[0..1],
19
+ :legend => legend,
20
+ :custom => 'chdlp=t',
21
+ })
22
+ end
23
+ def y_axis_scale_argument
24
+ @rails_best_practices_count
19
25
  end
20
26
  end
21
27
  end
@@ -113,7 +113,7 @@ module MetricFu
113
113
  files.each_pair {|fname, content| files[fname] = content.split("\n") }
114
114
  files.each_pair do |fname, content|
115
115
  content.map! do |raw_line|
116
- line = Line.new(raw_line[3..-1], !raw_line.match(/^!!/)).to_h
116
+ Line.new(raw_line[3..-1], !raw_line.match(/^!!/)).to_h
117
117
  end
118
118
  content.reject! {|line| line[:content].to_s == '' }
119
119
  files[fname] = {:lines => content}
@@ -1,15 +1,16 @@
1
1
  MetricFu.metrics_require { 'rcov/rcov_grapher' }
2
2
  module MetricFu
3
3
  class RcovBluffGrapher < RcovGrapher
4
- def graph!
5
- content = <<-EOS
6
- #{BLUFF_DEFAULT_OPTIONS}
7
- g.title = 'Rcov: code coverage';
8
- g.data('rcov', [#{@rcov_percent.join(',')}]);
9
- g.labels = #{MultiJson.dump(@labels)};
10
- g.draw();
11
- EOS
12
- File.open(File.join(MetricFu.output_directory, 'rcov.js'), 'w') {|f| f << content }
4
+ def title
5
+ 'Rcov: code coverage'
6
+ end
7
+ def data
8
+ [
9
+ ['rcov', @rcov_percent.join(',')]
10
+ ]
11
+ end
12
+ def output_filename
13
+ 'rcov.js'
13
14
  end
14
15
  end
15
16
  end