metric_fu 2.1.3.7.19 → 2.1.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/.travis.yml +12 -0
- data/Gemfile +2 -2
- data/HISTORY.md +15 -2
- data/README.md +19 -12
- data/TODO.md +121 -7
- data/bin/metric_fu +134 -2
- data/lib/metric_fu.rb +8 -1
- data/lib/metric_fu/configuration.rb +192 -0
- data/lib/{data_structures → metric_fu/data_structures}/careful_array.rb +0 -0
- data/lib/{data_structures → metric_fu/data_structures}/line_numbers.rb +0 -0
- data/lib/{data_structures → metric_fu/data_structures}/location.rb +0 -0
- data/lib/{errors → metric_fu/errors}/analysis_error.rb +0 -0
- data/lib/{initial_requires.rb → metric_fu/initial_requires.rb} +1 -0
- data/lib/{load_files.rb → metric_fu/load_files.rb} +0 -8
- data/lib/{logging → metric_fu/logging}/mf_debugger.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/base_template.rb +0 -0
- data/lib/metric_fu/metrics/churn/churn.rb +64 -0
- data/lib/{metrics → metric_fu/metrics}/churn/churn_hotspot.rb +0 -0
- data/lib/metric_fu/metrics/churn/init.rb +5 -0
- data/lib/{metrics → metric_fu/metrics}/churn/template_awesome/churn.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/churn/template_standard/churn.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flay/flay.rb +3 -1
- data/lib/{metrics → metric_fu/metrics}/flay/flay_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flay/flay_hotspot.rb +0 -0
- data/lib/metric_fu/metrics/flay/init.rb +9 -0
- data/lib/{metrics → metric_fu/metrics}/flay/template_awesome/flay.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flay/template_standard/flay.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flog/flog.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flog/flog_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flog/flog_hotspot.rb +0 -0
- data/lib/metric_fu/metrics/flog/init.rb +7 -0
- data/lib/{metrics → metric_fu/metrics}/flog/template_awesome/flog.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/flog/template_standard/flog.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/generator.rb +3 -4
- data/lib/{metrics → metric_fu/metrics}/graph.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/code_issue.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/grouping.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/ranking.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/record.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/scoring_strategies.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/table.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/hotspot_analyzer.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/hotspots.rb +0 -0
- data/lib/metric_fu/metrics/hotspots/init.rb +5 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/template_awesome/hotspots.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/hotspots/template_standard/hotspots.html.erb +0 -0
- data/lib/metric_fu/metrics/rails_best_practices/init.rb +7 -0
- data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices.rb +4 -2
- data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_awesome/rails_best_practices.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_standard/rails_best_practices.html.erb +0 -0
- data/lib/metric_fu/metrics/rcov/init.rb +18 -0
- data/lib/{metrics → metric_fu/metrics}/rcov/rcov.rb +22 -7
- data/lib/{metrics → metric_fu/metrics}/rcov/rcov_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/rcov/rcov_hotspot.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/rcov/template_awesome/rcov.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/rcov/template_standard/rcov.html.erb +0 -0
- data/lib/metric_fu/metrics/reek/init.rb +7 -0
- data/lib/{metrics → metric_fu/metrics}/reek/reek.rb +3 -1
- data/lib/{metrics → metric_fu/metrics}/reek/reek_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/reek/reek_hotspot.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/reek/template_awesome/reek.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/reek/template_standard/reek.html.erb +0 -0
- data/lib/metric_fu/metrics/roodi/init.rb +7 -0
- data/lib/{metrics → metric_fu/metrics}/roodi/roodi.rb +3 -1
- data/lib/{metrics → metric_fu/metrics}/roodi/roodi_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/roodi/roodi_hotspot.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/roodi/template_awesome/roodi.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/roodi/template_standard/roodi.html.erb +0 -0
- data/lib/metric_fu/metrics/saikuro/init.rb +11 -0
- data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro_hotspot.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/saikuro/template_awesome/saikuro.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/saikuro/template_standard/saikuro.html.erb +0 -0
- data/lib/metric_fu/metrics/stats/init.rb +7 -0
- data/lib/{metrics → metric_fu/metrics}/stats/stats.rb +3 -1
- data/lib/{metrics → metric_fu/metrics}/stats/stats_grapher.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/stats/stats_hotspot.rb +0 -0
- data/lib/{metrics → metric_fu/metrics}/stats/template_awesome/stats.html.erb +0 -0
- data/lib/{metrics → metric_fu/metrics}/stats/template_standard/stats.html.erb +0 -0
- data/lib/{reporting → metric_fu/reporting}/graphs/engines/bluff.rb +0 -0
- data/lib/{reporting → metric_fu/reporting}/graphs/engines/gchart.rb +0 -0
- data/lib/metric_fu/reporting/graphs/engines/init.rb +5 -0
- data/lib/{reporting → metric_fu/reporting}/graphs/grapher.rb +0 -0
- data/lib/{reporting → metric_fu/reporting}/report.rb +3 -2
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/awesome_template.rb +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/buttons.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/default.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/integrity.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/reset.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/syntax.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/index.html.erb +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/awesome/layout.html.erb +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/javascripts/bluff-min.js +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/javascripts/excanvas.js +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/javascripts/js-class.js +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/standard/default.css +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/standard/index.html.erb +0 -0
- data/lib/{reporting → metric_fu/reporting}/templates/standard/standard_template.rb +0 -0
- data/lib/{run.rb → metric_fu/run.rb} +12 -11
- data/lib/{tasks → metric_fu/tasks}/metric_fu.rake +0 -0
- data/lib/metric_fu/version.rb +3 -0
- data/metric_fu.gemspec +13 -21
- data/spec/metric_fu/configuration_spec.rb +298 -0
- data/spec/{base → metric_fu/data_structures}/line_numbers_spec.rb +11 -11
- data/spec/{base → metric_fu/data_structures}/location_spec.rb +1 -1
- data/spec/{base → metric_fu/metrics}/base_template_spec.rb +1 -1
- data/spec/metric_fu/metrics/churn/churn_spec.rb +85 -0
- data/spec/{graphs → metric_fu/metrics/flay}/flay_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/flay}/flay_spec.rb +1 -1
- data/spec/{graphs → metric_fu/metrics/flog}/flog_grapher_spec.rb +4 -4
- data/spec/{generators → metric_fu/metrics/flog}/flog_spec.rb +1 -1
- data/spec/{base → metric_fu/metrics}/generator_spec.rb +4 -3
- data/spec/{base → metric_fu/metrics}/graph_spec.rb +1 -1
- data/spec/{base → metric_fu/metrics/hotspots/analysis}/ranking_spec.rb +1 -1
- data/spec/{base → metric_fu/metrics/hotspots/analysis}/table_spec.rb +1 -1
- data/spec/{base → metric_fu/metrics/hotspots}/hotspot_analyzer_spec.rb +1 -1
- data/spec/{generators → metric_fu/metrics/hotspots}/hotspots_spec.rb +1 -1
- data/spec/{graphs → metric_fu/metrics/rails_best_practices}/rails_best_practices_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/rails_best_practices}/rails_best_practices_spec.rb +1 -1
- data/spec/{graphs → metric_fu/metrics/rcov}/rcov_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/rcov}/rcov_spec.rb +1 -1
- data/spec/{graphs → metric_fu/metrics/reek}/reek_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/reek}/reek_spec.rb +1 -1
- data/spec/{graphs → metric_fu/metrics/roodi}/roodi_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/roodi}/roodi_spec.rb +1 -1
- data/spec/{generators → metric_fu/metrics/saikuro}/saikuro_spec.rb +4 -4
- data/spec/{graphs → metric_fu/metrics/stats}/stats_grapher_spec.rb +3 -3
- data/spec/{generators → metric_fu/metrics/stats}/stats_spec.rb +7 -4
- data/spec/{graphs → metric_fu/reporting/graphs}/engines/bluff_spec.rb +3 -3
- data/spec/{graphs → metric_fu/reporting/graphs}/engines/gchart_spec.rb +2 -1
- data/spec/{base → metric_fu/reporting}/report_spec.rb +5 -3
- data/spec/spec_helper.rb +17 -5
- data/spec/support/suite.rb +16 -0
- metadata +195 -183
- data/lib/configuration.rb +0 -227
- data/lib/metrics/churn/churn.rb +0 -28
- data/lib/version.rb +0 -3
- data/spec/base/configuration_spec.rb +0 -277
- data/spec/generators/churn_spec.rb +0 -41
- data/spec/spec.opts +0 -6
@@ -1,58 +1,58 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe MetricFu::LineNumbers do
|
4
4
|
|
5
5
|
describe "in_method?" do
|
6
6
|
it "should know if a line is NOT in a method" do
|
7
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
7
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
8
8
|
ln.in_method?(2).should == false
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should know if a line is in an instance method" do
|
12
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
12
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
13
13
|
ln.in_method?(8).should == true
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should know if a line is in an class method" do
|
17
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
17
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
18
18
|
ln.in_method?(3).should == true
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "method_at_line" do
|
23
23
|
it "should know the name of an instance method at a particular line" do
|
24
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
24
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
25
25
|
ln.method_at_line(8).should == "Foo#what"
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should know the name of a class method at a particular line" do
|
29
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
29
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
30
30
|
ln.method_at_line(3).should == "Foo::awesome"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should know the name of a private method at a particular line" do
|
34
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
34
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
35
35
|
ln.method_at_line(28).should == "Foo#whoop"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should know the name of a class method defined in a 'class << self block at a particular line" do
|
39
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
39
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
|
40
40
|
ln.method_at_line(22).should == "Foo::neat"
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should know the name of an instance method at a particular line in a file with two classes" do
|
44
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
44
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/two_classes.rb"))
|
45
45
|
ln.method_at_line(3).should == "Foo#stuff"
|
46
46
|
ln.method_at_line(9).should == "Bar#stuff"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should work with modules" do
|
50
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
50
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/module.rb"))
|
51
51
|
ln.method_at_line(4).should == 'KickAss#get_beat_up?'
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should work with module surrounding class" do
|
55
|
-
ln = MetricFu::LineNumbers.new(File.read(
|
55
|
+
ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/module_surrounds_class.rb"))
|
56
56
|
ln.method_at_line(5).should == "StuffModule::ThingClass#do_it"
|
57
57
|
# ln.method_at_line(12).should == "StuffModule#blah" #why no work?
|
58
58
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Churn do
|
4
|
+
|
5
|
+
let(:churn_yaml) { "--- \n:churn: \n :changed_files: \n - spec/graphs/flog_grapher_spec.rb\n - spec/base/graph_spec.rb\n - lib/templates/awesome/layout.html.erb\n - lib/graphs/rcov_grapher.rb\n - lib/base/base_template.rb\n - spec/graphs/grapher_spec.rb\n - lib/templates/awesome/flog.html.erb\n - lib/templates/awesome/flay.html.erb\n - lib/graphs/roodi_grapher.rb\n - lib/graphs/reek_grapher.rb\n - HISTORY\n - spec/graphs/roodi_grapher_spec.rb\n - lib/generators/rcov.rb\n - spec/graphs/engines/gchart_spec.rb\n - spec/graphs/rcov_grapher_spec.rb\n - lib/templates/javascripts/excanvas.js\n - lib/templates/javascripts/bluff-min.js\n - spec/graphs/reek_grapher_spec.rb\n" }
|
6
|
+
|
7
|
+
let(:config_setup) {
|
8
|
+
ENV['CC_BUILD_ARTIFACTS'] = nil
|
9
|
+
MetricFu.configure.reset
|
10
|
+
File.stub!(:directory?).and_return(true)
|
11
|
+
}
|
12
|
+
|
13
|
+
describe "new method" do
|
14
|
+
before :each do
|
15
|
+
config_setup
|
16
|
+
end
|
17
|
+
|
18
|
+
it "initializes with yaml option" do
|
19
|
+
churn = MetricFu::Churn.new
|
20
|
+
churn.send(:build_churn_options).should == "--yaml"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "initializes with given minimum_churn_count option" do
|
24
|
+
churn = MetricFu::Churn.new( { :minimum_churn_count => 5 })
|
25
|
+
churn.send(:build_churn_options).should == "--yaml --minimum_churn_count=5"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe "analyze method" do
|
31
|
+
before :each do
|
32
|
+
config_setup
|
33
|
+
@changes = {"lib/generators/flog.rb" => 2, "lib/metric_fu.rb" => 3}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be empty on error" do
|
37
|
+
churn = MetricFu::Churn.new
|
38
|
+
churn.instance_variable_set(:@output, "Churning requires a subversion or git repo")
|
39
|
+
result = churn.analyze
|
40
|
+
result.should == [:churn => {}]
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return yaml results" do
|
44
|
+
churn = MetricFu::Churn.new
|
45
|
+
churn.instance_variable_set(:@output, churn_yaml)
|
46
|
+
result = churn.analyze
|
47
|
+
result.should == {:churn => {:changed_files => ["spec/graphs/flog_grapher_spec.rb", "spec/base/graph_spec.rb", "lib/templates/awesome/layout.html.erb", "lib/graphs/rcov_grapher.rb", "lib/base/base_template.rb", "spec/graphs/grapher_spec.rb", "lib/templates/awesome/flog.html.erb", "lib/templates/awesome/flay.html.erb", "lib/graphs/roodi_grapher.rb", "lib/graphs/reek_grapher.rb", "HISTORY", "spec/graphs/roodi_grapher_spec.rb", "lib/generators/rcov.rb", "spec/graphs/engines/gchart_spec.rb", "spec/graphs/rcov_grapher_spec.rb", "lib/templates/javascripts/excanvas.js", "lib/templates/javascripts/bluff-min.js", "spec/graphs/reek_grapher_spec.rb"]}}
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
describe "to_h method" do
|
54
|
+
before :each do
|
55
|
+
config_setup
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should put the changes into a hash" do
|
59
|
+
churn = MetricFu::Churn.new
|
60
|
+
churn.instance_variable_set(:@churn, {:churn => 'results'})
|
61
|
+
churn.to_h[:churn].should == "results"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
describe "emit method" do
|
67
|
+
before :each do
|
68
|
+
config_setup
|
69
|
+
@churn = MetricFu::Churn.new
|
70
|
+
end
|
71
|
+
|
72
|
+
it "returns churn output" do
|
73
|
+
@churn.stub(:churn_code).and_return(" master\n#{churn_yaml}")
|
74
|
+
result = @churn.emit
|
75
|
+
result.should == churn_yaml
|
76
|
+
end
|
77
|
+
|
78
|
+
it "returns nil, when churn result is not yaml" do
|
79
|
+
@churn.stub(:churn_code).and_return(" master\n")
|
80
|
+
result = @churn.emit
|
81
|
+
result.should be nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe FlayGrapher do
|
4
4
|
before :each do
|
@@ -21,7 +21,7 @@ describe FlayGrapher do
|
|
21
21
|
describe "responding to #get_metrics" do
|
22
22
|
context "when metrics were not generated" do
|
23
23
|
before(:each) do
|
24
|
-
@metrics = YAML::load(File.open(
|
24
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
25
25
|
@date = "1/2"
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe FlayGrapher do
|
|
38
38
|
|
39
39
|
context "when metrics have been generated" do
|
40
40
|
before(:each) do
|
41
|
-
@metrics = YAML::load(File.open(
|
41
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
42
42
|
@date = "1/2"
|
43
43
|
end
|
44
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe MetricFu::FlogGrapher do
|
4
4
|
before :each do
|
@@ -47,7 +47,7 @@ describe MetricFu::FlogGrapher do
|
|
47
47
|
|
48
48
|
context "when metrics were not generated" do
|
49
49
|
before(:each) do
|
50
|
-
@metrics = YAML::load(File.open(
|
50
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
51
51
|
@date = "1/2"
|
52
52
|
end
|
53
53
|
|
@@ -69,7 +69,7 @@ describe MetricFu::FlogGrapher do
|
|
69
69
|
|
70
70
|
context "when metrics have been generated" do
|
71
71
|
before(:each) do
|
72
|
-
@metrics = YAML::load(File.open(
|
72
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
73
73
|
@date = "1/2"
|
74
74
|
end
|
75
75
|
|
@@ -93,7 +93,7 @@ describe MetricFu::FlogGrapher do
|
|
93
93
|
|
94
94
|
describe "responding to #get_metrics with legacy data" do
|
95
95
|
before(:each) do
|
96
|
-
@metrics = YAML::load(File.open(
|
96
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
97
97
|
|
98
98
|
@date = "1/2"
|
99
99
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe MetricFu::Generator do
|
4
4
|
|
5
5
|
include Construct::Helpers
|
6
6
|
|
7
|
-
MetricFu::Configuration.run do |config|
|
8
|
-
end
|
9
7
|
|
10
8
|
class ConcreteClass < MetricFu::Generator
|
11
9
|
def emit
|
@@ -19,6 +17,9 @@ describe MetricFu::Generator do
|
|
19
17
|
end
|
20
18
|
|
21
19
|
before(:each) do
|
20
|
+
ENV['CC_BUILD_ARTIFACTS'] = nil
|
21
|
+
MetricFu.configuration.reset
|
22
|
+
MetricFu.configure
|
22
23
|
@concrete_class = ConcreteClass.new
|
23
24
|
end
|
24
25
|
|
data/spec/{graphs → metric_fu/metrics/rails_best_practices}/rails_best_practices_grapher_spec.rb
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe RailsBestPracticesGrapher do
|
4
4
|
before :each do
|
@@ -21,7 +21,7 @@ describe RailsBestPracticesGrapher do
|
|
21
21
|
describe "responding to #get_metrics" do
|
22
22
|
context "when metrics were not generated" do
|
23
23
|
before(:each) do
|
24
|
-
@metrics = YAML::load(File.open(
|
24
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
25
25
|
@date = "01022003"
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe RailsBestPracticesGrapher do
|
|
38
38
|
|
39
39
|
context "when metrics have been generated" do
|
40
40
|
before(:each) do
|
41
|
-
@metrics = YAML::load(File.open(
|
41
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
42
42
|
@date = "01022003"
|
43
43
|
end
|
44
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe RcovGrapher do
|
4
4
|
before :each do
|
@@ -21,7 +21,7 @@ describe RcovGrapher do
|
|
21
21
|
describe "responding to #get_metrics" do
|
22
22
|
context "when metrics were not generated" do
|
23
23
|
before(:each) do
|
24
|
-
@metrics = YAML::load(File.open(
|
24
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
25
25
|
@date = "1/2"
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe RcovGrapher do
|
|
38
38
|
|
39
39
|
context "when metrics have been generated" do
|
40
40
|
before(:each) do
|
41
|
-
@metrics = YAML::load(File.open(
|
41
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
42
42
|
@date = "1/2"
|
43
43
|
end
|
44
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ReekGrapher do
|
4
4
|
before :each do
|
@@ -21,7 +21,7 @@ describe ReekGrapher do
|
|
21
21
|
describe "responding to #get_metrics" do
|
22
22
|
context "when metrics were not generated" do
|
23
23
|
before(:each) do
|
24
|
-
@metrics = YAML::load(File.open(
|
24
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
25
25
|
@date = "1/2"
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe ReekGrapher do
|
|
38
38
|
|
39
39
|
context "when metrics have been generated" do
|
40
40
|
before(:each) do
|
41
|
-
@metrics = YAML::load(File.open(
|
41
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
42
42
|
@date = "1/2"
|
43
43
|
end
|
44
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe RoodiGrapher do
|
4
4
|
before :each do
|
@@ -21,7 +21,7 @@ describe RoodiGrapher do
|
|
21
21
|
describe "responding to #get_metrics" do
|
22
22
|
context "when metrics were not generated" do
|
23
23
|
before(:each) do
|
24
|
-
@metrics = YAML::load(File.open(
|
24
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
|
25
25
|
@date = "1/2"
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe RoodiGrapher do
|
|
38
38
|
|
39
39
|
context "when metrics have been generated" do
|
40
40
|
before(:each) do
|
41
|
-
@metrics = YAML::load(File.open(
|
41
|
+
@metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
|
42
42
|
@date = "1/2"
|
43
43
|
end
|
44
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Saikuro do
|
4
4
|
describe "to_h method" do
|
@@ -6,7 +6,7 @@ describe Saikuro do
|
|
6
6
|
MetricFu::Configuration.run {}
|
7
7
|
File.stub!(:directory?).and_return(true)
|
8
8
|
saikuro = MetricFu::Saikuro.new
|
9
|
-
saikuro.stub!(:metric_directory).and_return(
|
9
|
+
saikuro.stub!(:metric_directory).and_return("#{resources_path}/saikuro")
|
10
10
|
saikuro.analyze
|
11
11
|
@output = saikuro.to_h
|
12
12
|
end
|
@@ -39,7 +39,7 @@ describe Saikuro do
|
|
39
39
|
MetricFu::Configuration.run {}
|
40
40
|
File.stub!(:directory?).and_return(true)
|
41
41
|
@saikuro = MetricFu::Saikuro.new
|
42
|
-
@saikuro.stub!(:metric_directory).and_return(
|
42
|
+
@saikuro.stub!(:metric_directory).and_return("#{resources_path}/saikuro")
|
43
43
|
@saikuro.analyze
|
44
44
|
@output = @saikuro.to_h
|
45
45
|
end
|
@@ -65,7 +65,7 @@ describe Saikuro do
|
|
65
65
|
describe Saikuro::SFile do
|
66
66
|
describe "getting elements from a Saikuro result file" do
|
67
67
|
it "should parse nested START/END sections" do
|
68
|
-
path =
|
68
|
+
path = "#{resources_path}/saikuro_sfiles/thing.rb_cyclo.html"
|
69
69
|
sfile = Saikuro::SFile.new path
|
70
70
|
sfile.elements.map { |e| e.complexity }.sort.should eql(["0","0","2"])
|
71
71
|
end
|