jscruggs-metric_fu 0.8.9 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +7 -0
- data/README +9 -2
- data/lib/metric_fu/base.rb +4 -3
- data/lib/tasks/coverage.rake +1 -1
- data/lib/tasks/railroad.rake +10 -7
- data/lib/templates/flog.html.erb +7 -0
- metadata +1 -1
data/HISTORY
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== MetricFu 0.9.0 / 2009-1-25
|
2
|
+
|
3
|
+
* Adding line numbers to the views so that people viewing it on cc.rb can figure out where the problems are
|
4
|
+
* Merging in changes from Jay Zeschin having to do with the railroad task -- I still have no idea how to use it (lemme know if you figure it out)
|
5
|
+
* Added totals to Flog results
|
6
|
+
* Moved rcov options to configuration
|
7
|
+
|
1
8
|
=== MetricFu 0.8.9 / 2009-1-20
|
2
9
|
|
3
10
|
* Thanks to Andre Arko and Petrik de Heus for adding the following features:
|
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.
|
1
|
+
Version 0.9.0
|
2
2
|
http://github.com/jscruggs/metric_fu
|
3
3
|
|
4
4
|
Metric_fu began its life as a plugin for Rails that generated code metrics reports. As of version 0.7.0, metric_fu is a gem owing to the excellent work done by Sean Soper.
|
@@ -12,7 +12,7 @@ Then in your Rakefile:
|
|
12
12
|
require 'metric_fu'
|
13
13
|
|
14
14
|
If you like to vendor gems, you can unpack metric_fu into vendor/gems and require it like so:
|
15
|
-
require 'vendor/gems/jscruggs-metric_fu-0.
|
15
|
+
require 'vendor/gems/jscruggs-metric_fu-0.9.0/lib/metric_fu'
|
16
16
|
|
17
17
|
then you don't have to install it on every box you run it on.
|
18
18
|
|
@@ -75,6 +75,13 @@ You can configure the coverage test files pattern:
|
|
75
75
|
|
76
76
|
The default value is ['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
77
77
|
|
78
|
+
You may also configure Rcov options:
|
79
|
+
config.coverage = { :test_files => ['test/**/*_test.rb'],
|
80
|
+
:rcov_opts => ["--exclude /gems/,/Library/"] }
|
81
|
+
|
82
|
+
The default value is { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'],
|
83
|
+
:rcov_opts => ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/,spec"] }
|
84
|
+
|
78
85
|
|
79
86
|
****Notes on metrics:saikuro****
|
80
87
|
|
data/lib/metric_fu/base.rb
CHANGED
@@ -70,9 +70,9 @@ module MetricFu
|
|
70
70
|
def link_to_filename(name, line = nil)
|
71
71
|
filename = File.expand_path(name)
|
72
72
|
if PLATFORM['darwin']
|
73
|
-
%{<a href="txmt://open/?url=file://#{filename}&line=#{line}">#{name}</a>}
|
73
|
+
%{<a href="txmt://open/?url=file://#{filename}&line=#{line}">#{name}:#{line}</a>}
|
74
74
|
else
|
75
|
-
%{<a href="file://#{filename}">#{name}</a>}
|
75
|
+
%{<a href="file://#{filename}">#{name}:#{line}</a>}
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -142,7 +142,8 @@ module MetricFu
|
|
142
142
|
|
143
143
|
def reset
|
144
144
|
@churn = {}
|
145
|
-
@coverage = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
145
|
+
@coverage = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'],
|
146
|
+
:rcov_opts => ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/,spec"] }
|
146
147
|
@flay = { :dirs_to_flay => CODE_DIRS}
|
147
148
|
@flog = { :dirs_to_flog => CODE_DIRS}
|
148
149
|
@reek = { :dirs_to_reek => CODE_DIRS}
|
data/lib/tasks/coverage.rake
CHANGED
@@ -21,7 +21,7 @@ begin
|
|
21
21
|
Rcov::RcovTask.new(:do => :clean) do |t|
|
22
22
|
FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
|
23
23
|
t.test_files = FileList[*MetricFu.coverage[:test_files]]
|
24
|
-
t.rcov_opts = [
|
24
|
+
t.rcov_opts = MetricFu.coverage[:rcov_opts]
|
25
25
|
t.output_dir = COVERAGE_DIR
|
26
26
|
# this line is a fix for Rails 2.1 relative loading issues
|
27
27
|
t.libs << 'test'
|
data/lib/tasks/railroad.rake
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
namespace :metrics do
|
2
2
|
|
3
3
|
RAILROAD_DIR = File.join(MetricFu::BASE_DIRECTORY, 'railroad')
|
4
|
-
|
4
|
+
RAILROAD_FILE = File.join(RAILROAD_DIR, 'index.html')
|
5
5
|
|
6
6
|
task :railroad => ['railroad:all'] do
|
7
7
|
end
|
@@ -15,20 +15,23 @@ namespace :metrics do
|
|
15
15
|
|
16
16
|
desc "Create a railroad models report"
|
17
17
|
task :models do
|
18
|
-
mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
19
|
-
`railroad -M -a -m -l -v | neato -Tpng > #{File.join(
|
18
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
19
|
+
`railroad -M -a -m -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'model-diagram.png')}`
|
20
|
+
#`echo "<a href=\"railroad/models.png\">Model diagram</a><br />" >> #{RAILROAD_FILE}`
|
20
21
|
end
|
21
22
|
|
22
23
|
desc "Create a railroad controllers report"
|
23
24
|
task :controllers do
|
24
|
-
mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
25
|
-
`railroad -C -l -v | neato -Tpng > #{File.join(
|
25
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
26
|
+
`railroad -C -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'controller-diagram.png')}`
|
27
|
+
#`echo "<a href=\"railroad/controllers.png\">Controller diagram</a><br />" >> #{RAILROAD_FILE}`
|
26
28
|
end
|
27
29
|
|
28
30
|
desc "Create a railroad acts_as_state_machine report"
|
29
31
|
task :aasm do
|
30
|
-
mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
31
|
-
`railroad -A -l -v | neato -Tpng > #{File.join(
|
32
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
33
|
+
`railroad -A -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'aasm-diagram.png')}`
|
34
|
+
#`echo "<a href=\"railroad/aasm.png\">State machine diagram</a><br />" >> #{RAILROAD_FILE}`
|
32
35
|
end
|
33
36
|
|
34
37
|
end
|
data/lib/templates/flog.html.erb
CHANGED
@@ -25,6 +25,13 @@
|
|
25
25
|
<td class='score'><%= sprintf(SCORE_FORMAT, page.highest_score) %></td>
|
26
26
|
</tr>
|
27
27
|
<% end %>
|
28
|
+
<tr>
|
29
|
+
<td><strong>Totals</strong></td>
|
30
|
+
<td class='score'><strong><%= sprintf(SCORE_FORMAT, pages.inject(0){|sum, page| sum + page.score }) %></strong></td>
|
31
|
+
<td class='score'><strong><%= pages.inject(0){|sum, page| sum + page.scanned_methods.length } %></strong></td>
|
32
|
+
<td class='score'></td>
|
33
|
+
<td class='score'></td>
|
34
|
+
</tr>
|
28
35
|
</table>
|
29
36
|
<p>Generated on <%= Time.now.localtime %></p>
|
30
37
|
</body>
|