ruby-watchr 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/watchr/analyse.rb +3 -1
- data/lib/watchr/metrics/flay/report.rb +3 -0
- data/lib/watchr/metrics/flog/class.rb +4 -1
- data/lib/watchr/rating.rb +5 -2
- data/lib/watchr/version.rb +1 -1
- data/spec/watchr/analyse_spec.rb +6 -0
- metadata +3 -3
data/lib/watchr/analyse.rb
CHANGED
@@ -13,7 +13,7 @@ module Watchr
|
|
13
13
|
#
|
14
14
|
# Analysed file data.
|
15
15
|
#
|
16
|
-
attr_reader :files
|
16
|
+
attr_reader :files, :path
|
17
17
|
|
18
18
|
#
|
19
19
|
# Run the analyse.
|
@@ -35,6 +35,8 @@ module Watchr
|
|
35
35
|
file.flay(flay.duplications_by_file(file))
|
36
36
|
}
|
37
37
|
end
|
38
|
+
|
39
|
+
@path = path
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -1,4 +1,7 @@
|
|
1
1
|
module Watchr
|
2
|
+
#
|
3
|
+
# Flog report class information.
|
4
|
+
#
|
2
5
|
class FlogReportClass
|
3
6
|
attr_reader :name, :methods, :total_score, :location
|
4
7
|
|
@@ -13,7 +16,7 @@ module Watchr
|
|
13
16
|
end
|
14
17
|
|
15
18
|
def total_methods_score
|
16
|
-
@methods.reduce(0) {|sum,
|
19
|
+
@methods.reduce(0) {|sum, method| sum += method.total_score}
|
17
20
|
end
|
18
21
|
|
19
22
|
def add_method(method_report)
|
data/lib/watchr/rating.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'watchr/smell_types'
|
2
2
|
|
3
3
|
module Watchr
|
4
|
+
#
|
5
|
+
# Component responsible to rate a file considering found smells.
|
6
|
+
#
|
4
7
|
module Rating
|
5
8
|
include SmellTypes
|
6
9
|
|
7
10
|
def rating
|
8
11
|
total = smells.reduce(0) {|total, smell| total += rate(smell)}
|
9
12
|
|
10
|
-
[200, 140, 90, 50, 20, 0].each_with_index do |limit,
|
11
|
-
return %w(F E D C B A)[
|
13
|
+
[200, 140, 90, 50, 20, 0].each_with_index do |limit, index|
|
14
|
+
return %w(F E D C B A)[index] if total >= limit
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
data/lib/watchr/version.rb
CHANGED
data/spec/watchr/analyse_spec.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 9
|
9
|
+
version: 0.1.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Petr Janda
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-07
|
17
|
+
date: 2012-08-07 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|