bf4-metric_fu 2.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/HISTORY +252 -0
  2. data/MIT-LICENSE +22 -0
  3. data/README.md +49 -0
  4. data/Rakefile +22 -0
  5. data/TODO +6 -0
  6. data/lib/base/base_template.rb +182 -0
  7. data/lib/base/churn_analyzer.rb +38 -0
  8. data/lib/base/code_issue.rb +100 -0
  9. data/lib/base/configuration.rb +219 -0
  10. data/lib/base/flay_analyzer.rb +50 -0
  11. data/lib/base/flog_analyzer.rb +43 -0
  12. data/lib/base/generator.rb +166 -0
  13. data/lib/base/graph.rb +44 -0
  14. data/lib/base/grouping.rb +42 -0
  15. data/lib/base/line_numbers.rb +79 -0
  16. data/lib/base/location.rb +87 -0
  17. data/lib/base/md5_tracker.rb +52 -0
  18. data/lib/base/metric_analyzer.rb +331 -0
  19. data/lib/base/ranking.rb +34 -0
  20. data/lib/base/rcov_analyzer.rb +43 -0
  21. data/lib/base/record.rb +43 -0
  22. data/lib/base/reek_analyzer.rb +164 -0
  23. data/lib/base/report.rb +110 -0
  24. data/lib/base/roodi_analyzer.rb +37 -0
  25. data/lib/base/saikuro_analyzer.rb +48 -0
  26. data/lib/base/scoring_strategies.rb +29 -0
  27. data/lib/base/stats_analyzer.rb +37 -0
  28. data/lib/base/table.rb +108 -0
  29. data/lib/generators/churn.rb +28 -0
  30. data/lib/generators/flay.rb +31 -0
  31. data/lib/generators/flog.rb +113 -0
  32. data/lib/generators/hotspots.rb +52 -0
  33. data/lib/generators/rails_best_practices.rb +53 -0
  34. data/lib/generators/rcov.rb +124 -0
  35. data/lib/generators/reek.rb +81 -0
  36. data/lib/generators/roodi.rb +35 -0
  37. data/lib/generators/saikuro.rb +259 -0
  38. data/lib/generators/stats.rb +58 -0
  39. data/lib/graphs/engines/bluff.rb +113 -0
  40. data/lib/graphs/engines/gchart.rb +157 -0
  41. data/lib/graphs/flay_grapher.rb +18 -0
  42. data/lib/graphs/flog_grapher.rb +57 -0
  43. data/lib/graphs/grapher.rb +11 -0
  44. data/lib/graphs/rails_best_practices_grapher.rb +19 -0
  45. data/lib/graphs/rcov_grapher.rb +18 -0
  46. data/lib/graphs/reek_grapher.rb +30 -0
  47. data/lib/graphs/roodi_grapher.rb +18 -0
  48. data/lib/graphs/stats_grapher.rb +20 -0
  49. data/lib/metric_fu.rb +80 -0
  50. data/lib/tasks/metric_fu.rake +36 -0
  51. data/lib/templates/awesome/awesome_template.rb +92 -0
  52. data/lib/templates/awesome/churn.html.erb +58 -0
  53. data/lib/templates/awesome/css/buttons.css +82 -0
  54. data/lib/templates/awesome/css/default.css +91 -0
  55. data/lib/templates/awesome/css/integrity.css +334 -0
  56. data/lib/templates/awesome/css/reset.css +7 -0
  57. data/lib/templates/awesome/css/syntax.css +19 -0
  58. data/lib/templates/awesome/flay.html.erb +34 -0
  59. data/lib/templates/awesome/flog.html.erb +55 -0
  60. data/lib/templates/awesome/hotspots.html.erb +62 -0
  61. data/lib/templates/awesome/index.html.erb +34 -0
  62. data/lib/templates/awesome/layout.html.erb +30 -0
  63. data/lib/templates/awesome/rails_best_practices.html.erb +27 -0
  64. data/lib/templates/awesome/rcov.html.erb +42 -0
  65. data/lib/templates/awesome/reek.html.erb +40 -0
  66. data/lib/templates/awesome/roodi.html.erb +27 -0
  67. data/lib/templates/awesome/saikuro.html.erb +71 -0
  68. data/lib/templates/awesome/stats.html.erb +51 -0
  69. data/lib/templates/javascripts/bluff-min.js +1 -0
  70. data/lib/templates/javascripts/excanvas.js +35 -0
  71. data/lib/templates/javascripts/js-class.js +1 -0
  72. data/lib/templates/standard/churn.html.erb +31 -0
  73. data/lib/templates/standard/default.css +64 -0
  74. data/lib/templates/standard/flay.html.erb +34 -0
  75. data/lib/templates/standard/flog.html.erb +57 -0
  76. data/lib/templates/standard/hotspots.html.erb +54 -0
  77. data/lib/templates/standard/index.html.erb +41 -0
  78. data/lib/templates/standard/rails_best_practices.html.erb +29 -0
  79. data/lib/templates/standard/rcov.html.erb +43 -0
  80. data/lib/templates/standard/reek.html.erb +42 -0
  81. data/lib/templates/standard/roodi.html.erb +29 -0
  82. data/lib/templates/standard/saikuro.html.erb +84 -0
  83. data/lib/templates/standard/standard_template.rb +27 -0
  84. data/lib/templates/standard/stats.html.erb +55 -0
  85. data/spec/base/base_template_spec.rb +194 -0
  86. data/spec/base/configuration_spec.rb +277 -0
  87. data/spec/base/generator_spec.rb +223 -0
  88. data/spec/base/graph_spec.rb +61 -0
  89. data/spec/base/line_numbers_spec.rb +62 -0
  90. data/spec/base/location_spec.rb +127 -0
  91. data/spec/base/md5_tracker_spec.rb +57 -0
  92. data/spec/base/metric_analyzer_spec.rb +452 -0
  93. data/spec/base/ranking_spec.rb +42 -0
  94. data/spec/base/report_spec.rb +146 -0
  95. data/spec/base/table_spec.rb +36 -0
  96. data/spec/generators/churn_spec.rb +41 -0
  97. data/spec/generators/flay_spec.rb +105 -0
  98. data/spec/generators/flog_spec.rb +70 -0
  99. data/spec/generators/hotspots_spec.rb +88 -0
  100. data/spec/generators/rails_best_practices_spec.rb +52 -0
  101. data/spec/generators/rcov_spec.rb +180 -0
  102. data/spec/generators/reek_spec.rb +134 -0
  103. data/spec/generators/roodi_spec.rb +24 -0
  104. data/spec/generators/saikuro_spec.rb +74 -0
  105. data/spec/generators/stats_spec.rb +74 -0
  106. data/spec/graphs/engines/bluff_spec.rb +19 -0
  107. data/spec/graphs/engines/gchart_spec.rb +156 -0
  108. data/spec/graphs/flay_grapher_spec.rb +56 -0
  109. data/spec/graphs/flog_grapher_spec.rb +108 -0
  110. data/spec/graphs/rails_best_practices_grapher_spec.rb +61 -0
  111. data/spec/graphs/rcov_grapher_spec.rb +56 -0
  112. data/spec/graphs/reek_grapher_spec.rb +65 -0
  113. data/spec/graphs/roodi_grapher_spec.rb +56 -0
  114. data/spec/graphs/stats_grapher_spec.rb +68 -0
  115. data/spec/resources/line_numbers/foo.rb +33 -0
  116. data/spec/resources/line_numbers/module.rb +11 -0
  117. data/spec/resources/line_numbers/module_surrounds_class.rb +15 -0
  118. data/spec/resources/line_numbers/two_classes.rb +11 -0
  119. data/spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
  120. data/spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
  121. data/spec/resources/saikuro/index_cyclo.html +155 -0
  122. data/spec/resources/saikuro_sfiles/thing.rb_cyclo.html +11 -0
  123. data/spec/resources/yml/20090630.yml +7922 -0
  124. data/spec/resources/yml/metric_missing.yml +1 -0
  125. data/spec/spec.opts +6 -0
  126. data/spec/spec_helper.rb +7 -0
  127. metadata +560 -0
