edouard-metric_fu 1.0.4.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +17 -0
- data/README +1 -1
- data/Rakefile +0 -29
- data/TODO +1 -2
- data/lib/base/base_template.rb +18 -6
- data/lib/base/configuration.rb +1 -1
- data/lib/base/generator.rb +6 -0
- data/lib/generators/churn.rb +6 -1
- data/lib/generators/flay.rb +5 -0
- data/lib/generators/flog.rb +14 -1
- data/lib/generators/rcov.rb +11 -0
- data/lib/generators/reek.rb +5 -0
- data/lib/generators/roodi.rb +7 -0
- data/lib/generators/saikuro.rb +164 -172
- data/lib/templates/awesome/churn.html.erb +1 -1
- data/lib/templates/awesome/default.css +9 -0
- data/lib/templates/awesome/flay.html.erb +1 -1
- data/lib/templates/awesome/flog.html.erb +1 -1
- data/lib/templates/awesome/rcov.html.erb +2 -2
- data/lib/templates/awesome/reek.html.erb +1 -1
- data/lib/templates/awesome/roodi.html.erb +1 -1
- data/lib/templates/standard/churn.html.erb +1 -0
- data/lib/templates/standard/flay.html.erb +1 -0
- data/lib/templates/standard/flog.html.erb +3 -2
- data/lib/templates/standard/rcov.html.erb +5 -4
- data/lib/templates/standard/reek.html.erb +1 -0
- data/lib/templates/standard/roodi.html.erb +1 -0
- data/lib/templates/standard/saikuro.html.erb +1 -0
- data/lib/templates/standard/stats.html.erb +1 -0
- data/spec/base/base_template_spec.rb +35 -14
- data/spec/base/configuration_spec.rb +1 -1
- data/spec/base/generator_spec.rb +23 -1
- data/spec/base/md5_tracker_spec.rb +1 -1
- data/spec/base/report_spec.rb +1 -1
- data/spec/generators/churn_spec.rb +8 -8
- data/spec/generators/flay_spec.rb +4 -1
- data/spec/generators/flog_spec.rb +22 -3
- data/spec/generators/reek_spec.rb +2 -1
- data/spec/generators/saikuro_spec.rb +7 -12
- data/spec/generators/stats_spec.rb +1 -1
- data/spec/graphs/flog_grapher_spec.rb +15 -0
- data/spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
- data/spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
- data/spec/resources/saikuro/index_cyclo.html +155 -0
- data/spec/resources/saikuro_sfiles/thing.rb_cyclo.html +10 -0
- data/spec/spec.opts +8 -0
- data/tasks/metric_fu.rake +3 -0
- metadata +26 -41
- data/tasks/railroad.rake +0 -39
@@ -26,7 +26,7 @@
|
|
26
26
|
</table>
|
27
27
|
|
28
28
|
<% @flog[:pages].each do |page| %>
|
29
|
-
<h2 id="<%= page[:path].gsub(/[^a-z]+/, '_') %>"><%= page[:path] %></h2>
|
29
|
+
<h2 id="<%= page[:path].gsub(/[^a-z]+/, '_') %>"><%= link_to_filename page[:path] %></h2>
|
30
30
|
<% page[:scanned_methods].each do |sm| %>
|
31
31
|
<p><%= sm[:name] %></p>
|
32
32
|
<table>
|
@@ -24,10 +24,10 @@
|
|
24
24
|
<h2 id="<%= fname.gsub(/[^a-z]+/, '_') %>"> <%= fname %></h2>
|
25
25
|
<div class="rcov_overflow">
|
26
26
|
<table class="rcov_code">
|
27
|
-
<% file[:lines].
|
27
|
+
<% file[:lines].each_with_index do |line, index| %>
|
28
28
|
<tr>
|
29
29
|
<% css_class = line[:was_run] ? "rcov_run" : "rcov_not_run" %>
|
30
|
-
<td class="<%= css_class %>"
|
30
|
+
<td class="<%= css_class %>"><%= link_to_filename(fname, index + 1, "<pre>#{line[:content]}</pre>") %></td>
|
31
31
|
</tr>
|
32
32
|
<% end %>
|
33
33
|
</table>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% @reek[:matches].each do |match| %>
|
16
16
|
<% match[:code_smells].each do |smell| %>
|
17
17
|
<tr class='<%= cycle("light", "dark", count) %>'>
|
18
|
-
<td><%= match[:file_path] %></td>
|
18
|
+
<td><%= link_to_filename(match[:file_path]) %></td>
|
19
19
|
<td>
|
20
20
|
<%= smell[:method] %>
|
21
21
|
</td>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<% count = 0 %>
|
13
13
|
<% @roodi[:problems].each do |problem| %>
|
14
14
|
<tr class='<%= cycle("light", "dark", count) %>'>
|
15
|
-
<td><%= problem[:file]
|
15
|
+
<td><%= link_to_filename(problem[:file], problem[:line]) %></td>
|
16
16
|
<td><%= problem[:problem] %></td>
|
17
17
|
</tr>
|
18
18
|
<% count += 1 %>
|
@@ -7,6 +7,7 @@
|
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<h1>Flog Results</h1>
|
10
|
+
<a href="index.html">back to menu</a>
|
10
11
|
<p><a href='http://ruby.sadi.st/Flog.html'>Flog</a> measures code complexity.</p>
|
11
12
|
<h2>Total Flog score for all methods: <%= @flog[:total]%></h2>
|
12
13
|
<h2>Average Flog score for all methods: <%= @flog[:average]%></h2>
|
@@ -20,7 +21,7 @@
|
|
20
21
|
</tr>
|
21
22
|
<% @flog[:pages].each do |page| %>
|
22
23
|
<tr>
|
23
|
-
<td><%= page[:path] %></td>
|
24
|
+
<td><a href="#<%= page[:path].gsub(/[^a-z]+/, '_') %>"><%= page[:path] %></a></td>
|
24
25
|
<td><%= page[:score].round %></td>
|
25
26
|
<td><%= page[:scanned_methods].length %></td>
|
26
27
|
<td><%= page[:average_score].round %></td>
|
@@ -30,7 +31,7 @@
|
|
30
31
|
</table>
|
31
32
|
|
32
33
|
<% @flog[:pages].each do |page| %>
|
33
|
-
<h2><%= page[:path] %></h2>
|
34
|
+
<h2 id="<%= page[:path].gsub(/[^a-z]+/, '_') %>"><%= page[:path] %></h2>
|
34
35
|
<% page[:scanned_methods].each do |sm| %>
|
35
36
|
<p><%= sm[:name] %></p>
|
36
37
|
<table>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
<body>
|
10
10
|
<h1>Rcov Code Coverage Results</h1>
|
11
|
+
<a href="index.html">back to menu</a>
|
11
12
|
<p>C0 code coverage information.</p>
|
12
13
|
<p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p>
|
13
14
|
<table>
|
@@ -16,17 +17,17 @@
|
|
16
17
|
<th>Percent run</th>
|
17
18
|
</tr>
|
18
19
|
<% count = 0 %>
|
19
|
-
<% @rcov.
|
20
|
+
<% @rcov.sort_by{|k,v| v[:percent_run]}.each do |e| %>
|
20
21
|
<tr>
|
21
|
-
<td><%=
|
22
|
-
<td><%=
|
22
|
+
<td><a href="#<%= e[0].gsub(/[^a-z]+/, '_') %>"><%= e[0] %></a></td>
|
23
|
+
<td><%= e[1][:percent_run] %></td>
|
23
24
|
</tr>
|
24
25
|
<% count += 1 %>
|
25
26
|
<% end %>
|
26
27
|
</table>
|
27
28
|
|
28
29
|
<% @rcov.each_pair do |fname, file| %>
|
29
|
-
<h2> <%= fname %></h2>
|
30
|
+
<h2 id="<%= fname.gsub(/[^a-z]+/, '_') %>"> <%= fname %></h2>
|
30
31
|
<table class="rcov_code">
|
31
32
|
<% file[:lines].each do |line| %>
|
32
33
|
<tr>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
require 'erb'
|
3
3
|
|
4
4
|
describe MetricFu::Template do
|
@@ -36,7 +36,7 @@ describe MetricFu::Template do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe 'if the template does not exist' do
|
39
|
-
it 'should return false' do
|
39
|
+
it 'should return false' do
|
40
40
|
File.should_receive(:exist?).with(@section).and_return(false)
|
41
41
|
result = @template.send(:template_exists?, @section)
|
42
42
|
result.should be_false
|
@@ -82,27 +82,48 @@ describe MetricFu::Template do
|
|
82
82
|
result.should == 'css contents'
|
83
83
|
end
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
describe "#link_to_filename " do
|
87
87
|
describe "when on OS X" do
|
88
88
|
before(:each) do
|
89
89
|
config = mock("configuration")
|
90
|
-
config.
|
90
|
+
config.stub!(:platform).and_return('universal-darwin-9.0')
|
91
91
|
MetricFu.stub!(:configuration).and_return(config)
|
92
|
-
File.should_receive(:expand_path).and_return('filename')
|
93
92
|
end
|
94
93
|
|
95
94
|
it 'should return a textmate protocol link' do
|
96
|
-
|
97
|
-
result = @template.send(:link_to_filename,
|
95
|
+
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
96
|
+
result = @template.send(:link_to_filename, 'filename')
|
97
|
+
result.should eql("<a href='txmt://open/?url=file://" \
|
98
|
+
+ "/expanded/filename'>filename</a>")
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should do the right thing with a filename that starts with a slash" do
|
102
|
+
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
103
|
+
result = @template.send(:link_to_filename, '/filename')
|
98
104
|
result.should eql("<a href='txmt://open/?url=file://" \
|
99
|
-
+ "filename
|
105
|
+
+ "/expanded/filename'>/filename</a>")
|
100
106
|
end
|
101
107
|
|
108
|
+
it "should include a line number" do
|
109
|
+
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
110
|
+
result = @template.send(:link_to_filename, 'filename', 6)
|
111
|
+
result.should eql("<a href='txmt://open/?url=file://" \
|
112
|
+
+ "/expanded/filename&line=6'>filename:6</a>")
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "and given link text" do
|
116
|
+
it "should use the submitted link text" do
|
117
|
+
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
118
|
+
result = @template.send(:link_to_filename, 'filename', 6, 'link content')
|
119
|
+
result.should eql("<a href='txmt://open/?url=file://" \
|
120
|
+
+ "/expanded/filename&line=6'>link content</a>")
|
121
|
+
end
|
122
|
+
end
|
102
123
|
end
|
103
124
|
|
104
125
|
describe "when on other platforms" do
|
105
|
-
before(:each) do
|
126
|
+
before(:each) do
|
106
127
|
config = mock("configuration")
|
107
128
|
config.should_receive(:platform).and_return('other')
|
108
129
|
MetricFu.stub!(:configuration).and_return(config)
|
@@ -110,9 +131,9 @@ describe MetricFu::Template do
|
|
110
131
|
end
|
111
132
|
|
112
133
|
it 'should return a file protocol link' do
|
113
|
-
name = "filename"
|
134
|
+
name = "filename"
|
114
135
|
result = @template.send(:link_to_filename, name)
|
115
|
-
result.should == "<a href='file://filename'>filename
|
136
|
+
result.should == "<a href='file://filename'>filename</a>"
|
116
137
|
end
|
117
138
|
end
|
118
139
|
end
|
@@ -122,15 +143,15 @@ describe MetricFu::Template do
|
|
122
143
|
first_val = "first"
|
123
144
|
second_val = "second"
|
124
145
|
iter = 2
|
125
|
-
result = @template.send(:cycle, first_val, second_val, iter)
|
146
|
+
result = @template.send(:cycle, first_val, second_val, iter)
|
126
147
|
result.should == first_val
|
127
148
|
end
|
128
149
|
|
129
150
|
it 'should return the second_value passed if iteration passed is odd' do
|
130
151
|
first_val = "first"
|
131
152
|
second_val = "second"
|
132
|
-
iter = 1
|
133
|
-
result = @template.send(:cycle, first_val, second_val, iter)
|
153
|
+
iter = 1
|
154
|
+
result = @template.send(:cycle, first_val, second_val, iter)
|
134
155
|
result.should == second_val
|
135
156
|
end
|
136
157
|
end
|
data/spec/base/generator_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe MetricFu::Generator do
|
4
4
|
|
@@ -154,6 +154,28 @@ describe MetricFu::Generator do
|
|
154
154
|
@concrete_class.should_receive(:to_h)
|
155
155
|
@concrete_class.generate_report
|
156
156
|
end
|
157
|
+
|
158
|
+
it "should raise error if the concrete class is missing a required dependency" do
|
159
|
+
concrete_class_with_missing_gem = Class.new(MetricFu::Generator) do
|
160
|
+
def self.verify_dependencies!
|
161
|
+
raise 'gem install something # if you want these tasks'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
lambda { concrete_class_with_missing_gem.generate_report }.should raise_error("gem install something # if you want these tasks")
|
165
|
+
end
|
157
166
|
|
158
167
|
end
|
168
|
+
|
169
|
+
describe "instantiation" do
|
170
|
+
it "should fail is dependencies not verified" do
|
171
|
+
ConcreteClass.should_receive(:verify_dependencies!).and_raise("Missing a required gem. Please 'gem install something'")
|
172
|
+
lambda { ConcreteClass.new() }.should raise_error("Missing a required gem. Please 'gem install something'")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should succeed when dependencies verified" do
|
176
|
+
ConcreteClass.should_receive(:verify_dependencies!).and_return(true)
|
177
|
+
ConcreteClass.new()
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
159
181
|
end
|
data/spec/base/report_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Churn do
|
4
4
|
describe "initialize" do
|
@@ -8,20 +8,20 @@ describe Churn do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should setup git if .git exits" do
|
11
|
-
|
11
|
+
MetricFu::Churn.should_receive(:system).and_return(true)
|
12
12
|
Churn::Git.should_receive(:new)
|
13
13
|
MetricFu::Churn.new
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should setup git if .svn exits" do
|
17
|
-
|
17
|
+
MetricFu::Churn.should_receive(:system).and_return(false)
|
18
18
|
File.should_receive(:exist?).with(".svn").and_return(true)
|
19
19
|
Churn::Svn.should_receive(:new)
|
20
20
|
MetricFu::Churn.new()
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should raise an error if not .svn or .git" do
|
24
|
-
|
24
|
+
MetricFu::Churn.should_receive(:system).and_return(false)
|
25
25
|
lambda{MetricFu::Churn.new()}.should raise_error(Exception)
|
26
26
|
end
|
27
27
|
end
|
@@ -30,7 +30,7 @@ describe Churn do
|
|
30
30
|
before :each do
|
31
31
|
MetricFu::Configuration.run {|config| config.churn = {:minimum_churn_count => 2} }
|
32
32
|
File.stub!(:directory?).and_return(true)
|
33
|
-
|
33
|
+
MetricFu::Churn.should_receive(:system).and_return(true)
|
34
34
|
@git = Churn::Git.new
|
35
35
|
Churn::Git.should_receive(:new).and_return(@git)
|
36
36
|
@lines = <<-HERE.gsub(/^\s*/, "")
|
@@ -73,7 +73,7 @@ describe Churn do
|
|
73
73
|
before :each do
|
74
74
|
MetricFu::Configuration.run{|config| config.churn = {:minimum_churn_count => 2} }
|
75
75
|
File.stub!(:directory?).and_return(true)
|
76
|
-
|
76
|
+
MetricFu::Churn.should_receive(:system).and_return(false)
|
77
77
|
File.should_receive(:exist?).with(".svn").and_return(true)
|
78
78
|
@svn = Churn::Svn.new
|
79
79
|
Churn::Svn.should_receive(:new).and_return(@svn)
|
@@ -120,7 +120,7 @@ describe Churn do
|
|
120
120
|
before :each do
|
121
121
|
MetricFu::Configuration.run {}
|
122
122
|
File.stub!(:directory?).and_return(true)
|
123
|
-
|
123
|
+
MetricFu::Churn.should_receive(:system).and_return(true)
|
124
124
|
@changes = {"lib/generators/flog.rb"=>2, "lib/metric_fu.rb"=>3}
|
125
125
|
end
|
126
126
|
|
@@ -139,7 +139,7 @@ describe Churn do
|
|
139
139
|
before :each do
|
140
140
|
MetricFu::Configuration.run {}
|
141
141
|
File.stub!(:directory?).and_return(true)
|
142
|
-
|
142
|
+
MetricFu::Churn.should_receive(:system).and_return(true)
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should put the changes into a hash" do
|
@@ -1,6 +1,9 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Flay do
|
4
|
+
before :each do
|
5
|
+
MetricFu::Flay.stub!(:verify_dependencies!).and_return(true)
|
6
|
+
end
|
4
7
|
describe "emit method" do
|
5
8
|
before :each do
|
6
9
|
MetricFu::Configuration.run {|config| config.flay = { :dirs_to_flay => ['app', 'lib'] } }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
describe Flog do
|
3
3
|
before :each do
|
4
4
|
@text = <<-HERE
|
@@ -123,6 +123,7 @@ describe Flog do
|
|
123
123
|
1.2: assignment
|
124
124
|
1.2: all
|
125
125
|
HERE
|
126
|
+
MetricFu::Flog.stub!(:verify_dependencies!).and_return(true)
|
126
127
|
end
|
127
128
|
|
128
129
|
describe "parse method" do
|
@@ -168,9 +169,16 @@ describe Flog do
|
|
168
169
|
flog_page = flog.parse(text)
|
169
170
|
flog_page.scanned_methods.first.name.should == "SomeNamespace::UsersController#create"
|
170
171
|
end
|
172
|
+
|
173
|
+
it "should parse empty flog files" do
|
174
|
+
text = ""
|
175
|
+
flog = MetricFu::Flog.new('base_dir')
|
176
|
+
flog_page = flog.parse(text)
|
177
|
+
flog_page.should be_nil
|
178
|
+
end
|
171
179
|
end
|
172
180
|
|
173
|
-
describe "to_h function" do
|
181
|
+
describe "to_h function with results" do
|
174
182
|
before :each do
|
175
183
|
MetricFu::Configuration.run {}
|
176
184
|
File.stub!(:directory?).and_return(true)
|
@@ -197,4 +205,15 @@ describe Flog do
|
|
197
205
|
@flog_hash[:flog][:pages].first[:path].should == "/app/controllers/user_controller.rb"
|
198
206
|
end
|
199
207
|
end
|
200
|
-
|
208
|
+
|
209
|
+
describe "to_h function with zero total" do
|
210
|
+
it "should not blow up" do
|
211
|
+
MetricFu::Configuration.run {}
|
212
|
+
File.stub!(:directory?).and_return(true)
|
213
|
+
flog = MetricFu::Flog.new('base_dir')
|
214
|
+
flog.should_receive(:open).and_return("") # some sort of empty or unparsable file
|
215
|
+
Dir.should_receive(:glob).and_return(["empty_file.txt"])
|
216
|
+
flog.analyze
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Reek do
|
4
4
|
describe "analyze method" do
|
5
5
|
before :each do
|
6
|
+
MetricFu::Reek.stub!(:verify_dependencies!).and_return(true)
|
6
7
|
@lines = <<-HERE
|
7
8
|
"app/controllers/activity_reports_controller.rb" -- 4 warnings:
|
8
9
|
ActivityReportsController#authorize_user calls current_user.primary_site_ids multiple times (Duplication)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Saikuro do
|
4
4
|
describe "to_h method" do
|
@@ -10,7 +10,7 @@ describe Saikuro do
|
|
10
10
|
saikuro.analyze
|
11
11
|
@output = saikuro.to_h
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should find the filename of a file" do
|
15
15
|
@output[:saikuro][:files].first[:filename].should == 'users_controller.rb'
|
16
16
|
end
|
@@ -19,7 +19,7 @@ describe Saikuro do
|
|
19
19
|
@output[:saikuro][:classes].first[:name].should == "UsersController"
|
20
20
|
@output[:saikuro][:classes][1][:name].should == "SessionsController"
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should put the most complex method first" do
|
24
24
|
@output[:saikuro][:methods].first[:name].should == "UsersController#create"
|
25
25
|
@output[:saikuro][:methods].first[:complexity].should == 4
|
@@ -33,21 +33,16 @@ describe Saikuro do
|
|
33
33
|
@output[:saikuro][:methods].first[:lines].should == 15
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
|
-
describe "
|
36
|
+
|
37
|
+
describe "format_directories method" do
|
38
38
|
it "should format the directories" do
|
39
39
|
MetricFu::Configuration.run {}
|
40
40
|
File.stub!(:directory?).and_return(true)
|
41
41
|
saikuro = MetricFu::Saikuro.new
|
42
42
|
|
43
43
|
MetricFu.saikuro[:input_directory] = ["app", "lib"]
|
44
|
-
|
45
|
-
|
46
|
-
File.stub!(:expand_path)
|
47
|
-
|
48
|
-
saikuro.should_receive(:sh).with(/"app \| lib"/)
|
49
|
-
|
50
|
-
saikuro.emit
|
44
|
+
|
45
|
+
saikuro.format_directories.should == "\"app | lib\""
|
51
46
|
end
|
52
47
|
end
|
53
48
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
describe MetricFu::FlogGrapher do
|
3
|
+
it "should not fall over when given empty results" do
|
4
|
+
MetricFu::Configuration.run {}
|
5
|
+
|
6
|
+
gruff_line = Gruff::Line.new(MetricFu.graph_size)
|
7
|
+
gruff_line.stub!(:write)
|
8
|
+
Gruff::Line.stub!(:new).and_return(gruff_line)
|
9
|
+
|
10
|
+
grapher = FlogGrapher.new()
|
11
|
+
metrics_hash = {:flog => {:average => 0, :pages => [], :total => 0}}
|
12
|
+
grapher.get_metrics(metrics_hash ,"20090629")
|
13
|
+
grapher.graph!
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
-- START --
|
2
|
+
Type:Global Name: Complexity:0 Lines:1
|
3
|
+
-- END --
|
4
|
+
-- START SessionsController --
|
5
|
+
Type:Class Name:SessionsController Complexity:6 Lines:40
|
6
|
+
Type:Def Name:new Complexity:2 Lines:2
|
7
|
+
Type:Def Name:create Complexity:2 Lines:19
|
8
|
+
Type:Def Name:destroy Complexity:1 Lines:4
|
9
|
+
Type:Def Name:note_failed_signin Complexity:1 Lines:3
|
10
|
+
-- END SessionsController --
|
@@ -0,0 +1,16 @@
|
|
1
|
+
-- START UsersController --
|
2
|
+
Type:Class Name:UsersController Complexity:25 Lines:111
|
3
|
+
Type:Def Name:signup Complexity:1 Lines:3
|
4
|
+
Type:Def Name:new Complexity:1 Lines:2
|
5
|
+
Type:Def Name:edit Complexity:1 Lines:3
|
6
|
+
Type:Def Name:update Complexity:2 Lines:8
|
7
|
+
Type:Def Name:index Complexity:1 Lines:2
|
8
|
+
Type:Def Name:create Complexity:4 Lines:15
|
9
|
+
Type:Def Name:thank_you Complexity:2 Lines:10
|
10
|
+
Type:Def Name:destroy Complexity:1 Lines:3
|
11
|
+
Type:Def Name:add_primary_site Complexity:1 Lines:4
|
12
|
+
Type:Def Name:users_have_changed Complexity:3 Lines:8
|
13
|
+
Type:Def Name:after_create_page Complexity:2 Lines:6
|
14
|
+
Type:Def Name:sanitize_params Complexity:3 Lines:3
|
15
|
+
Type:Def Name:authorize_user Complexity:3 Lines:5
|
16
|
+
-- END UsersController --
|