ruby-watchr 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/watchr/analysers/flog.rb +1 -0
- data/lib/watchr/smell.rb +2 -27
- data/lib/watchr/smell_builder.rb +2 -2
- data/lib/watchr/smell_types.rb +1 -0
- data/lib/watchr/version.rb +1 -1
- metadata +2 -2
data/lib/watchr/smell.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'watchr/smell_types'
|
2
|
-
|
3
1
|
module Watchr
|
4
2
|
class Smell
|
5
|
-
|
3
|
+
attr_reader :type, :locations, :description, :context
|
4
|
+
attr_accessor :details
|
6
5
|
|
7
6
|
def initialize(type, context, description)
|
8
7
|
@type = type
|
@@ -11,30 +10,6 @@ module Watchr
|
|
11
10
|
@locations = []
|
12
11
|
end
|
13
12
|
|
14
|
-
def type
|
15
|
-
@type
|
16
|
-
end
|
17
|
-
|
18
|
-
def locations
|
19
|
-
@locations
|
20
|
-
end
|
21
|
-
|
22
|
-
def description
|
23
|
-
@description
|
24
|
-
end
|
25
|
-
|
26
|
-
def context
|
27
|
-
@context
|
28
|
-
end
|
29
|
-
|
30
|
-
def details
|
31
|
-
@details
|
32
|
-
end
|
33
|
-
|
34
|
-
def details=(details)
|
35
|
-
@details = details
|
36
|
-
end
|
37
|
-
|
38
13
|
def add_location(location)
|
39
14
|
@locations << location
|
40
15
|
end
|
data/lib/watchr/smell_builder.rb
CHANGED
@@ -8,7 +8,7 @@ module Watchr
|
|
8
8
|
attr_reader :smell
|
9
9
|
|
10
10
|
def initialize(type, context, description)
|
11
|
-
|
11
|
+
assert_valid_smell_type(type)
|
12
12
|
|
13
13
|
@smell = Smell.new(type, context, description)
|
14
14
|
end
|
@@ -23,7 +23,7 @@ module Watchr
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def
|
26
|
+
def assert_valid_smell_type(type)
|
27
27
|
raise "Invalid smell type '#{type}'" \
|
28
28
|
unless ALL_SMELLS.include?(type)
|
29
29
|
end
|
data/lib/watchr/smell_types.rb
CHANGED
data/lib/watchr/version.rb
CHANGED