jscruggs-metric_fu 1.0.0 → 1.0.1
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.
- data/HISTORY +5 -0
- data/lib/base/generator.rb +3 -0
- data/lib/generators/flog.rb +1 -4
- data/lib/generators/rcov.rb +6 -3
- data/lib/templates/standard/rcov.html.erb +1 -1
- data/tasks/metric_fu.rake +2 -1
- metadata +1 -1
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
|
data/lib/base/generator.rb
CHANGED
data/lib/generators/flog.rb
CHANGED
@@ -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
|
data/lib/generators/rcov.rb
CHANGED
@@ -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
|
-
|
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
|
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
|