p8-metric_fu 0.8.4.14 → 0.8.4.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README +41 -17
- data/lib/metric_fu/base.rb +34 -24
- data/lib/metric_fu/churn.rb +1 -1
- data/lib/metric_fu/flay.rb +1 -1
- data/lib/metric_fu/reek.rb +18 -0
- data/lib/metric_fu/roodi.rb +18 -0
- data/lib/tasks/coverage.rake +1 -1
- data/lib/tasks/flog.rake +1 -1
- data/lib/tasks/reek.rake +2 -10
- data/lib/tasks/roodi.rake +1 -8
- data/lib/templates/reek.css +38 -0
- data/lib/templates/reek.html.erb +22 -0
- data/spec/config_spec.rb +49 -28
- data/spec/spec_helper.rb +1 -0
- metadata +5 -1
data/README
CHANGED
@@ -23,13 +23,13 @@ You must have Rcov and Flog installed to get coverage and flog reports. Metric_
|
|
23
23
|
****Usage****
|
24
24
|
|
25
25
|
Out of the box metrics provides these tasks:
|
26
|
-
rake metrics:all
|
27
|
-
rake metrics:all_with_migrate # Useful for continuous integration
|
26
|
+
rake metrics:all # Generate coverage, cyclomatic complexity, flog, flay, railroad and churn reports
|
28
27
|
rake metrics:churn # Which files change the most
|
29
28
|
rake metrics:coverage # Generate and open coverage report
|
30
29
|
rake metrics:coverage:clean # Delete aggregate coverage data.
|
31
30
|
rake metrics:coverage:clobber_do # Remove rcov products for do
|
32
31
|
rake metrics:coverage:do # RCov task to generate report
|
32
|
+
rake metrics:flay # Generate code duplication report with flay
|
33
33
|
rake metrics:flog:all # Generate and open flog report
|
34
34
|
rake metrics:flog:clean # Delete aggregate flog data.
|
35
35
|
rake metrics:flog:controllers # Flog code in app/controllers
|
@@ -37,8 +37,12 @@ rake metrics:flog:custom # Generate a flog report from specified direct
|
|
37
37
|
rake metrics:flog:helpers # Flog code in app/helpers
|
38
38
|
rake metrics:flog:lib # Flog code in lib
|
39
39
|
rake metrics:flog:models # Flog code in app/models
|
40
|
+
rake metrics:reek # A code smell report using Reek
|
40
41
|
rake metrics:saikuro # A cyclomatic complexity report using Saikuro
|
41
|
-
|
42
|
+
|
43
|
+
Rails projects also have the following tasks:
|
44
|
+
|
45
|
+
rake metrics:stats # A stats report
|
42
46
|
|
43
47
|
See below for more detail on the individual tasks. It's recommended to use CruiseControl.rb to set up a metrics build. See the CruiseControl.rb online docs for more info on how to set up cc.rb and, once you've got that figured out, change the cruise_config.rb file inside your project to have these lines:
|
44
48
|
|
@@ -47,6 +51,7 @@ project.scheduler.polling_interval = 24.hours
|
|
47
51
|
|
48
52
|
Which will check for updates every 24 hours and run all the metrics rake tasks (migrating your test db first). The output will be visible from an individual build's detail page.
|
49
53
|
|
54
|
+
|
50
55
|
****Notes on configuration****
|
51
56
|
|
52
57
|
Metric_fu can be customized to your liking by adding the following to your Rakefile
|
@@ -54,19 +59,19 @@ Metric_fu can be customized to your liking by adding the following to your Rakef
|
|
54
59
|
MetricFu::Configuration.run do |config|
|
55
60
|
#define which metrics you want to use
|
56
61
|
config.metrics = [:coverage, :flog]
|
57
|
-
config.
|
58
|
-
config.
|
59
|
-
config.
|
60
|
-
config.
|
61
|
-
config.
|
62
|
-
|
62
|
+
config.churn = { :start_date => lambda{ 3.months.ago } }
|
63
|
+
config.coverage = { :test_files => ['test/**/test_*.rb'] }
|
64
|
+
config.flog = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
|
65
|
+
config.flay = { :dirs_to_flay => ['cms/app', 'cms/lib'] }
|
66
|
+
config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
63
67
|
end
|
64
68
|
|
69
|
+
|
65
70
|
****Notes on metrics:coverage****
|
66
71
|
|
67
72
|
When creating a coverage report, metric_fu runs all the tests in the test folder and specs in spec folder using Rcov.
|
68
73
|
You can configure the coverage test files pattern:
|
69
|
-
config.
|
74
|
+
config.coverage[:test_files] = ['test/**/test_*.rb']
|
70
75
|
|
71
76
|
The default value is ['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
72
77
|
|
@@ -75,13 +80,13 @@ The default value is ['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
|
75
80
|
|
76
81
|
Saikuro is bundled with metric_fu so you don't have to install it. Look at the SAIKURO_README (or the internet) for more documentation on Saikuro. If you wish to change the options Saikuro is run with, then set this constant in your configuration:
|
77
82
|
|
78
|
-
config.
|
83
|
+
config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
79
84
|
|
80
|
-
|
85
|
+
config.saikuro is a hash that gets merged with the default options hash. The above example will set the warn_cyclo to 3 and the error_cyclo to 4 (which is way too low -- it's just an example) instructing Saikuro to flag methods with a higher cyclomatic complexity in it's report.
|
81
86
|
|
82
87
|
If you want to have Saikuro look at multiple folders you can put something like this in your configuration:
|
83
88
|
|
84
|
-
config.
|
89
|
+
config.saikuro = {"--input_directory" => '"cms/app | cms/lib"'}
|
85
90
|
|
86
91
|
|
87
92
|
****Notes on metrics:flay****
|
@@ -89,7 +94,9 @@ If you want to have Saikuro look at multiple folders you can put something like
|
|
89
94
|
Flay analyzes ruby code for structural similarities.
|
90
95
|
You can configure which directories need to be flayed.
|
91
96
|
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
|
92
|
-
|
97
|
+
|
98
|
+
config.flay[:dirs_to_flay] = ['cms/app', 'cms/lib']
|
99
|
+
|
93
100
|
|
94
101
|
****Notes on metrics:flog****
|
95
102
|
|
@@ -97,8 +104,25 @@ Flog is another way of measuring complexity (or tortured code as the Flog author
|
|
97
104
|
'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your configuration).
|
98
105
|
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
|
99
106
|
|
100
|
-
config.
|
107
|
+
config.flog[:dirs_to_flog] = ['cms/app', 'cms/lib']
|
108
|
+
|
109
|
+
|
110
|
+
****Notes on metrics:reek****
|
111
|
+
|
112
|
+
Reek detects common smells in ruby code.
|
113
|
+
You can configure which directories need to be checked.
|
114
|
+
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
|
115
|
+
|
116
|
+
config.reek[:dirs_to_reek] = ['cms/app', 'cms/lib']
|
117
|
+
|
118
|
+
|
119
|
+
****Notes on metrics:roodi****
|
120
|
+
|
121
|
+
Roodi parses your Ruby code and warns you about design issues you have based on the checks that is has configured.
|
122
|
+
You can configure which directories need to be checked.
|
123
|
+
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
|
101
124
|
|
125
|
+
config.roodi[:dirs_to_roodi] = ['cms/app', 'cms/lib']
|
102
126
|
|
103
127
|
****Notes on metrics:stats****
|
104
128
|
|
@@ -109,13 +133,13 @@ This is just 'rake stats' for Rails put into a file. On my projects I like to b
|
|
109
133
|
|
110
134
|
Files that change a lot in your project may be bad a sign. This task uses "svn log" to identify those files and put them in a report. The default is to start counting changes from the beginning of your project, which might be too far back so you can change like so:
|
111
135
|
|
112
|
-
config.
|
136
|
+
config.churn = { :start_date => lambda{ 3.months.ago } }
|
113
137
|
|
114
138
|
The Proc is there because '3.months.ago' only works when after the Rails Environment is loaded (and Rails extends Fixnum) which I didn't want to do every time you run a rake task.
|
115
139
|
|
116
140
|
You can also change the minimum churn count like so:
|
117
141
|
|
118
|
-
config.
|
142
|
+
config.churn = { :minimum_churn_count => 3 }
|
119
143
|
|
120
144
|
|
121
145
|
****Thanks****
|
data/lib/metric_fu/base.rb
CHANGED
@@ -10,7 +10,7 @@ module MetricFu
|
|
10
10
|
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :railroad, :reek, :roodi, :stats, :saikuro ]
|
11
11
|
else
|
12
12
|
CODE_DIRS = ['lib']
|
13
|
-
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :saikuro ]
|
13
|
+
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :reek, :roodi, :saikuro ]
|
14
14
|
end
|
15
15
|
|
16
16
|
module Base
|
@@ -82,20 +82,20 @@ module MetricFu
|
|
82
82
|
@@configuration ||= Configuration.new
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
86
|
-
configuration.
|
85
|
+
def churn
|
86
|
+
configuration.churn
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
90
|
-
configuration.
|
89
|
+
def coverage
|
90
|
+
configuration.coverage
|
91
91
|
end
|
92
92
|
|
93
|
-
def
|
94
|
-
configuration.
|
93
|
+
def flay
|
94
|
+
configuration.flay
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
98
|
-
configuration.
|
97
|
+
def flog
|
98
|
+
configuration.flog
|
99
99
|
end
|
100
100
|
|
101
101
|
def metrics
|
@@ -106,18 +106,26 @@ module MetricFu
|
|
106
106
|
PLATFORM['darwin'] && !ENV['CC_BUILD_ARTIFACTS']
|
107
107
|
end
|
108
108
|
|
109
|
-
def
|
110
|
-
configuration.
|
109
|
+
def saikuro
|
110
|
+
configuration.saikuro
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
|
+
def reek
|
114
|
+
configuration.reek
|
115
|
+
end
|
116
|
+
|
117
|
+
def roodi
|
118
|
+
configuration.roodi
|
119
|
+
end
|
120
|
+
|
113
121
|
end
|
114
122
|
|
115
123
|
class Configuration
|
116
|
-
attr_accessor :
|
124
|
+
attr_accessor :churn, :coverage, :flay, :flog, :metrics, :reek, :roodi, :saikuro
|
117
125
|
def initialize
|
118
|
-
raise "Use config.
|
119
|
-
raise "Use config.
|
120
|
-
raise "Use config.
|
126
|
+
raise "Use config.churn instead of MetricFu::CHURN_OPTIONS" if defined? ::MetricFu::CHURN_OPTIONS
|
127
|
+
raise "Use config.flog[:dirs_to_flog] instead of MetricFu::DIRECTORIES_TO_FLOG" if defined? ::MetricFu::DIRECTORIES_TO_FLOG
|
128
|
+
raise "Use config.saikuro instead of MetricFu::SAIKURO_OPTIONS" if defined? ::MetricFu::SAIKURO_OPTIONS
|
121
129
|
reset
|
122
130
|
end
|
123
131
|
|
@@ -126,17 +134,19 @@ module MetricFu
|
|
126
134
|
end
|
127
135
|
|
128
136
|
def reset
|
129
|
-
@
|
130
|
-
@
|
131
|
-
@
|
132
|
-
@
|
137
|
+
@churn = {}
|
138
|
+
@coverage = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'] }
|
139
|
+
@flay = { :dirs_to_flay => CODE_DIRS}
|
140
|
+
@flog = { :dirs_to_flog => CODE_DIRS}
|
141
|
+
@reek = { :dirs_to_reek => CODE_DIRS}
|
142
|
+
@roodi = { :dirs_to_roodi => CODE_DIRS}
|
133
143
|
@metrics = DEFAULT_METRICS
|
134
|
-
@
|
144
|
+
@saikuro = {}
|
135
145
|
end
|
136
146
|
|
137
|
-
def
|
138
|
-
raise "
|
139
|
-
@
|
147
|
+
def saikuro=(options)
|
148
|
+
raise "saikuro need to be a Hash" unless options.is_a?(Hash)
|
149
|
+
@saikuro = options
|
140
150
|
end
|
141
151
|
end
|
142
152
|
end
|
data/lib/metric_fu/churn.rb
CHANGED
@@ -2,7 +2,7 @@ module MetricFu
|
|
2
2
|
CHURN_DIR = File.join(MetricFu::BASE_DIRECTORY, 'churn')
|
3
3
|
|
4
4
|
def self.generate_churn_report
|
5
|
-
MetricFu::Churn.generate_report(CHURN_DIR, MetricFu.
|
5
|
+
MetricFu::Churn.generate_report(CHURN_DIR, MetricFu.churn )
|
6
6
|
system("open #{CHURN_DIR}/index.html") if open_in_browser?
|
7
7
|
end
|
8
8
|
|
data/lib/metric_fu/flay.rb
CHANGED
@@ -9,7 +9,7 @@ module MetricFu
|
|
9
9
|
class Flay < Base::Generator
|
10
10
|
|
11
11
|
def analyze
|
12
|
-
files_to_flay = MetricFu.
|
12
|
+
files_to_flay = MetricFu.flay[:dirs_to_flay].map{|dir| Dir[File.join(dir, "**/*.rb")] }
|
13
13
|
output = `flay #{files_to_flay.join(" ")}`
|
14
14
|
@matches = output.chomp.split("\n\n").map{|m| m.split("\n ") }
|
15
15
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MetricFu
|
2
|
+
REEK_DIR = File.join(MetricFu::BASE_DIRECTORY, 'reek')
|
3
|
+
|
4
|
+
def self.generate_reek_report
|
5
|
+
MetricFu::Reek.generate_report(REEK_DIR)
|
6
|
+
system("open #{REEK_DIR}/index.html") if open_in_browser?
|
7
|
+
end
|
8
|
+
|
9
|
+
class Reek < Base::Generator
|
10
|
+
|
11
|
+
def analyze
|
12
|
+
files_to_reek = MetricFu.reek[:dirs_to_reek].map{|dir| Dir[File.join(dir, "**/*.rb")] }
|
13
|
+
output = `reek #{files_to_reek.join(" ")}`
|
14
|
+
@matches = output.chomp.split("\n\n").map{|m| m.split("\n") }
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MetricFu
|
2
|
+
ROODI_DIR = File.join(MetricFu::BASE_DIRECTORY, 'roodi')
|
3
|
+
|
4
|
+
def self.generate_roodi_report
|
5
|
+
MetricFu::Roodi.generate_report(ROODI_DIR)
|
6
|
+
system("open #{ROODI_DIR}/index.html") if open_in_browser?
|
7
|
+
end
|
8
|
+
|
9
|
+
class Roodi < Base::Generator
|
10
|
+
|
11
|
+
def analyze
|
12
|
+
files_to_analyze = MetricFu.roodi[:dirs_to_roodi].map{|dir| Dir[File.join(dir, "**/*.rb")] }
|
13
|
+
output = `roodi #{files_to_analyze.join(" ")}`
|
14
|
+
@matches = output.chomp.split("\n").map{|m| m.split(" - ") }
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/tasks/coverage.rake
CHANGED
@@ -20,7 +20,7 @@ begin
|
|
20
20
|
desc "RCov task to generate report"
|
21
21
|
Rcov::RcovTask.new(:do => :clean) do |t|
|
22
22
|
FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
|
23
|
-
t.test_files = FileList[*MetricFu.
|
23
|
+
t.test_files = FileList[*MetricFu.coverage[:test_files]]
|
24
24
|
t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
|
25
25
|
t.output_dir = COVERAGE_DIR
|
26
26
|
# this line is a fix for Rails 2.1 relative loading issues
|
data/lib/tasks/flog.rake
CHANGED
@@ -39,7 +39,7 @@ begin
|
|
39
39
|
|
40
40
|
desc "Generate a flog report from specified directories"
|
41
41
|
task :custom do
|
42
|
-
MetricFu::
|
42
|
+
MetricFu::flog[:dirs_to_flog].each { |directory| flog(directory, directory) }
|
43
43
|
MetricFu.generate_flog_report
|
44
44
|
end
|
45
45
|
|
data/lib/tasks/reek.rake
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
namespace :metrics do
|
2
|
-
|
3
|
-
REEK_DIR = File.join(MetricFu::BASE_DIRECTORY, 'reek')
|
4
|
-
REEK_FILE = File.join(REEK_DIR, 'index.html')
|
5
|
-
|
6
|
-
desc "A code smell report using Reek"
|
2
|
+
desc "A code smell report using Reek"
|
7
3
|
task :reek do
|
8
|
-
|
9
|
-
`echo '<pre>' > #{REEK_FILE}`
|
10
|
-
`reek #{RAILS_ROOT}/test/**/*.rb #{RAILS_ROOT}/app/**/*.rb >> #{REEK_FILE}`
|
11
|
-
`echo '</pre>' >> #{REEK_FILE}`
|
12
|
-
system("open #{REEK_FILE}") if MetricFu.open_in_browser?
|
4
|
+
MetricFu.generate_reek_report
|
13
5
|
end
|
14
6
|
end
|
data/lib/tasks/roodi.rake
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
namespace :metrics do
|
2
2
|
|
3
|
-
ROODI_DIR = File.join(MetricFu::BASE_DIRECTORY, 'roodi')
|
4
|
-
ROODI_FILE = File.join(ROODI_DIR, 'index.html')
|
5
|
-
|
6
3
|
desc "A Ruby coding standards report using Roodi"
|
7
4
|
task :roodi do
|
8
|
-
|
9
|
-
`echo '<pre>' > #{ROODI_FILE}`
|
10
|
-
`roodi #{RAILS_ROOT}/lib/**/*.rb #{RAILS_ROOT}/app/**/*.rb >> #{ROODI_FILE}`
|
11
|
-
`echo '</pre>' >> #{ROODI_FILE}`
|
12
|
-
system("open #{ROODI_FILE}") if MetricFu.open_in_browser?
|
5
|
+
MetricFu.generate_roodi_report
|
13
6
|
end
|
14
7
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
body {
|
2
|
+
background-color: rgb(240, 240, 245);
|
3
|
+
font-family: verdana, arial, helvetica;
|
4
|
+
}
|
5
|
+
|
6
|
+
table {
|
7
|
+
border-collapse: collapse;
|
8
|
+
}
|
9
|
+
|
10
|
+
table.report {
|
11
|
+
width: 100%;
|
12
|
+
}
|
13
|
+
|
14
|
+
table th {
|
15
|
+
text-align: center;
|
16
|
+
}
|
17
|
+
|
18
|
+
table td.score {
|
19
|
+
text-align: right;
|
20
|
+
}
|
21
|
+
|
22
|
+
table th {
|
23
|
+
background: #dcecff;
|
24
|
+
border: #d0d0d0 1px solid;
|
25
|
+
font-weight: bold;
|
26
|
+
}
|
27
|
+
|
28
|
+
table td {
|
29
|
+
border: #d0d0d0 1px solid;
|
30
|
+
}
|
31
|
+
|
32
|
+
table tr.light {
|
33
|
+
background-color: rgb(240, 240, 245);
|
34
|
+
}
|
35
|
+
|
36
|
+
table tr.dark {
|
37
|
+
background-color: rgb(230, 230, 235);
|
38
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Reek Results</title>
|
4
|
+
<style>
|
5
|
+
<%= inline_css("#{template_name}.css") %>
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<h1>Reek Results</h1>
|
11
|
+
<table width="80%" border="1">
|
12
|
+
<% @matches.each do |match| %>
|
13
|
+
<tr><td><%= match.first %></td>
|
14
|
+
<td>
|
15
|
+
<% match[1..-1].each do |line| %>
|
16
|
+
<%= line %><br>
|
17
|
+
<% end %>
|
18
|
+
</td></tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
</body>
|
22
|
+
</html>
|
data/spec/config_spec.rb
CHANGED
@@ -9,15 +9,17 @@ describe MetricFu::Configuration do
|
|
9
9
|
end
|
10
10
|
describe "open_in_browser" do
|
11
11
|
it "should return false if running in cruise" do
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
unless ENV['CC_BUILD_ARTIFACTS']
|
13
|
+
MetricFu.open_in_browser?.should == !!PLATFORM['darwin']
|
14
|
+
ENV['CC_BUILD_ARTIFACTS'] = ''
|
15
|
+
MetricFu.open_in_browser?.should == false
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
20
|
describe "metrics" do
|
19
21
|
it "should be configurable" do
|
20
|
-
MetricFu.metrics.should == [:coverage, :churn, :flog, :flay, :saikuro]
|
22
|
+
MetricFu.metrics.should == [:coverage, :churn, :flog, :flay, :reek, :roodi, :saikuro]
|
21
23
|
MetricFu::Configuration.run do |config|
|
22
24
|
config.metrics = [:coverage, :flog]
|
23
25
|
end
|
@@ -25,65 +27,84 @@ describe MetricFu::Configuration do
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
describe "
|
30
|
+
describe "churn" do
|
29
31
|
it "should be configurable" do
|
30
32
|
now = Time.now
|
31
|
-
MetricFu.
|
33
|
+
MetricFu.churn.should == {}
|
32
34
|
MetricFu::Configuration.run do |config|
|
33
|
-
config.
|
35
|
+
config.churn[:start_date] = now
|
34
36
|
end
|
35
|
-
MetricFu.
|
37
|
+
MetricFu.churn.should == {:start_date => now }
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
|
-
describe "
|
41
|
+
describe "coverage" do
|
40
42
|
it "should be configurable" do
|
41
|
-
MetricFu.
|
43
|
+
MetricFu.coverage[:test_files].should == ['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
42
44
|
MetricFu::Configuration.run do |config|
|
43
|
-
config.
|
45
|
+
config.coverage[:test_files] = ['test/**/test_*.rb']
|
44
46
|
end
|
45
|
-
MetricFu.
|
47
|
+
MetricFu.coverage[:test_files].should == ['test/**/test_*.rb']
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
|
-
describe "
|
51
|
+
describe "flay" do
|
50
52
|
it "should be configurable" do
|
51
53
|
now = Time.now
|
52
|
-
MetricFu.
|
54
|
+
MetricFu.flay.should == { :dirs_to_flay => ['lib'] }
|
53
55
|
MetricFu::Configuration.run do |config|
|
54
|
-
config.
|
56
|
+
config.flay[:dirs_to_flay] = ['cms/app', 'cms/lib']
|
55
57
|
end
|
56
|
-
MetricFu.
|
58
|
+
MetricFu.flay.should == { :dirs_to_flay => ['cms/app', 'cms/lib'] }
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
describe "
|
62
|
+
describe "flog" do
|
61
63
|
it "should be configurable" do
|
62
|
-
|
63
|
-
MetricFu.flog_options.should == { :dirs_to_flog => ['lib'] }
|
64
|
+
MetricFu.flog.should == { :dirs_to_flog => ['lib'] }
|
64
65
|
MetricFu::Configuration.run do |config|
|
65
|
-
config.
|
66
|
+
config.flog[:dirs_to_flog] = ['cms/app', 'cms/lib']
|
66
67
|
end
|
67
|
-
MetricFu.
|
68
|
+
MetricFu.flog.should == { :dirs_to_flog => ['cms/app', 'cms/lib'] }
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
|
-
describe "
|
72
|
+
describe "saikuro" do
|
72
73
|
it "should be configurable" do
|
73
|
-
MetricFu.
|
74
|
+
MetricFu.saikuro.should == {}
|
74
75
|
MetricFu::Configuration.run do |config|
|
75
|
-
config.
|
76
|
+
config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
76
77
|
end
|
77
|
-
MetricFu.
|
78
|
+
MetricFu.saikuro.should == { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
78
79
|
end
|
79
80
|
|
80
81
|
it "should only accept a Hash" do
|
81
|
-
MetricFu.
|
82
|
+
MetricFu.saikuro.should == {}
|
82
83
|
lambda {
|
83
84
|
MetricFu::Configuration.run do |config|
|
84
|
-
config.
|
85
|
+
config.saikuro = ''
|
85
86
|
end
|
86
87
|
}.should raise_error
|
87
88
|
end
|
88
|
-
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "reek" do
|
92
|
+
it "should be configurable" do
|
93
|
+
MetricFu.reek.should == { :dirs_to_reek => ['lib'] }
|
94
|
+
MetricFu::Configuration.run do |config|
|
95
|
+
config.reek[:dirs_to_reek] = ['cms/app', 'cms/lib']
|
96
|
+
end
|
97
|
+
MetricFu.reek.should == { :dirs_to_reek => ['cms/app', 'cms/lib'] }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "roodi" do
|
102
|
+
it "should be configurable" do
|
103
|
+
MetricFu.roodi.should == { :dirs_to_roodi => ['lib'] }
|
104
|
+
MetricFu::Configuration.run do |config|
|
105
|
+
config.roodi[:dirs_to_roodi] = ['cms/app', 'cms/lib']
|
106
|
+
end
|
107
|
+
MetricFu.roodi.should == { :dirs_to_roodi => ['cms/app', 'cms/lib'] }
|
108
|
+
end
|
109
|
+
end
|
89
110
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,4 +7,5 @@ require File.join(File.dirname(__FILE__), '/../lib/metric_fu/flay')
|
|
7
7
|
require File.join(File.dirname(__FILE__), '/../lib/metric_fu/flog')
|
8
8
|
require File.join(File.dirname(__FILE__), '/../lib/metric_fu/md5_tracker')
|
9
9
|
require File.join(File.dirname(__FILE__), '/../lib/metric_fu/churn')
|
10
|
+
require File.join(File.dirname(__FILE__), '/../lib/metric_fu/reek')
|
10
11
|
include MetricFu
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: p8-metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.4.
|
4
|
+
version: 0.8.4.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Scruggs
|
@@ -89,6 +89,8 @@ files:
|
|
89
89
|
- lib/metric_fu/churn.rb
|
90
90
|
- lib/metric_fu/flay.rb
|
91
91
|
- lib/metric_fu/flog.rb
|
92
|
+
- lib/metric_fu/reek.rb
|
93
|
+
- lib/metric_fu/roodi.rb
|
92
94
|
- lib/metric_fu/md5_tracker.rb
|
93
95
|
- lib/metric_fu/saikuro/saikuro.rb
|
94
96
|
- lib/metric_fu.rb
|
@@ -110,6 +112,8 @@ files:
|
|
110
112
|
- lib/templates/flog.css
|
111
113
|
- lib/templates/flog.html.erb
|
112
114
|
- lib/templates/flog_page.html.erb
|
115
|
+
- lib/templates/reek.css
|
116
|
+
- lib/templates/reek.html.erb
|
113
117
|
- Manifest.txt
|
114
118
|
has_rdoc: true
|
115
119
|
homepage: http://metric-fu.rubyforge.org/
|