metric_fu 1.5.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +5 -0
- data/MIT-LICENSE +1 -1
- data/README +8 -6
- data/Rakefile +5 -3
- data/TODO +0 -5
- data/lib/base/base_template.rb +16 -0
- data/lib/base/churn_analyzer.rb +52 -0
- data/lib/base/code_issue.rb +97 -0
- data/lib/base/configuration.rb +4 -2
- data/lib/base/flay_analyzer.rb +50 -0
- data/lib/base/flog_analyzer.rb +43 -0
- data/lib/base/line_numbers.rb +65 -0
- data/lib/base/location.rb +83 -0
- data/lib/base/metric_analyzer.rb +404 -0
- data/lib/base/ranking.rb +33 -0
- data/lib/base/rcov_analyzer.rb +43 -0
- data/lib/base/reek_analyzer.rb +114 -0
- data/lib/base/roodi_analyzer.rb +37 -0
- data/lib/base/saikuro_analyzer.rb +48 -0
- data/lib/base/scoring_strategies.rb +29 -0
- data/lib/base/stats_analyzer.rb +37 -0
- data/lib/base/table.rb +102 -0
- data/lib/generators/hotspots.rb +52 -0
- data/lib/generators/rcov.rb +41 -0
- data/lib/metric_fu.rb +5 -3
- data/lib/templates/awesome/hotspots.html.erb +54 -0
- data/lib/templates/awesome/index.html.erb +3 -0
- data/lib/templates/standard/hotspots.html.erb +54 -0
- data/spec/base/line_numbers_spec.rb +62 -0
- data/spec/generators/rails_best_practices_spec.rb +52 -0
- data/spec/generators/rcov_spec.rb +180 -0
- data/spec/generators/roodi_spec.rb +24 -0
- data/spec/graphs/rails_best_practices_grapher_spec.rb +61 -0
- data/spec/graphs/stats_grapher_spec.rb +68 -0
- data/spec/resources/line_numbers/foo.rb +33 -0
- data/spec/resources/line_numbers/module.rb +11 -0
- data/spec/resources/line_numbers/module_surrounds_class.rb +15 -0
- data/spec/resources/line_numbers/two_classes.rb +11 -0
- data/spec/resources/yml/metric_missing.yml +1 -0
- metadata +51 -11
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Roodi do
|
4
|
+
describe "emit" do
|
5
|
+
it "should add config options when present" do
|
6
|
+
MetricFu::Configuration.run do |config|
|
7
|
+
config.roodi = {:roodi_config => 'lib/config/roodi_config.yml', :dirs_to_roodi => []}
|
8
|
+
end
|
9
|
+
roodi = MetricFu::Roodi.new
|
10
|
+
roodi.should_receive(:`).with(/-config=lib\/config\/roodi_config\.yml/).and_return("")
|
11
|
+
roodi.emit
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should NOT add config options when NOT present" do
|
15
|
+
MetricFu::Configuration.run do |config|
|
16
|
+
config.roodi = {:dirs_to_roodi => []}
|
17
|
+
end
|
18
|
+
roodi = MetricFu::Roodi.new
|
19
|
+
roodi.stub(:`)
|
20
|
+
roodi.should_receive(:`).with(/-config/).never
|
21
|
+
roodi.emit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe RailsBestPracticesGrapher do
|
4
|
+
before :each do
|
5
|
+
@stats_grapher = MetricFu::RailsBestPracticesGrapher.new
|
6
|
+
MetricFu.configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to rails_best_practices_count and labels" do
|
10
|
+
@stats_grapher.should respond_to(:rails_best_practices_count)
|
11
|
+
@stats_grapher.should respond_to(:labels)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "responding to #initialize" do
|
15
|
+
it "should initialise rails_best_practices_count and labels" do
|
16
|
+
@stats_grapher.rails_best_practices_count.should == []
|
17
|
+
@stats_grapher.labels.should == {}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "responding to #get_metrics" do
|
22
|
+
context "when metrics were not generated" do
|
23
|
+
before(:each) do
|
24
|
+
@metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
|
25
|
+
@date = "01022003"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not push to rails_best_practices_count" do
|
29
|
+
@stats_grapher.rails_best_practices_count.should_not_receive(:push)
|
30
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not update labels with the date" do
|
34
|
+
@stats_grapher.labels.should_not_receive(:update)
|
35
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when metrics have been generated" do
|
40
|
+
before(:each) do
|
41
|
+
@metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
|
42
|
+
@date = "01022003"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should push to rails_best_practices_count" do
|
46
|
+
@stats_grapher.rails_best_practices_count.should_receive(:push).with(2)
|
47
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should push 0 to rails_best_practices_count when no problems were found" do
|
51
|
+
@stats_grapher.rails_best_practices_count.should_receive(:push).with(0)
|
52
|
+
@stats_grapher.get_metrics({ :rails_best_practices => {} }, @date)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should update labels with the date" do
|
56
|
+
@stats_grapher.labels.should_receive(:update).with({ 0 => "01022003" })
|
57
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe StatsGrapher do
|
4
|
+
before :each do
|
5
|
+
@stats_grapher = MetricFu::StatsGrapher.new
|
6
|
+
MetricFu.configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to loc_counts and lot_counts and labels" do
|
10
|
+
@stats_grapher.should respond_to(:loc_counts)
|
11
|
+
@stats_grapher.should respond_to(:lot_counts)
|
12
|
+
@stats_grapher.should respond_to(:labels)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "responding to #initialize" do
|
16
|
+
it "should initialise loc_counts and lot_counts and labels" do
|
17
|
+
@stats_grapher.loc_counts.should == []
|
18
|
+
@stats_grapher.lot_counts.should == []
|
19
|
+
@stats_grapher.labels.should == {}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "responding to #get_metrics" do
|
24
|
+
context "when metrics were not generated" do
|
25
|
+
before(:each) do
|
26
|
+
@metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
|
27
|
+
@date = "01022003"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should not push to loc_counts" do
|
31
|
+
@stats_grapher.loc_counts.should_not_receive(:push)
|
32
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should not push to lot_counts" do
|
36
|
+
@stats_grapher.lot_counts.should_not_receive(:push)
|
37
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should not update labels with the date" do
|
41
|
+
@stats_grapher.labels.should_not_receive(:update)
|
42
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when metrics have been generated" do
|
47
|
+
before(:each) do
|
48
|
+
@metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
|
49
|
+
@date = "01022003"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should push to loc_counts" do
|
53
|
+
@stats_grapher.loc_counts.should_receive(:push).with(15935)
|
54
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should push to lot_counts" do
|
58
|
+
@stats_grapher.lot_counts.should_receive(:push).with(7438)
|
59
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should update labels with the date" do
|
63
|
+
@stats_grapher.labels.should_receive(:update).with({ 0 => "01022003" })
|
64
|
+
@stats_grapher.get_metrics(@metrics, @date)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Foo
|
2
|
+
|
3
|
+
def self.awesome
|
4
|
+
1 + 1
|
5
|
+
end
|
6
|
+
|
7
|
+
def what
|
8
|
+
12
|
9
|
+
end
|
10
|
+
|
11
|
+
def hello
|
12
|
+
puts "Hi There"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def awesome
|
17
|
+
3+4
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def neat
|
22
|
+
"23 skido"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def whoop
|
29
|
+
"w00t"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#comment
|
@@ -0,0 +1 @@
|
|
1
|
+
---
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jake Scruggs
|
@@ -24,7 +24,7 @@ autorequire:
|
|
24
24
|
bindir: bin
|
25
25
|
cert_chain: []
|
26
26
|
|
27
|
-
date: 2010-
|
27
|
+
date: 2010-11-10 00:00:00 -06:00
|
28
28
|
default_executable:
|
29
29
|
dependencies:
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirement: &id007 !ruby/object:Gem::Requirement
|
131
131
|
none: false
|
132
132
|
requirements:
|
133
|
-
- -
|
133
|
+
- - ~>
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
hash: 17
|
136
136
|
segments:
|
@@ -194,14 +194,14 @@ dependencies:
|
|
194
194
|
requirement: &id011 !ruby/object:Gem::Requirement
|
195
195
|
none: false
|
196
196
|
requirements:
|
197
|
-
- - "
|
197
|
+
- - "="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
hash:
|
199
|
+
hash: 27
|
200
200
|
segments:
|
201
201
|
- 1
|
202
|
-
-
|
202
|
+
- 3
|
203
203
|
- 0
|
204
|
-
version: 1.
|
204
|
+
version: 1.3.0
|
205
205
|
type: :development
|
206
206
|
version_requirements: *id011
|
207
207
|
- !ruby/object:Gem::Dependency
|
@@ -249,14 +249,30 @@ files:
|
|
249
249
|
- MIT-LICENSE
|
250
250
|
- Rakefile
|
251
251
|
- lib/base/base_template.rb
|
252
|
+
- lib/base/churn_analyzer.rb
|
253
|
+
- lib/base/code_issue.rb
|
252
254
|
- lib/base/configuration.rb
|
255
|
+
- lib/base/flay_analyzer.rb
|
256
|
+
- lib/base/flog_analyzer.rb
|
253
257
|
- lib/base/generator.rb
|
254
258
|
- lib/base/graph.rb
|
259
|
+
- lib/base/line_numbers.rb
|
260
|
+
- lib/base/location.rb
|
255
261
|
- lib/base/md5_tracker.rb
|
262
|
+
- lib/base/metric_analyzer.rb
|
263
|
+
- lib/base/ranking.rb
|
264
|
+
- lib/base/rcov_analyzer.rb
|
265
|
+
- lib/base/reek_analyzer.rb
|
256
266
|
- lib/base/report.rb
|
267
|
+
- lib/base/roodi_analyzer.rb
|
268
|
+
- lib/base/saikuro_analyzer.rb
|
269
|
+
- lib/base/scoring_strategies.rb
|
270
|
+
- lib/base/stats_analyzer.rb
|
271
|
+
- lib/base/table.rb
|
257
272
|
- lib/generators/churn.rb
|
258
273
|
- lib/generators/flay.rb
|
259
274
|
- lib/generators/flog.rb
|
275
|
+
- lib/generators/hotspots.rb
|
260
276
|
- lib/generators/rails_best_practices.rb
|
261
277
|
- lib/generators/rcov.rb
|
262
278
|
- lib/generators/reek.rb
|
@@ -282,6 +298,7 @@ files:
|
|
282
298
|
- lib/templates/awesome/css/reset.css
|
283
299
|
- lib/templates/awesome/flay.html.erb
|
284
300
|
- lib/templates/awesome/flog.html.erb
|
301
|
+
- lib/templates/awesome/hotspots.html.erb
|
285
302
|
- lib/templates/awesome/index.html.erb
|
286
303
|
- lib/templates/awesome/layout.html.erb
|
287
304
|
- lib/templates/awesome/rails_best_practices.html.erb
|
@@ -297,6 +314,7 @@ files:
|
|
297
314
|
- lib/templates/standard/default.css
|
298
315
|
- lib/templates/standard/flay.html.erb
|
299
316
|
- lib/templates/standard/flog.html.erb
|
317
|
+
- lib/templates/standard/hotspots.html.erb
|
300
318
|
- lib/templates/standard/index.html.erb
|
301
319
|
- lib/templates/standard/rails_best_practices.html.erb
|
302
320
|
- lib/templates/standard/rcov.html.erb
|
@@ -310,26 +328,37 @@ files:
|
|
310
328
|
- spec/base/configuration_spec.rb
|
311
329
|
- spec/base/generator_spec.rb
|
312
330
|
- spec/base/graph_spec.rb
|
331
|
+
- spec/base/line_numbers_spec.rb
|
313
332
|
- spec/base/md5_tracker_spec.rb
|
314
333
|
- spec/base/report_spec.rb
|
315
334
|
- spec/generators/churn_spec.rb
|
316
335
|
- spec/generators/flay_spec.rb
|
317
336
|
- spec/generators/flog_spec.rb
|
337
|
+
- spec/generators/rails_best_practices_spec.rb
|
338
|
+
- spec/generators/rcov_spec.rb
|
318
339
|
- spec/generators/reek_spec.rb
|
340
|
+
- spec/generators/roodi_spec.rb
|
319
341
|
- spec/generators/saikuro_spec.rb
|
320
342
|
- spec/generators/stats_spec.rb
|
321
343
|
- spec/graphs/engines/bluff_spec.rb
|
322
344
|
- spec/graphs/engines/gchart_spec.rb
|
323
345
|
- spec/graphs/flay_grapher_spec.rb
|
324
346
|
- spec/graphs/flog_grapher_spec.rb
|
347
|
+
- spec/graphs/rails_best_practices_grapher_spec.rb
|
325
348
|
- spec/graphs/rcov_grapher_spec.rb
|
326
349
|
- spec/graphs/reek_grapher_spec.rb
|
327
350
|
- spec/graphs/roodi_grapher_spec.rb
|
351
|
+
- spec/graphs/stats_grapher_spec.rb
|
352
|
+
- spec/resources/line_numbers/foo.rb
|
353
|
+
- spec/resources/line_numbers/module.rb
|
354
|
+
- spec/resources/line_numbers/module_surrounds_class.rb
|
355
|
+
- spec/resources/line_numbers/two_classes.rb
|
328
356
|
- spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html
|
329
357
|
- spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html
|
330
358
|
- spec/resources/saikuro/index_cyclo.html
|
331
359
|
- spec/resources/saikuro_sfiles/thing.rb_cyclo.html
|
332
360
|
- spec/resources/yml/20090630.yml
|
361
|
+
- spec/resources/yml/metric_missing.yml
|
333
362
|
- spec/spec.opts
|
334
363
|
- spec/spec_helper.rb
|
335
364
|
has_rdoc: true
|
@@ -371,25 +400,36 @@ test_files:
|
|
371
400
|
- spec/base/configuration_spec.rb
|
372
401
|
- spec/base/generator_spec.rb
|
373
402
|
- spec/base/graph_spec.rb
|
403
|
+
- spec/base/line_numbers_spec.rb
|
374
404
|
- spec/base/md5_tracker_spec.rb
|
375
405
|
- spec/base/report_spec.rb
|
376
406
|
- spec/generators/churn_spec.rb
|
377
407
|
- spec/generators/flay_spec.rb
|
378
408
|
- spec/generators/flog_spec.rb
|
409
|
+
- spec/generators/rails_best_practices_spec.rb
|
410
|
+
- spec/generators/rcov_spec.rb
|
379
411
|
- spec/generators/reek_spec.rb
|
412
|
+
- spec/generators/roodi_spec.rb
|
380
413
|
- spec/generators/saikuro_spec.rb
|
381
414
|
- spec/generators/stats_spec.rb
|
382
415
|
- spec/graphs/engines/bluff_spec.rb
|
383
416
|
- spec/graphs/engines/gchart_spec.rb
|
384
417
|
- spec/graphs/flay_grapher_spec.rb
|
385
418
|
- spec/graphs/flog_grapher_spec.rb
|
419
|
+
- spec/graphs/rails_best_practices_grapher_spec.rb
|
386
420
|
- spec/graphs/rcov_grapher_spec.rb
|
387
421
|
- spec/graphs/reek_grapher_spec.rb
|
388
422
|
- spec/graphs/roodi_grapher_spec.rb
|
423
|
+
- spec/graphs/stats_grapher_spec.rb
|
424
|
+
- spec/resources/line_numbers/foo.rb
|
425
|
+
- spec/resources/line_numbers/module.rb
|
426
|
+
- spec/resources/line_numbers/module_surrounds_class.rb
|
427
|
+
- spec/resources/line_numbers/two_classes.rb
|
389
428
|
- spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html
|
390
429
|
- spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html
|
391
430
|
- spec/resources/saikuro/index_cyclo.html
|
392
431
|
- spec/resources/saikuro_sfiles/thing.rb_cyclo.html
|
393
432
|
- spec/resources/yml/20090630.yml
|
433
|
+
- spec/resources/yml/metric_missing.yml
|
394
434
|
- spec/spec.opts
|
395
435
|
- spec/spec_helper.rb
|