code_statistics 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/code_statistics.gemspec +1 -1
- data/lib/code_statistics/code_statistics.rb +3 -2
- data/test/code_statistics_test.rb +7 -7
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/code_statistics.gemspec
CHANGED
@@ -146,8 +146,9 @@ module CodeStatistics
|
|
146
146
|
|
147
147
|
def print_line(name, statistics)
|
148
148
|
m_over_c = (statistics["methods"] / statistics["classes"]) rescue m_over_c = 0
|
149
|
-
loc_over_m = (statistics["codelines"] / statistics["methods"])
|
150
|
-
|
149
|
+
loc_over_m = (statistics["codelines"] / statistics["methods"]) rescue loc_over_m = 0
|
150
|
+
loc_over_m = love_over_m - 2 if loc_over_m >= 2
|
151
|
+
|
151
152
|
start = if test_types.include? name
|
152
153
|
"| #{name.ljust(20)} "
|
153
154
|
else
|
@@ -22,7 +22,7 @@ class CodeStatisticsTest < Test::Unit::TestCase
|
|
22
22
|
controllers_dir = dir.directory("controllers")
|
23
23
|
file = controllers_dir.file("fake.rb", "this\nis\n\lame\n")
|
24
24
|
code_stats = CodeStatistics::CodeStatistics.new([])
|
25
|
-
assert code_stats.to_s.match(/
|
25
|
+
assert code_stats.to_s.match(/app\/controllers/)
|
26
26
|
assert code_stats.to_s.match(/Code LOC: 3/)
|
27
27
|
end
|
28
28
|
end
|
@@ -33,7 +33,7 @@ class CodeStatisticsTest < Test::Unit::TestCase
|
|
33
33
|
sub_dir = dir.directory("servers")
|
34
34
|
file = sub_dir.file("fake.rb", "this\nis\n\lame\n")
|
35
35
|
code_stats = CodeStatistics::CodeStatistics.new([])
|
36
|
-
assert code_stats.to_s.match(/
|
36
|
+
assert code_stats.to_s.match(/app\/servers/)
|
37
37
|
assert code_stats.to_s.match(/Code LOC: 3/)
|
38
38
|
end
|
39
39
|
end
|
@@ -46,8 +46,8 @@ class CodeStatisticsTest < Test::Unit::TestCase
|
|
46
46
|
sub_dir2 = dir.directory("controllers")
|
47
47
|
file = sub_dir2.file("fake.rb", "this\nis\n\lame\n")
|
48
48
|
code_stats = CodeStatistics::CodeStatistics.new([])
|
49
|
-
assert code_stats.to_s.match(/
|
50
|
-
assert code_stats.to_s.match(/
|
49
|
+
assert code_stats.to_s.match(/spec\/models/)
|
50
|
+
assert code_stats.to_s.match(/spec\/controllers/)
|
51
51
|
assert code_stats.to_s.match(/Test LOC: 6/)
|
52
52
|
end
|
53
53
|
end
|
@@ -57,7 +57,7 @@ class CodeStatisticsTest < Test::Unit::TestCase
|
|
57
57
|
dir = construct.directory("spec")
|
58
58
|
file = dir.file("fake.rb", "this\nis\n\lame\n")
|
59
59
|
code_stats = CodeStatistics::CodeStatistics.new([])
|
60
|
-
assert code_stats.to_s.match(/
|
60
|
+
assert code_stats.to_s.match(/spec/)
|
61
61
|
assert code_stats.to_s.match(/Test LOC: 3/)
|
62
62
|
end
|
63
63
|
end
|
@@ -70,8 +70,8 @@ class CodeStatisticsTest < Test::Unit::TestCase
|
|
70
70
|
sub_dir2 = dir.directory("controllers")
|
71
71
|
file = sub_dir2.file("fake.rb", "this\nis\n\lame\n")
|
72
72
|
code_stats = CodeStatistics::CodeStatistics.new([])
|
73
|
-
assert code_stats.to_s.match(/
|
74
|
-
assert code_stats.to_s.match(/
|
73
|
+
assert code_stats.to_s.match(/test\/models/)
|
74
|
+
assert code_stats.to_s.match(/test\/controllers/)
|
75
75
|
assert code_stats.to_s.match(/Test LOC: 6/)
|
76
76
|
end
|
77
77
|
end
|