jscruggs-metric_fu 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,8 @@
1
+ === MetricFu 1.0.1 / 2009-5-3
2
+
3
+ * metrics:all task no longer requires a MetricFu::Configuration.run {} if you want to accept the defaults
4
+ * rcov task now reports total coverage percent
5
+
1
6
  === MetricFu 1.0.0 / 2009-4-30
2
7
 
3
8
  * Merged in Grant McInnes' work on creating yaml output for all metrics to aid harvesting by other tools
@@ -116,6 +116,9 @@ module MetricFu
116
116
  to_h()
117
117
  end
118
118
 
119
+ def round_to_tenths(decimal)
120
+ (decimal * 10).round / 10.0
121
+ end
119
122
 
120
123
  def emit #:nodoc:
121
124
  raise <<-EOF
@@ -61,10 +61,7 @@ module MetricFu
61
61
  :average => round_to_tenths(total_flog_score/number_of_methods),
62
62
  :pages => sorted_pages.map {|page| page.to_h}}}
63
63
  end
64
-
65
- def round_to_tenths(decimal)
66
- (decimal * 10).round / 10.0
67
- end
64
+
68
65
  def flog_results
69
66
  Dir.glob("#{metric_directory}/**/*.txt")
70
67
  end
@@ -57,10 +57,12 @@ module MetricFu
57
57
  end
58
58
 
59
59
  # Calculate the percentage of lines run in each file
60
+ @global_total_lines = 0
61
+ @global_total_lines_run = 0
60
62
  files.each_pair do |fname, content|
61
63
  lines = content[:lines]
62
- lines_run = lines.find_all {|line| line[:was_run] == true }.length
63
- total_lines = lines.length
64
+ @global_total_lines_run += lines_run = lines.find_all {|line| line[:was_run] == true }.length
65
+ @global_total_lines += total_lines = lines.length
64
66
  percent_run = ((lines_run.to_f / total_lines.to_f) * 100).round
65
67
  files[fname][:percent_run] = percent_run
66
68
  end
@@ -68,7 +70,8 @@ module MetricFu
68
70
  end
69
71
 
70
72
  def to_h
71
- {:rcov => @rcov}
73
+ global_percent_run = ((@global_total_lines_run.to_f / @global_total_lines.to_f) * 100)
74
+ {:rcov => @rcov.merge({:global_percent_run => round_to_tenths(global_percent_run) })}
72
75
  end
73
76
  end
74
77
  end
@@ -9,7 +9,7 @@
9
9
  <body>
10
10
  <h1>Rcov Code Coverage Results</h1>
11
11
  <p>C0 code coverage information.</p>
12
-
12
+ <p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p>
13
13
  <table>
14
14
  <tr>
15
15
  <th>File Path</th>
data/tasks/metric_fu.rake CHANGED
@@ -2,6 +2,7 @@ require 'rake'
2
2
  namespace :metrics do
3
3
  desc "Generate all metrics reports"
4
4
  task :all do
5
+ MetricFu::Configuration.run {}
5
6
  MetricFu.metrics.each {|metric| MetricFu.report.add(metric) }
6
7
  MetricFu.report.save_output(MetricFu.report.to_yaml,
7
8
  MetricFu.base_directory,
@@ -11,4 +12,4 @@ namespace :metrics do
11
12
  MetricFu.report.show_in_browser(MetricFu.output_directory)
12
13
  end
13
14
  end
14
- end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jscruggs-metric_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Scruggs