ruby-watchr 0.1.6.2 → 0.1.6.3
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/analysers/reek.rb +11 -1
- data/lib/watchr/smell_types.rb +23 -0
- data/lib/watchr/version.rb +1 -1
- metadata +2 -2
@@ -12,10 +12,20 @@ module Watchr
|
|
12
12
|
smell.location['lines'].first
|
13
13
|
)
|
14
14
|
|
15
|
+
type = case smell.smell['subclass']
|
16
|
+
when 'IrresponsibleModule' then IRRESPONSIBLE_MODULE
|
17
|
+
when 'DuplicateMethodCall' then DUPLICATE_METHOD_CALL
|
18
|
+
when 'NestedIterators' then NESTED_ITERATORS
|
19
|
+
when 'TooManyStatements' then TOO_MANY_STATEMENTS
|
20
|
+
when 'FeatureEnvy' then FEATURE_ENVY
|
21
|
+
when 'UtilityFunction' then UTILITY_FUNCTION
|
22
|
+
else nil
|
23
|
+
end
|
24
|
+
|
15
25
|
add_smell(Watchr::Smell.new(
|
16
26
|
smell.smell['subclass'],
|
17
27
|
smell.location['context'], smell.smell['message'], location, {}
|
18
|
-
))
|
28
|
+
)) unless type.nil?
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
data/lib/watchr/smell_types.rb
CHANGED
@@ -29,5 +29,28 @@ module Watchr
|
|
29
29
|
# Code in multiple places is similar (not identical).
|
30
30
|
#
|
31
31
|
SIMILAR_CODE = :similar_code
|
32
|
+
|
33
|
+
|
34
|
+
IRRESPONSIBLE_MODULE = :irresponsible_module
|
35
|
+
DUPLICATE_METHOD_CALL = :duplicate_method_call
|
36
|
+
NESTED_ITERATORS = :nested_iterators
|
37
|
+
TOO_MANY_STATEMENTS = :too_many_statements
|
38
|
+
FEATURE_ENVY = :feature_envy
|
39
|
+
UTILITY_FUNCTION = :utility_function
|
40
|
+
|
41
|
+
ALL_SMELLS = [
|
42
|
+
COMPLEX_METHOD,
|
43
|
+
VERY_COMPLEX_METHOD,
|
44
|
+
COMPLEX_OBJECT,
|
45
|
+
VERY_COMPLEX_OBJECT,
|
46
|
+
IDENTICAL_CODE,
|
47
|
+
SIMILAR_CODE,
|
48
|
+
IRRESPONSIBLE_MODULE,
|
49
|
+
DUPLICATE_METHOD_CALL,
|
50
|
+
NESTED_ITERATORS,
|
51
|
+
TOO_MANY_STATEMENTS,
|
52
|
+
FEATURE_ENVY,
|
53
|
+
UTILITY_FUNCTION
|
54
|
+
]
|
32
55
|
end
|
33
56
|
end
|
data/lib/watchr/version.rb
CHANGED