@@ -0,0 +1,57 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe MetricFu::MD5Tracker do
4
+ before do
5
+ @tmp_dir = File.join(File.dirname(__FILE__), 'tmp')
6
+ FileUtils.mkdir_p(@tmp_dir, :verbose => false) unless File.directory?(@tmp_dir)
7
+ @file1 = File.new(File.join(@tmp_dir, 'file1.txt'), 'w')
8
+ @file2 = File.new(File.join(@tmp_dir, 'file2.txt'), 'w')
9
+ end
10
+
11
+ after do
12
+ FileUtils.rm_rf(@tmp_dir, :verbose => false)
13
+ end
14
+
15
+ it "identical files should match" do
16
+ @file1.puts("Hello World")
17
+ @file1.close
18
+ file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
19
+
20
+ @file2.puts("Hello World")
21
+ @file2.close
22
+ file2_md5 = MD5Tracker.track(@file2.path, @tmp_dir)
23
+
24
+ file2_md5.should == file1_md5
25
+ end
26
+
27
+ it "different files should not match" do
28
+ @file1.puts("Hello World")
29
+ @file1.close
30
+ file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
31
+
32
+ @file2.puts("Goodbye World")
33
+ @file2.close
34
+ file2_md5 = MD5Tracker.track(@file2.path, @tmp_dir)
35
+
36
+ file2_md5.should_not == file1_md5
37
+ end
38
+
39
+ it "file_changed? should detect a change" do
40
+ @file2.close
41
+
42
+ @file1.puts("Hello World")
43
+ @file1.close
44
+ file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
45
+
46
+ @file1 = File.new(File.join(@tmp_dir, 'file1.txt'), 'w')
47
+ @file1.puts("Goodbye World")
48
+ @file1.close
49
+ MD5Tracker.file_changed?(@file1.path, @tmp_dir).should be_true
50
+ end
51
+
52
+ it "should detect a new file" do
53
+ @file2.close
54
+ MD5Tracker.file_changed?(@file1.path, @tmp_dir).should be_true
55
+ File.exist?(MD5Tracker.md5_file(@file1.path, @tmp_dir)).should be_true
56
+ end
57
+ end
@@ -0,0 +1,452 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe MetricAnalyzer do
4
+
5
+ context "with several types of data" do
6
+
7
+ before do
8
+ @yaml =<<-__
9
+ ---
10
+ :reek:
11
+ :matches:
12
+ - :file_path: lib/client/client.rb
13
+ :code_smells:
14
+ - :type: Large Class
15
+ :message: has at least 27 methods
16
+ :method: Devver::Client
17
+ - :type: Long Method
18
+ :message: has approx 6 statements
19
+ :method: Devver::Client#client_requested_sync
20
+ :flog:
21
+ :method_containers:
22
+ - :highest_score: 61.5870319141946
23
+ :path: /lib/client/client.rb
24
+ :methods:
25
+ Client#client_requested_sync:
26
+ :path: /lib/client/client.rb
27
+ :score: 37.9270319141946
28
+ :operators:
29
+ :+: 1.70000000000001
30
+ :/: 1.80000000000001
31
+ :method_at_line: 1.90000000000001
32
+ :puts: 1.70000000000001
33
+ :assignment: 33.0000000000001
34
+ :in_method?: 1.70000000000001
35
+ :message: 1.70000000000001
36
+ :branch: 12.6
37
+ :<<: 3.40000000000001
38
+ :each: 1.50000000000001
39
+ :lit_fixnum: 1.45
40
+ :raise: 1.80000000000001
41
+ :each_pair: 1.3
42
+ :*: 1.60000000000001
43
+ :to_f: 2.00000000000001
44
+ :each_with_index: 3.00000000000001
45
+ :[]: 22.3000000000001
46
+ :new: 1.60000000000001
47
+ :average_score: 11.1209009055421
48
+ :total_score: 1817.6
49
+ :name: Client#client_requested_sync
50
+ :churn:
51
+ :changes:
52
+ - :file_path: lib/client/client.rb
53
+ :times_changed: 54
54
+ - :file_path: lib/client/foo.rb
55
+ :times_changed: 52
56
+ __
57
+ end
58
+
59
+ it "gives all files, in order, from worst to best" do
60
+ analyzer = MetricAnalyzer.new(@yaml)
61
+ expected = [
62
+ "lib/client/client.rb",
63
+ "lib/client/foo.rb"]
64
+ analyzer.worst_files.should == expected
65
+ end
66
+
67
+ it "gives all issues for a class" do
68
+ analyzer = MetricAnalyzer.new(@yaml)
69
+ expected = {
70
+ :reek => "found 2 code smells",
71
+ :flog => "complexity is 37.9"
72
+ }
73
+ analyzer.problems_with(:class, "Client").should == expected
74
+ end
75
+
76
+ it "gives all issues for a method" do
77
+ analyzer = MetricAnalyzer.new(@yaml)
78
+ expected = {
79
+ :reek => "found 1 code smells",
80
+ :flog => "complexity is 37.9"}
81
+ analyzer.problems_with(:method, "Client#client_requested_sync").should == expected
82
+ end
83
+
84
+ it "gives all issues for a file" do
85
+ analyzer = MetricAnalyzer.new(@yaml)
86
+ expected = {
87
+ :reek => "found 2 code smells" ,
88
+ :flog => "complexity is 37.9",
89
+ :churn => "detected high level of churn (changed 54 times)"}
90
+ analyzer.problems_with(:file, "lib/client/client.rb").should == expected
91
+ end
92
+
93
+ it "provide location for a method" do
94
+ analyzer = MetricAnalyzer.new(@yaml)
95
+ expected = Location.new("lib/client/client.rb",
96
+ "Client",
97
+ "Client#client_requested_sync")
98
+ analyzer.location(:method, "Client#client_requested_sync").should == expected
99
+ end
100
+
101
+ it "provides location for a class" do
102
+ analyzer = MetricAnalyzer.new(@yaml)
103
+ expected = Location.new("lib/client/client.rb",
104
+ "Client",
105
+ nil)
106
+ analyzer.location(:class, "Client").should == expected
107
+ end
108
+
109
+ it "provides location for a file" do
110
+ analyzer = MetricAnalyzer.new(@yaml)
111
+ expected = Location.new("lib/client/client.rb",
112
+ nil,
113
+ nil)
114
+ analyzer.location(:file, "lib/client/client.rb").should == expected
115
+ end
116
+
117
+ end
118
+
119
+ context "with Reek data" do
120
+
121
+ before do
122
+ @yaml =<<-__
123
+ ---
124
+ :reek:
125
+ :matches:
126
+ - :file_path: lib/client/client.rb
127
+ :code_smells:
128
+ - :type: Large Class
129
+ :message: has at least 27 methods
130
+ :method: Devver::Client
131
+ - :type: Long Method
132
+ :message: has approx 6 statements
133
+ :method: Devver::Client#client_requested_sync
134
+ - :type: Large Class
135
+ :message: has at least 20 methods
136
+ :method: Devver::Foo
137
+ __
138
+ end
139
+
140
+ it "gives worst method" do
141
+ analyzer = MetricAnalyzer.new(@yaml)
142
+ analyzer.worst_methods(1).should == ["Client#client_requested_sync"]
143
+ end
144
+
145
+ it "gives worst class" do
146
+ analyzer = MetricAnalyzer.new(@yaml)
147
+ analyzer.worst_classes(1).should == ["Client"]
148
+ end
149
+
150
+ it "gives worst file" do
151
+ analyzer = MetricAnalyzer.new(@yaml)
152
+ analyzer.worst_files(1).should == ["lib/client/client.rb"]
153
+ end
154
+
155
+ end
156
+
157
+
158
+ context "with Saikuro data" do
159
+
160
+ before do
161
+ @yaml =<<-__
162
+ :saikuro:
163
+ :files:
164
+ - :classes:
165
+ - :complexity: 0
166
+ :methods: []
167
+ :lines: 3
168
+ :class_name: Shorty
169
+ - :complexity: 19
170
+ :methods:
171
+ - :complexity: 9
172
+ :lines: 6
173
+ :name: Shorty::Supr#self.handle_full_or_hash_option
174
+ - :complexity: 1
175
+ :lines: 9
176
+ :name: Shorty::Supr#initialize
177
+ :lines: 92
178
+ :class_name: Shorty::Supr
179
+ :filename: supr.rb
180
+ - :classes:
181
+ - :complexity: 12
182
+ :methods:
183
+ - :complexity: 8
184
+ :lines: 10
185
+ :name: Shorty::Bitly#info
186
+ :lines: 104
187
+ :class_name: Shorty::Bitly
188
+ :filename: bitly.rb
189
+ __
190
+ end
191
+
192
+ it "gives worst method" do
193
+ analyzer = MetricAnalyzer.new(@yaml)
194
+ analyzer.worst_methods(1).should == ["Supr#self.handle_full_or_hash_option"]
195
+ end
196
+
197
+ it "gives worst class" do
198
+ analyzer = MetricAnalyzer.new(@yaml)
199
+ analyzer.worst_classes(1).should == ["Bitly"]
200
+ end
201
+
202
+ it "gives complexity for method" do
203
+ analyzer = MetricAnalyzer.new(@yaml)
204
+ expected = {
205
+ :saikuro => "complexity is 1.0"
206
+ }
207
+ analyzer.problems_with(:method, "Supr#initialize").should == expected
208
+ end
209
+
210
+ it "gives average complexity for class" do
211
+ analyzer = MetricAnalyzer.new(@yaml)
212
+ expected = {
213
+ :saikuro => "average complexity is 5.0"
214
+ }
215
+ analyzer.problems_with(:class, "Supr").should == expected
216
+ end
217
+
218
+ end
219
+
220
+ context "with Flog data" do
221
+
222
+ before do
223
+ @yaml =<<-__
224
+ ---
225
+ :flog:
226
+ :method_containers:
227
+ - :highest_score: 85.5481735632041
228
+ :path: ""
229
+ :methods:
230
+ main#none:
231
+ :path:
232
+ :score: 85.5481735632041
233
+ :operators:
234
+ :+: 9.10000000000001
235
+ :assignment: 11.6000000000001
236
+ :require: 38.5000000000002
237
+ :branch: 8.80000000000009
238
+ :join: 20.0000000000002
239
+ :each: 6.60000000000007
240
+ :[]: 7.80000000000007
241
+ :task_defined?: 1.10000000000001
242
+ :load: 1.20000000000001
243
+ :average_score: 85.5481735632041
244
+ :total_score: 85.5481735632041
245
+ :name: main
246
+ - :highest_score: 61.5870319141946
247
+ :path: lib/generators/rcov.rb
248
+ :methods:
249
+ Rcov#add_method_data:
250
+ :path: lib/generators/rcov.rb:57
251
+ :score: 61.5870319141946
252
+ :operators:
253
+ :+: 1.70000000000001
254
+ :/: 1.80000000000001
255
+ :method_at_line: 1.90000000000001
256
+ :puts: 1.70000000000001
257
+ :assignment: 33.0000000000001
258
+ :in_method?: 1.70000000000001
259
+ :message: 1.70000000000001
260
+ :branch: 12.6
261
+ :<<: 3.40000000000001
262
+ :each: 1.50000000000001
263
+ :lit_fixnum: 1.45
264
+ :raise: 1.80000000000001
265
+ :each_pair: 1.3
266
+ :*: 1.60000000000001
267
+ :to_f: 2.00000000000001
268
+ :each_with_index: 3.00000000000001
269
+ :[]: 22.3000000000001
270
+ :new: 1.60000000000001
271
+ Rcov#analyze:
272
+ :path: lib/generators/rcov.rb:34
273
+ :score: 19.1504569136092
274
+ :operators:
275
+ :+: 1.40000000000001
276
+ :metric_directory: 1.6
277
+ :assignment: 9.10000000000004
278
+ :assemble_files: 1.3
279
+ :branch: 1.3
280
+ :open: 1.5
281
+ :shift: 1.3
282
+ :split: 1.3
283
+ :rcov: 3.10000000000001
284
+ :add_coverage_percentage: 1.3
285
+ :read: 1.3
286
+ :[]: 2.70000000000001
287
+ :average_score: 27.8909176873585
288
+ :total_score: 195.23642381151
289
+ - :highest_score: 60.0573892206447
290
+ :path: lib/base/metric_analyzer.rb
291
+ :methods:
292
+ MetricAnalyzer#grouping_key:
293
+ :path: lib/base/metric_analyzer.rb:117
294
+ :score: 2.6
295
+ :operators:
296
+ :inspect: 1.3
297
+ :object_id: 1.3
298
+ MetricAnalyzer#fix_row_file_path!:
299
+ :path: lib/base/metric_analyzer.rb:148
300
+ :score: 20.2743680542699
301
+ :operators:
302
+ :assignment: 10.0
303
+ :include?: 3.1
304
+ :branch: 7.20000000000001
305
+ :detect: 1.5
306
+ :file_paths: 1.7
307
+ :==: 3.1
308
+ :to_s: 1.3
309
+ :[]: 5.40000000000001
310
+ __
311
+ end
312
+
313
+ it "gives worst method" do
314
+ analyzer = MetricAnalyzer.new(@yaml)
315
+ analyzer.worst_methods(1).should == ["main#none"]
316
+ end
317
+
318
+ it "gives worst class" do
319
+ analyzer = MetricAnalyzer.new(@yaml)
320
+ analyzer.worst_classes(1).should == ["main"]
321
+ end
322
+
323
+ it "gives worst file" do
324
+ analyzer = MetricAnalyzer.new(@yaml)
325
+ analyzer.worst_files(1).should == ["lib/generators/rcov.rb:57"]
326
+ end
327
+
328
+ end
329
+
330
+ context "with Roodi data" do
331
+
332
+ before do
333
+ @yaml =<<-__
334
+ :roodi:
335
+ :total:
336
+ - Found 164 errors.
337
+ :problems:
338
+ - :line: "158"
339
+ :file: lib/client/client.rb
340
+ :problem: Method name "process" cyclomatic complexity is 10. It should be 8 or less.
341
+ - :line: "232"
342
+ :file: lib/client/client.rb
343
+ :problem: Method name "process_ready" cyclomatic complexity is 15. It should be 8 or less.
344
+ - :line: "288"
345
+ :file: lib/client/foobar.rb
346
+ :problem: Method name "send_tests" cyclomatic complexity is 10. It should be 8 or less.
347
+ __
348
+ end
349
+
350
+ it "gives worst file" do
351
+ analyzer = MetricAnalyzer.new(@yaml)
352
+ analyzer.worst_files(1).should == ["lib/client/client.rb"]
353
+ end
354
+
355
+ end
356
+
357
+ context "with Stats data" do
358
+
359
+ before do
360
+ @yaml =<<-__
361
+ :stats:
362
+ :codeLOC: 4222
363
+ :testLOC: 2111
364
+ :code_to_test_ratio: 2
365
+ __
366
+ end
367
+
368
+ it "should have codeLOC" do
369
+ analyzer = MetricAnalyzer.new(@yaml)
370
+ row = analyzer.table.rows_with('stat_name' => :codeLOC).first
371
+ row['stat_value'].should == 4222
372
+ end
373
+
374
+ it "should have testLOC" do
375
+ analyzer = MetricAnalyzer.new(@yaml)
376
+ row = analyzer.table.rows_with('stat_name' => :testLOC).first
377
+ row['stat_value'].should == 2111
378
+ end
379
+
380
+ it "should have code_to_test_ration" do
381
+ analyzer = MetricAnalyzer.new(@yaml)
382
+ row = analyzer.table.rows_with('stat_name' => :code_to_test_ratio).first
383
+ row['stat_value'].should == 2
384
+ end
385
+
386
+ end
387
+
388
+ context "with three different path representations of file (from Saikuro, Flog, and Reek)" do
389
+
390
+ before do
391
+ @yaml =<<-__
392
+ :saikuro:
393
+ :files:
394
+ - :classes:
395
+ - :complexity: 19
396
+ :methods:
397
+ - :complexity: 1
398
+ :lines: 9
399
+ :name: Client#client_requested_sync
400
+ - :complexity: 1
401
+ :lines: 9
402
+ :name: Client#method_that_is_not_mentioned_elsewhere_in_stats
403
+ :lines: 92
404
+ :class_name: Devver::Client
405
+ :filename: client.rb
406
+ :reek:
407
+ :matches:
408
+ - :file_path: lib/client/client.rb
409
+ :code_smells:
410
+ - :type: Large Class
411
+ :message: has at least 27 methods
412
+ :method: Devver::Client
413
+ - :type: Long Method
414
+ :message: has approx 6 statements
415
+ :method: Devver::Client#client_requested_sync
416
+ :flog:
417
+ :total: 1817.6
418
+ :pages:
419
+ - :path: /lib/client/client.rb
420
+ :highest_score: 37.9
421
+ :average_score: 13.6
422
+ :scanned_methods:
423
+ - :operators:
424
+ - :operator: "[]"
425
+ :score: 11.1
426
+ :score: 37.9
427
+ :name: Client#client_requested_sync
428
+ __
429
+ end
430
+
431
+ specify "all records should have full file_path" do
432
+ analyzer = MetricAnalyzer.new(@yaml)
433
+ analyzer.table.each do |row|
434
+ row['file_path'].should == 'lib/client/client.rb'
435
+ end
436
+ end
437
+
438
+ specify "all records should have class name" do
439
+ analyzer = MetricAnalyzer.new(@yaml)
440
+ analyzer.table.rows_with(:class_name => nil).should have(0).rows
441
+ end
442
+
443
+ specify "one record should not have method name" do
444
+ analyzer = MetricAnalyzer.new(@yaml)
445
+ analyzer.table.rows_with(:method_name => nil).should have(1).rows
446
+ end
447
+
448
+ end
449
+
450
+ end
451
+
452
+