p8-metric_fu 0.8.4.15 → 0.8.4.16
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/metric_fu/base.rb +16 -9
- data/lib/metric_fu/churn.rb +4 -5
- data/lib/metric_fu/flay.rb +2 -3
- data/lib/metric_fu/flog.rb +4 -4
- data/lib/metric_fu/reek.rb +2 -3
- data/lib/metric_fu/roodi.rb +2 -3
- data/lib/tasks/flog.rake +6 -3
- data/lib/tasks/metric_fu.rake +1 -0
- data/lib/templates/churn.html.erb +6 -3
- data/lib/templates/default.css +45 -0
- data/lib/templates/flay.html.erb +17 -10
- data/lib/templates/flog.html.erb +19 -12
- data/lib/templates/flog_page.html.erb +5 -2
- data/lib/templates/reek.html.erb +18 -10
- data/lib/templates/roodi.html.erb +26 -0
- data/spec/base_spec.rb +15 -9
- data/spec/churn_spec.rb +4 -4
- data/spec/flog_spec.rb +1 -1
- data/spec/reek_spec.rb +26 -0
- metadata +6 -6
- data/lib/templates/churn.css +0 -38
- data/lib/templates/flay.css +0 -38
- data/lib/templates/flog.css +0 -39
- data/lib/templates/reek.css +0 -38
data/README
CHANGED
@@ -109,7 +109,7 @@ The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails proje
|
|
109
109
|
|
110
110
|
****Notes on metrics:reek****
|
111
111
|
|
112
|
-
Reek detects common smells in ruby code.
|
112
|
+
Reek detects common code smells in ruby code.
|
113
113
|
You can configure which directories need to be checked.
|
114
114
|
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
|
115
115
|
|
data/lib/metric_fu/base.rb
CHANGED
@@ -7,7 +7,7 @@ module MetricFu
|
|
7
7
|
|
8
8
|
if RAILS
|
9
9
|
CODE_DIRS = ['app', 'lib']
|
10
|
-
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :
|
10
|
+
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :reek, :roodi, :stats, :saikuro ]
|
11
11
|
else
|
12
12
|
CODE_DIRS = ['lib']
|
13
13
|
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :reek, :roodi, :saikuro ]
|
@@ -20,14 +20,21 @@ module MetricFu
|
|
20
20
|
#
|
21
21
|
class Generator
|
22
22
|
|
23
|
-
def initialize(
|
24
|
-
@base_dir =
|
23
|
+
def initialize(options={})
|
24
|
+
@base_dir = self.class.metric_dir
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def self.metric_dir
|
28
|
+
File.join(BASE_DIRECTORY, template_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.template_name
|
32
|
+
self.to_s.split('::').last.downcase
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.generate_report(options={})
|
36
|
+
FileUtils.mkdir_p(metric_dir, :verbose => false) unless File.directory?(metric_dir)
|
37
|
+
self.new(options).generate_report
|
31
38
|
end
|
32
39
|
|
33
40
|
def save_html(content, file='index.html')
|
@@ -46,12 +53,12 @@ module MetricFu
|
|
46
53
|
end
|
47
54
|
|
48
55
|
def template_name
|
49
|
-
self.class.
|
56
|
+
self.class.template_name
|
50
57
|
end
|
51
58
|
|
52
59
|
def template_file
|
53
60
|
File.join(MetricFu::TEMPLATE_DIR, "#{template_name}.html.erb")
|
54
|
-
end
|
61
|
+
end
|
55
62
|
|
56
63
|
########################
|
57
64
|
# Template methods
|
data/lib/metric_fu/churn.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module MetricFu
|
2
|
-
CHURN_DIR = File.join(MetricFu::BASE_DIRECTORY, 'churn')
|
3
2
|
|
4
3
|
def self.generate_churn_report
|
5
|
-
|
6
|
-
system("open #{
|
4
|
+
Churn.generate_report(MetricFu.churn)
|
5
|
+
system("open #{Churn.metric_dir}/index.html") if open_in_browser?
|
7
6
|
end
|
8
7
|
|
9
8
|
class Churn < Base::Generator
|
10
9
|
|
11
|
-
def initialize(
|
12
|
-
@base_dir =
|
10
|
+
def initialize(options={})
|
11
|
+
@base_dir = File.join(MetricFu::BASE_DIRECTORY, template_name)
|
13
12
|
if File.exist?(".git")
|
14
13
|
@source_control = Git.new(options[:start_date])
|
15
14
|
elsif File.exist?(".svn")
|
data/lib/metric_fu/flay.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module MetricFu
|
2
|
-
FLAY_DIR = File.join(MetricFu::BASE_DIRECTORY, 'flay')
|
3
2
|
|
4
3
|
def self.generate_flay_report
|
5
|
-
|
6
|
-
system("open #{
|
4
|
+
Flay.generate_report
|
5
|
+
system("open #{Flay.metric_dir}/index.html") if open_in_browser?
|
7
6
|
end
|
8
7
|
|
9
8
|
class Flay < Base::Generator
|
data/lib/metric_fu/flog.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module MetricFu
|
2
|
-
FLOG_DIR = File.join(MetricFu::BASE_DIRECTORY, 'flog')
|
3
2
|
|
4
3
|
def self.generate_flog_report
|
5
|
-
|
6
|
-
system("open #{
|
4
|
+
Flog::Generator.generate_report
|
5
|
+
system("open #{Flog::Generator.metric_dir}/index.html") if open_in_browser?
|
7
6
|
end
|
8
7
|
|
9
8
|
module Flog
|
10
9
|
class Generator < Base::Generator
|
11
10
|
def generate_report
|
11
|
+
@base_dir = self.class.metric_dir
|
12
12
|
pages = []
|
13
13
|
flog_results.each do |filename|
|
14
14
|
page = Base.parse(open(filename, "r") { |f| f.read })
|
@@ -37,7 +37,7 @@ module MetricFu
|
|
37
37
|
Dir.glob("#{@base_dir}/**/*.txt")
|
38
38
|
end
|
39
39
|
|
40
|
-
def template_name
|
40
|
+
def self.template_name
|
41
41
|
"flog"
|
42
42
|
end
|
43
43
|
end
|
data/lib/metric_fu/reek.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module MetricFu
|
2
|
-
REEK_DIR = File.join(MetricFu::BASE_DIRECTORY, 'reek')
|
3
2
|
|
4
3
|
def self.generate_reek_report
|
5
|
-
|
6
|
-
system("open #{
|
4
|
+
Reek.generate_report
|
5
|
+
system("open #{Reek.metric_dir}/index.html") if open_in_browser?
|
7
6
|
end
|
8
7
|
|
9
8
|
class Reek < Base::Generator
|
data/lib/metric_fu/roodi.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module MetricFu
|
2
|
-
ROODI_DIR = File.join(MetricFu::BASE_DIRECTORY, 'roodi')
|
3
2
|
|
4
3
|
def self.generate_roodi_report
|
5
|
-
MetricFu::Roodi.generate_report
|
6
|
-
system("open #{
|
4
|
+
MetricFu::Roodi.generate_report
|
5
|
+
system("open #{Roodi.metric_dir}/index.html") if open_in_browser?
|
7
6
|
end
|
8
7
|
|
9
8
|
class Roodi < Base::Generator
|
data/lib/tasks/flog.rake
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
begin
|
2
2
|
|
3
3
|
def flog(output, directory)
|
4
|
+
metric_dir = MetricFu::Flog::Generator.metric_dir
|
4
5
|
Dir.glob("#{directory}/**/*.rb").each do |filename|
|
5
|
-
output_dir = "#{
|
6
|
+
output_dir = "#{metric_dir}/#{filename.split("/")[0..-2].join("/")}"
|
6
7
|
mkdir_p(output_dir, :verbose => false) unless File.directory?(output_dir)
|
7
|
-
|
8
|
+
if MetricFu::MD5Tracker.file_changed?(filename, metric_dir)
|
9
|
+
`flog #{filename} > #{metric_dir}/#{filename.split('.')[0]}.txt`
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
10
13
|
|
@@ -15,7 +18,7 @@ begin
|
|
15
18
|
|
16
19
|
namespace :flog do
|
17
20
|
desc "Delete aggregate flog data."
|
18
|
-
task(:clean) { rm_rf(MetricFu::
|
21
|
+
task(:clean) { rm_rf(MetricFu::Flog.metric_dir, :verbose => false) }
|
19
22
|
|
20
23
|
desc "Flog code in app/models"
|
21
24
|
task :models do
|
data/lib/tasks/metric_fu.rake
CHANGED
@@ -2,18 +2,21 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Source Control Churn Results</title>
|
4
4
|
<style>
|
5
|
-
<%= inline_css("
|
5
|
+
<%= inline_css("default.css") %>
|
6
6
|
</style>
|
7
7
|
</head>
|
8
8
|
|
9
9
|
<body>
|
10
10
|
<h1>Source Control Churn Results</h1>
|
11
|
-
<
|
11
|
+
<p>Files that change a lot in your project may be bad a sign.
|
12
|
+
This task uses your source control log to identify those files.
|
13
|
+
</p>
|
14
|
+
<table>
|
12
15
|
<tr><th>File Path</th><th>Times Changed</th></tr>
|
13
16
|
<% @changes.to_a.sort {|x,y| y[1] <=> x[1]}.each do |change| %>
|
14
17
|
<tr><td><%= change[0] %></td><td class='warning'><%= change[1] %></td></tr>
|
15
18
|
<% end %>
|
16
|
-
|
17
19
|
</table>
|
20
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
18
21
|
</body>
|
19
22
|
</html>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #efefef;
|
3
|
+
margin: 20px;
|
4
|
+
padding: 0;
|
5
|
+
font: 12px verdana, arial, helvetica;
|
6
|
+
}
|
7
|
+
|
8
|
+
table {
|
9
|
+
border-collapse: collapse;
|
10
|
+
border: 1px solid #666;
|
11
|
+
background: #fff;
|
12
|
+
margin-bottom: 20px;
|
13
|
+
}
|
14
|
+
|
15
|
+
table tr.light {
|
16
|
+
background: #fff;
|
17
|
+
}
|
18
|
+
|
19
|
+
table tr.dark {
|
20
|
+
background: #f9f9f9;
|
21
|
+
}
|
22
|
+
|
23
|
+
table td, table th {
|
24
|
+
padding: 4px 10px;
|
25
|
+
font-size: 13px;
|
26
|
+
}
|
27
|
+
table th {
|
28
|
+
text-align: center;
|
29
|
+
color: #fc0;
|
30
|
+
background: #336;
|
31
|
+
font-weight: bold;
|
32
|
+
border: #d0d0d0 1px solid;
|
33
|
+
}
|
34
|
+
|
35
|
+
table td {
|
36
|
+
border: #d0d0d0 1px solid;
|
37
|
+
}
|
38
|
+
|
39
|
+
table td.score {
|
40
|
+
text-align: right;
|
41
|
+
}
|
42
|
+
|
43
|
+
.warning {
|
44
|
+
background: yellow;
|
45
|
+
}
|
data/lib/templates/flay.html.erb
CHANGED
@@ -2,22 +2,29 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Flay Results</title>
|
4
4
|
<style>
|
5
|
-
<%= inline_css("
|
5
|
+
<%= inline_css("default.css") %>
|
6
6
|
</style>
|
7
7
|
</head>
|
8
8
|
|
9
9
|
<body>
|
10
10
|
<h1>Flay Results</h1>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
<p><a href='http://ruby.sadi.st/Flay.html'>Flay</a> analyzes ruby code for structural similarities.</p>
|
12
|
+
<table>
|
13
|
+
<tr>
|
14
|
+
<th>Files</th>
|
15
|
+
<th>Matches</th>
|
16
|
+
</tr>
|
17
|
+
<% @matches.each_with_index do |match, count| %>
|
18
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
19
|
+
<td>
|
20
|
+
<% match[1..-1].each do |filename| %>
|
21
|
+
<%= link_to_filename(*filename.split(":")) %><br>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
<td><%= match.first %></td>
|
25
|
+
</tr>
|
20
26
|
<% end %>
|
21
27
|
</table>
|
28
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
22
29
|
</body>
|
23
30
|
</html>
|
data/lib/templates/flog.html.erb
CHANGED
@@ -2,23 +2,30 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Flog Reporter</title>
|
4
4
|
<style>
|
5
|
-
<%= inline_css("
|
5
|
+
<%= inline_css("default.css") %>
|
6
6
|
</style>
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
-
<h1>
|
10
|
-
<p
|
11
|
-
<table
|
12
|
-
<tr
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<td class='score'><%= sprintf(SCORE_FORMAT, page.average_score) %></td>
|
19
|
-
<td class='score'><%= sprintf(SCORE_FORMAT, page.highest_score) %></td>
|
9
|
+
<h1>Flog Results</h1>
|
10
|
+
<p><a href='http://ruby.sadi.st/Flog.html'>Flog</a> measures code complexity.</p>
|
11
|
+
<table>
|
12
|
+
<tr>
|
13
|
+
<th>File</th>
|
14
|
+
<th>Total score</th>
|
15
|
+
<th>Methods</th>
|
16
|
+
<th>Average score</th>
|
17
|
+
<th>Highest score</th>
|
20
18
|
</tr>
|
19
|
+
<% pages.sort {|x,y| y.highest_score <=> x.highest_score }.each_with_index do |page, count| %>
|
20
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
21
|
+
<td><a href='<%= page.path %>'><%= page.path.sub('.html', '.rb') %></a></td>
|
22
|
+
<td class='score'><%= sprintf(SCORE_FORMAT, page.score) %></td>
|
23
|
+
<td class='score'><%= page.scanned_methods.length %></td>
|
24
|
+
<td class='score'><%= sprintf(SCORE_FORMAT, page.average_score) %></td>
|
25
|
+
<td class='score'><%= sprintf(SCORE_FORMAT, page.highest_score) %></td>
|
26
|
+
</tr>
|
21
27
|
<% end %>
|
22
28
|
</table>
|
29
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
23
30
|
</body>
|
24
31
|
</html>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
3
|
<style>
|
4
|
-
<%= inline_css("
|
4
|
+
<%= inline_css("default.css") %>
|
5
5
|
</style>
|
6
6
|
</head>
|
7
7
|
<body>
|
@@ -9,7 +9,10 @@
|
|
9
9
|
<% scanned_methods.each do |sm| %>
|
10
10
|
<p><strong><%= sm.name %> (<%= sm.score %>)</strong></p>
|
11
11
|
<table>
|
12
|
-
<tr
|
12
|
+
<tr>
|
13
|
+
<th>Score</th>
|
14
|
+
<th>Operator</th>
|
15
|
+
</tr>
|
13
16
|
<% sm.operators.each_with_index do |operator, count| %>
|
14
17
|
<tr class='<%= cycle("light", "dark", count) %>'>
|
15
18
|
<td class='score'><%= sprintf(SCORE_FORMAT, operator.score) %></td>
|
data/lib/templates/reek.html.erb
CHANGED
@@ -2,21 +2,29 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Reek Results</title>
|
4
4
|
<style>
|
5
|
-
<%= inline_css("
|
5
|
+
<%= inline_css("default.css") %>
|
6
6
|
</style>
|
7
7
|
</head>
|
8
8
|
|
9
9
|
<body>
|
10
10
|
<h1>Reek Results</h1>
|
11
|
-
<
|
12
|
-
|
13
|
-
<tr
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
<p><a href="http://reek.rubyforge.org/">Reek</a> detects common code smells in ruby code.</p>
|
12
|
+
<table>
|
13
|
+
<tr>
|
14
|
+
<th>File Path</th>
|
15
|
+
<th>Code Smell</th>
|
16
|
+
</tr>
|
17
|
+
<% @matches.each_with_index do |match, count| %>
|
18
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
19
|
+
<td><%= match.first %></td>
|
20
|
+
<td>
|
21
|
+
<% match[1..-1].each do |line| %>
|
22
|
+
<%= line %><br>
|
23
|
+
<% end %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
19
26
|
<% end %>
|
20
27
|
</table>
|
28
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
21
29
|
</body>
|
22
|
-
</html>
|
30
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Roodi Results</title>
|
4
|
+
<style>
|
5
|
+
<%= inline_css("default.css") %>
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<h1>Roodi Results</h1>
|
11
|
+
<p><a href="http://roodi.rubyforge.org/">Roodi</a> parses your Ruby code and warns you about design issues you have based on the checks that is has configured.</p>
|
12
|
+
<table>
|
13
|
+
<tr>
|
14
|
+
<th>File Path</th>
|
15
|
+
<th>Warning</th>
|
16
|
+
</tr>
|
17
|
+
<% @matches.each_with_index do |match, count| %>
|
18
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
19
|
+
<td><%= link_to_filename(match.first.split(':').first) if match.first %></td>
|
20
|
+
<td><%= match[1] %></td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</table>
|
24
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/spec/base_spec.rb
CHANGED
@@ -3,14 +3,14 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe MetricFu::Base::Generator do
|
4
4
|
describe "save_html" do
|
5
5
|
it "should save to a index.html in the base_dir" do
|
6
|
-
@generator = MetricFu::Base::Generator.new
|
7
|
-
@generator.should_receive(:open).with("
|
6
|
+
@generator = MetricFu::Base::Generator.new
|
7
|
+
@generator.should_receive(:open).with("#{MetricFu::BASE_DIRECTORY}/generator/index.html", "w")
|
8
8
|
@generator.save_html("<html>")
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should save to a custom.html to the base_dir if 'custom' is passed as name" do
|
12
|
-
@generator = MetricFu::Base::Generator.new
|
13
|
-
@generator.should_receive(:open).with("
|
12
|
+
@generator = MetricFu::Base::Generator.new
|
13
|
+
@generator.should_receive(:open).with("#{MetricFu::BASE_DIRECTORY}/generator/metric_fu/custom.html", "w")
|
14
14
|
@generator.save_html("<html>", 'metric_fu/custom.html')
|
15
15
|
end
|
16
16
|
end
|
@@ -24,10 +24,10 @@ describe MetricFu::Base::Generator do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe "
|
27
|
+
describe "generate_html" do
|
28
28
|
it "should create a new Generator and call generate_report on it" do
|
29
|
-
@generator = MetricFu::Base::Generator.new
|
30
|
-
@generator.should_receive(:open).with("
|
29
|
+
@generator = MetricFu::Base::Generator.new
|
30
|
+
@generator.should_receive(:open).with("#{MetricFu::BASE_DIRECTORY}/generator/index.html", "w")
|
31
31
|
@generator.should_receive(:generate_html).and_return('<html>')
|
32
32
|
@generator.generate_report
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe MetricFu::Base::Generator do
|
|
35
35
|
|
36
36
|
describe "cycle" do
|
37
37
|
it "should create a new Generator and call generate_report on it" do
|
38
|
-
@generator = MetricFu::Base::Generator.new
|
38
|
+
@generator = MetricFu::Base::Generator.new
|
39
39
|
@generator.cycle("light", "dark", 0).should == 'light'
|
40
40
|
@generator.cycle("light", "dark", 1).should == 'dark'
|
41
41
|
end
|
@@ -43,9 +43,15 @@ describe MetricFu::Base::Generator do
|
|
43
43
|
|
44
44
|
describe "template_name" do
|
45
45
|
it "should return the class name in lowercase" do
|
46
|
-
@generator = MetricFu::Base::Generator.new
|
46
|
+
@generator = MetricFu::Base::Generator.new
|
47
47
|
@generator.template_name.should == 'generator'
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
describe "metric_dir" do
|
52
|
+
it "should return tmp/metric_fu/{the class name in lowercase}" do
|
53
|
+
MetricFu::Base::Generator.metric_dir.should == "#{MetricFu::BASE_DIRECTORY}/generator"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
51
57
|
end
|
data/spec/churn_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe MetricFu::Churn do
|
|
11
11
|
git_mock = mock('git')
|
12
12
|
git_mock.should_receive(:get_logs).and_return(logs)
|
13
13
|
Churn::Git.should_receive(:new).and_return(git_mock)
|
14
|
-
churn = Churn.new(
|
14
|
+
churn = Churn.new(:scm => :git, :minimum_churn_count => 3)
|
15
15
|
churn.analyze
|
16
16
|
churn.instance_variable_get(:@changes).should == {"accept"=>3}
|
17
17
|
end
|
@@ -25,7 +25,7 @@ describe MetricFu::Churn do
|
|
25
25
|
|
26
26
|
describe "template_name" do
|
27
27
|
it "should return the class name in lowercase" do
|
28
|
-
churn = Churn.new
|
28
|
+
churn = Churn.new
|
29
29
|
churn.template_name.should == 'churn'
|
30
30
|
end
|
31
31
|
end
|
@@ -37,7 +37,7 @@ describe MetricFu::Churn do
|
|
37
37
|
git_mock.should_receive(:get_logs).and_return(logs)
|
38
38
|
Churn::Git.should_receive(:new).and_return(git_mock)
|
39
39
|
File.should_receive(:exist?).with(".git").and_return(true)
|
40
|
-
changes = Churn.new
|
40
|
+
changes = Churn.new.send(:parse_log_for_changes)
|
41
41
|
changes["home_page/index.html"].should == 1
|
42
42
|
changes["History.txt"].should == 2
|
43
43
|
changes["README"].should == 3
|
@@ -50,7 +50,7 @@ describe MetricFu::Churn do
|
|
50
50
|
Churn::Svn.should_receive(:new).and_return(svn_mock)
|
51
51
|
File.should_receive(:exist?).with(".git").and_return(false)
|
52
52
|
File.should_receive(:exist?).with(".svn").and_return(true)
|
53
|
-
changes = Churn.new
|
53
|
+
changes = Churn.new.send(:parse_log_for_changes)
|
54
54
|
changes["home_page/index.html"].should == 1
|
55
55
|
changes["History.txt"].should == 2
|
56
56
|
changes["README"].should == 3
|
data/spec/flog_spec.rb
CHANGED
@@ -116,7 +116,7 @@ describe MetricFu::Flog do
|
|
116
116
|
describe "template_name" do
|
117
117
|
it "should return the class name in lowercase" do
|
118
118
|
flog = Flog::Generator.new('base_dir')
|
119
|
-
|
119
|
+
Flog::Generator.template_name.should == 'flog'
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
data/spec/reek_spec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
REEK_RESULT = %("lib/metric_fu/base.rb" -- 5 warnings:
|
4
|
+
[Utility Function] #configuration doesn't depend on instance state
|
5
|
+
[Utility Function] #open_in_browser? doesn't depend on instance state
|
6
|
+
[Long Method] Configuration#reset has approx 6 statements
|
7
|
+
[Utility Function] Generator#cycle doesn't depend on instance state
|
8
|
+
[Utility Function] Generator#link_to_filename doesn't depend on instance state)
|
9
|
+
|
10
|
+
describe MetricFu::Reek do
|
11
|
+
|
12
|
+
describe "generate_html" do
|
13
|
+
it "should create a new Generator and call generate_report on it" do
|
14
|
+
@generator = MetricFu::Reek.new('other_dir')
|
15
|
+
@generator.should_receive(:`).and_return(REEK_RESULT)
|
16
|
+
@generator.generate_html
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "template_name" do
|
21
|
+
it "should return the class name in lowercase" do
|
22
|
+
flay = MetricFu::Reek.new('base_dir')
|
23
|
+
flay.template_name.should == 'reek'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Scruggs
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date:
|
15
|
+
date: 2009-01-11 00:00:00 -08:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -105,15 +105,13 @@ files:
|
|
105
105
|
- lib/tasks/roodi.rake
|
106
106
|
- lib/tasks/saikuro.rake
|
107
107
|
- lib/tasks/stats.rake
|
108
|
-
- lib/templates/churn.css
|
109
108
|
- lib/templates/churn.html.erb
|
110
|
-
- lib/templates/
|
109
|
+
- lib/templates/default.css
|
111
110
|
- lib/templates/flay.html.erb
|
112
|
-
- lib/templates/flog.css
|
113
111
|
- lib/templates/flog.html.erb
|
114
112
|
- lib/templates/flog_page.html.erb
|
115
|
-
- lib/templates/reek.css
|
116
113
|
- lib/templates/reek.html.erb
|
114
|
+
- lib/templates/roodi.html.erb
|
117
115
|
- Manifest.txt
|
118
116
|
has_rdoc: true
|
119
117
|
homepage: http://metric-fu.rubyforge.org/
|
@@ -149,4 +147,6 @@ test_files:
|
|
149
147
|
- spec/flay_spec.rb
|
150
148
|
- spec/flog_spec.rb
|
151
149
|
- spec/md5_tracker_spec.rb
|
150
|
+
- spec/reek_spec.rb
|
151
|
+
- spec/roodi_spec.rb
|
152
152
|
- spec/spec_helper.rb
|
data/lib/templates/churn.css
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
margin: 20px;
|
3
|
-
padding: 0;
|
4
|
-
font-size: 12px;
|
5
|
-
font-family: bitstream vera sans, verdana, arial, sans serif;
|
6
|
-
background-color: #efefef;
|
7
|
-
}
|
8
|
-
|
9
|
-
table {
|
10
|
-
border-collapse: collapse;
|
11
|
-
/*border-spacing: 0;*/
|
12
|
-
border: 1px solid #666;
|
13
|
-
background-color: #fff;
|
14
|
-
margin-bottom: 20px;
|
15
|
-
}
|
16
|
-
|
17
|
-
table, th, th+th, td, td+td {
|
18
|
-
border: 1px solid #ccc;
|
19
|
-
}
|
20
|
-
|
21
|
-
table th {
|
22
|
-
font-size: 12px;
|
23
|
-
color: #fc0;
|
24
|
-
padding: 4px 0;
|
25
|
-
background-color: #336;
|
26
|
-
}
|
27
|
-
|
28
|
-
th, td {
|
29
|
-
padding: 4px 10px;
|
30
|
-
}
|
31
|
-
|
32
|
-
td {
|
33
|
-
font-size: 13px;
|
34
|
-
}
|
35
|
-
|
36
|
-
.warning {
|
37
|
-
background-color: yellow;
|
38
|
-
}
|
data/lib/templates/flay.css
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
margin: 20px;
|
3
|
-
padding: 0;
|
4
|
-
font-size: 12px;
|
5
|
-
font-family: bitstream vera sans, verdana, arial, sans serif;
|
6
|
-
background-color: #efefef;
|
7
|
-
}
|
8
|
-
|
9
|
-
table {
|
10
|
-
border-collapse: collapse;
|
11
|
-
/*border-spacing: 0;*/
|
12
|
-
border: 1px solid #666;
|
13
|
-
background-color: #fff;
|
14
|
-
margin-bottom: 10px;
|
15
|
-
}
|
16
|
-
|
17
|
-
table, th, th+th, td, td+td {
|
18
|
-
border: 1px solid #ccc;
|
19
|
-
}
|
20
|
-
|
21
|
-
table th {
|
22
|
-
font-size: 14px;
|
23
|
-
color: #fc0;
|
24
|
-
background-color: #336;
|
25
|
-
text-align: left;
|
26
|
-
}
|
27
|
-
|
28
|
-
th, td {
|
29
|
-
padding: 4px 10px;
|
30
|
-
}
|
31
|
-
|
32
|
-
td {
|
33
|
-
font-size: 13px;
|
34
|
-
}
|
35
|
-
|
36
|
-
.warning {
|
37
|
-
background-color: yellow;
|
38
|
-
}
|
data/lib/templates/flog.css
DELETED
@@ -1,39 +0,0 @@
|
|
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
|
-
}
|
39
|
-
|
data/lib/templates/reek.css
DELETED
@@ -1,38 +0,0 @@
|
|
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
|
-
}
|