reek 4.4.0 → 4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +41 -4
- data/README.md +15 -3
- data/defaults.reek +1 -1
- data/docs/Basic-Smell-Options.md +2 -2
- data/docs/Code-Smells.md +4 -0
- data/docs/How-To-Write-New-Detectors.md +116 -0
- data/docs/How-reek-works-internally.md +3 -4
- data/docs/Instance-Variable-Assumption.md +134 -0
- data/docs/Simulated-Polymorphism.md +1 -1
- data/docs/Smell-Suppression.md +6 -6
- data/docs/{style-guide.md → Style-Guide.md} +0 -0
- data/docs/Unused-Private-Method.md +1 -1
- data/docs/YAML-Reports.md +0 -18
- data/features/configuration_files/directory_specific_directives.feature +4 -4
- data/features/configuration_files/unused_private_method.feature +2 -2
- data/features/samples.feature +122 -117
- data/features/smells/subclassed_from_core_class.feature +1 -1
- data/lib/reek/code_comment.rb +13 -4
- data/lib/reek/context/code_context.rb +1 -0
- data/lib/reek/examiner.rb +24 -27
- data/lib/reek/smells/class_variable.rb +1 -1
- data/lib/reek/smells/control_parameter.rb +1 -1
- data/lib/reek/smells/data_clump.rb +1 -1
- data/lib/reek/smells/duplicate_method_call.rb +1 -1
- data/lib/reek/smells/feature_envy.rb +1 -1
- data/lib/reek/smells/instance_variable_assumption.rb +1 -1
- data/lib/reek/smells/prima_donna_method.rb +1 -1
- data/lib/reek/smells/repeated_conditional.rb +1 -1
- data/lib/reek/smells/smell_detector.rb +5 -14
- data/lib/reek/smells/smell_repository.rb +1 -5
- data/lib/reek/smells/smell_warning.rb +6 -8
- data/lib/reek/smells/subclassed_from_core_class.rb +1 -1
- data/lib/reek/smells/uncommunicative_variable_name.rb +22 -12
- data/lib/reek/smells/unused_private_method.rb +1 -1
- data/lib/reek/spec.rb +2 -2
- data/lib/reek/spec/should_reek_of.rb +12 -8
- data/lib/reek/version.rb +1 -1
- data/spec/reek/code_comment_spec.rb +13 -5
- data/spec/reek/examiner_spec.rb +2 -2
- data/spec/reek/smells/attribute_spec.rb +91 -78
- data/spec/reek/smells/boolean_parameter_spec.rb +72 -64
- data/spec/reek/smells/class_variable_spec.rb +81 -68
- data/spec/reek/smells/control_parameter_spec.rb +101 -141
- data/spec/reek/smells/data_clump_spec.rb +94 -149
- data/spec/reek/smells/duplicate_method_call_spec.rb +98 -85
- data/spec/reek/smells/feature_envy_spec.rb +164 -183
- data/spec/reek/smells/instance_variable_assumption_spec.rb +51 -147
- data/spec/reek/smells/irresponsible_module_spec.rb +153 -170
- data/spec/reek/smells/long_parameter_list_spec.rb +44 -88
- data/spec/reek/smells/long_yield_list_spec.rb +41 -41
- data/spec/reek/smells/manual_dispatch_spec.rb +36 -18
- data/spec/reek/smells/module_initialize_spec.rb +31 -33
- data/spec/reek/smells/nested_iterators_spec.rb +189 -183
- data/spec/reek/smells/nil_check_spec.rb +48 -37
- data/spec/reek/smells/prima_donna_method_spec.rb +41 -26
- data/spec/reek/smells/repeated_conditional_spec.rb +75 -87
- data/spec/reek/smells/smell_warning_spec.rb +7 -0
- data/spec/reek/smells/subclassed_from_core_class_spec.rb +37 -112
- data/spec/reek/smells/too_many_constants_spec.rb +109 -199
- data/spec/reek/smells/too_many_instance_variables_spec.rb +105 -128
- data/spec/reek/smells/too_many_methods_spec.rb +38 -62
- data/spec/reek/smells/too_many_statements_spec.rb +69 -45
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +16 -29
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +24 -37
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +55 -60
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +108 -95
- data/spec/reek/smells/unused_parameters_spec.rb +73 -49
- data/spec/reek/smells/unused_private_method_spec.rb +97 -50
- data/spec/reek/smells/utility_function_spec.rb +130 -188
- data/spec/reek/spec/should_reek_of_spec.rb +2 -2
- metadata +6 -7
- data/lib/reek/cli/warning_collector.rb +0 -27
- data/spec/reek/cli/warning_collector_spec.rb +0 -25
- data/spec/reek/smells/smell_detector_shared.rb +0 -29
@@ -9,7 +9,7 @@ Simulated Polymorphism occurs when
|
|
9
9
|
* or code uses instance_of?, kind_of?, is_a?, or === to decide what type it's working with;
|
10
10
|
* or multiple conditionals in different places test the same value.
|
11
11
|
|
12
|
-
Conditional code is hard to read and understand, because the reader must hold more state in
|
12
|
+
Conditional code is hard to read and understand, because the reader must hold more state in their head. When the same value is tested in multiple places throughout an application, any change to the set of possible values will require many methods and classes to change. Tests for the type of an object may indicate that the abstraction represented by that type is not completely defined (or understood).
|
13
13
|
|
14
14
|
## Current Support in Reek
|
15
15
|
|
data/docs/Smell-Suppression.md
CHANGED
@@ -51,10 +51,10 @@ def many_parameters_it_has foo, bar, baz, qux
|
|
51
51
|
end
|
52
52
|
```
|
53
53
|
|
54
|
-
It is also possible to specify options for a particular smell detector
|
54
|
+
It is also possible to specify options for a particular smell detector in hash-style:
|
55
55
|
|
56
56
|
```ruby
|
57
|
-
# :reek:LongParameterList
|
57
|
+
# :reek:LongParameterList { max_params: 4 }
|
58
58
|
def many_parameters_it_has foo, bar, baz, qux
|
59
59
|
# ...
|
60
60
|
end
|
@@ -66,17 +66,17 @@ also use via comment.
|
|
66
66
|
E.g.:
|
67
67
|
|
68
68
|
```ruby
|
69
|
-
# :reek:TooManyStatements
|
69
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
70
70
|
def too_many
|
71
71
|
# ...
|
72
72
|
end
|
73
73
|
|
74
|
-
# :reek:NestedIterators
|
74
|
+
# :reek:NestedIterators { max_allowed_nesting: 2 }
|
75
75
|
def quax
|
76
76
|
foo.each {|bar| bar.each {|baz| baz.qux(qux)}}
|
77
77
|
end
|
78
78
|
|
79
|
-
# :reek:DuplicateMethodCall
|
79
|
+
# :reek:DuplicateMethodCall { max_calls: 3 }
|
80
80
|
def quax
|
81
81
|
foo.to_i + foo.to_i + foo.to_i
|
82
82
|
end
|
@@ -86,7 +86,7 @@ Keep in mind that there are also smell detectors that operate on a class or
|
|
86
86
|
module level, e.g.:
|
87
87
|
|
88
88
|
```ruby
|
89
|
-
# :reek:TooManyInstanceVariables
|
89
|
+
# :reek:TooManyInstanceVariables { max_instance_variables: 8 }
|
90
90
|
class Klass
|
91
91
|
# ...
|
92
92
|
end
|
File without changes
|
@@ -37,7 +37,7 @@ configuration option (which is part of the [Basic Smell Options](Basic-Smell-Opt
|
|
37
37
|
for instance like this (an example from Reek's own codebase):
|
38
38
|
|
39
39
|
```Ruby
|
40
|
-
# :reek:UnusedPrivateMethod
|
40
|
+
# :reek:UnusedPrivateMethod { exclude: [ !ruby/regexp /process_/ ] }
|
41
41
|
class ContextBuilder
|
42
42
|
def process_begin
|
43
43
|
# ....
|
data/docs/YAML-Reports.md
CHANGED
@@ -91,21 +91,3 @@ Duplication:
|
|
91
91
|
status:
|
92
92
|
is_active: true
|
93
93
|
</pre>
|
94
|
-
|
95
|
-
[Control Couple](Control-Couple.md):
|
96
|
-
|
97
|
-
<pre>
|
98
|
-
- !ruby/object:Reek::SmellWarning
|
99
|
-
location:
|
100
|
-
source: $stdin
|
101
|
-
lines:
|
102
|
-
- 2
|
103
|
-
context: Turn#fred
|
104
|
-
smell:
|
105
|
-
class: ControlCouple
|
106
|
-
subclass: BooleanParameter
|
107
|
-
parameter: arg
|
108
|
-
message: has boolean parameter 'arg'
|
109
|
-
status:
|
110
|
-
is_active: true
|
111
|
-
</pre>
|
@@ -50,7 +50,7 @@ Feature: Directory directives
|
|
50
50
|
Then it reports:
|
51
51
|
"""
|
52
52
|
web_app/app/controllers/users_controller.rb -- 1 warning:
|
53
|
-
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable @user [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
53
|
+
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable '@user' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
54
54
|
web_app/app/models/user.rb -- 2 warnings:
|
55
55
|
[1]:IrresponsibleModule: User has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
56
56
|
[2]:UnusedParameters: User#logged_in_with_role has unused parameter 'r' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
@@ -121,7 +121,7 @@ Feature: Directory directives
|
|
121
121
|
Then it reports:
|
122
122
|
"""
|
123
123
|
web_app/app/controllers/users_controller.rb -- 3 warnings:
|
124
|
-
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable @user [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
124
|
+
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable '@user' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
125
125
|
[1]:IrresponsibleModule: UsersController has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
126
126
|
[4]:NestedIterators: UsersController#show contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
127
127
|
web_app/app/models/user.rb -- 1 warning:
|
@@ -167,10 +167,10 @@ Feature: Directory directives
|
|
167
167
|
Then it reports:
|
168
168
|
"""
|
169
169
|
other/projects_controller.rb -- 2 warnings:
|
170
|
-
[1]:InstanceVariableAssumption: ProjectController assumes too much for instance variable @project [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
170
|
+
[1]:InstanceVariableAssumption: ProjectController assumes too much for instance variable '@project' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
171
171
|
[4]:NestedIterators: ProjectController#show contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
172
172
|
web_app/app/controllers/users_controller.rb -- 2 warnings:
|
173
|
-
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable @user [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
173
|
+
[1]:InstanceVariableAssumption: UsersController assumes too much for instance variable '@user' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
174
174
|
[1]:IrresponsibleModule: UsersController has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
175
175
|
4 total warnings
|
176
176
|
"""
|
@@ -31,7 +31,7 @@ Feature: Unused Private Method detector
|
|
31
31
|
Then it reports:
|
32
32
|
"""
|
33
33
|
sample.rb -- 1 warning:
|
34
|
-
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method
|
34
|
+
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar' [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
|
35
35
|
"""
|
36
36
|
|
37
37
|
Scenario: Use regexes for excluding contexts
|
@@ -62,5 +62,5 @@ Feature: Unused Private Method detector
|
|
62
62
|
Then it reports:
|
63
63
|
"""
|
64
64
|
sample.rb -- 1 warning:
|
65
|
-
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method
|
65
|
+
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar' [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
|
66
66
|
"""
|
data/features/samples.feature
CHANGED
@@ -13,37 +13,37 @@ Feature: Basic smell detection
|
|
13
13
|
"""
|
14
14
|
inline.rb -- 51 warnings:
|
15
15
|
BooleanParameter: Inline::C#parse_signature has boolean parameter 'raw' [https://github.com/troessner/reek/blob/master/docs/Boolean-Parameter.md]
|
16
|
-
ClassVariable: Inline declares the class variable @@directory [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
17
|
-
ClassVariable: Inline declares the class variable @@rootdir [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
18
|
-
ClassVariable: Inline::C declares the class variable @@type_map [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
19
|
-
ControlParameter: Inline::C#parse_signature is controlled by argument raw [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
20
|
-
DataClump: Inline::C takes parameters [options, src] to 5 methods [https://github.com/troessner/reek/blob/master/docs/Data-Clump.md]
|
21
|
-
DuplicateMethodCall: Inline#self.rootdir calls env.nil? 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
22
|
-
DuplicateMethodCall: Inline::C#build calls $? != 0 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
23
|
-
DuplicateMethodCall: Inline::C#build calls Inline.directory 5 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
24
|
-
DuplicateMethodCall: Inline::C#build calls io.puts "#endif" 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
25
|
-
DuplicateMethodCall: Inline::C#build calls io.puts "#ifdef __cplusplus" 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
26
|
-
DuplicateMethodCall: Inline::C#build calls io.puts 6 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
27
|
-
DuplicateMethodCall: Inline::C#build calls warn "Output:\n#{result}" 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
28
|
-
DuplicateMethodCall: Inline::C#crap_for_windoze calls Config::CONFIG['libdir'] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
29
|
-
DuplicateMethodCall: Inline::C#generate calls result.sub!(/\A\n/, '') 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
30
|
-
DuplicateMethodCall: Inline::C#generate calls signature['args'] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
31
|
-
DuplicateMethodCall: Inline::C#generate calls signature['args'].map 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
32
|
-
DuplicateMethodCall: Inline::C#initialize calls stack.empty? 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
33
|
-
DuplicateMethodCall: Module#inline calls Inline.const_get(lang) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
34
|
-
DuplicateMethodCall: Module#inline calls options[:testing] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
35
|
-
InstanceVariableAssumption: Inline::C assumes too much for instance variable @module_name [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
36
|
-
InstanceVariableAssumption: Inline::C assumes too much for instance variable @so_name [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
37
|
-
InstanceVariableAssumption: Inline::C assumes too much for instance variable @types [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
16
|
+
ClassVariable: Inline declares the class variable '@@directory' [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
17
|
+
ClassVariable: Inline declares the class variable '@@rootdir' [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
18
|
+
ClassVariable: Inline::C declares the class variable '@@type_map' [https://github.com/troessner/reek/blob/master/docs/Class-Variable.md]
|
19
|
+
ControlParameter: Inline::C#parse_signature is controlled by argument 'raw' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
20
|
+
DataClump: Inline::C takes parameters ['options', 'src'] to 5 methods [https://github.com/troessner/reek/blob/master/docs/Data-Clump.md]
|
21
|
+
DuplicateMethodCall: Inline#self.rootdir calls 'env.nil?' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
22
|
+
DuplicateMethodCall: Inline::C#build calls '$? != 0' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
23
|
+
DuplicateMethodCall: Inline::C#build calls 'Inline.directory' 5 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
24
|
+
DuplicateMethodCall: Inline::C#build calls 'io.puts "#endif"' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
25
|
+
DuplicateMethodCall: Inline::C#build calls 'io.puts "#ifdef __cplusplus"' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
26
|
+
DuplicateMethodCall: Inline::C#build calls 'io.puts' 6 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
27
|
+
DuplicateMethodCall: Inline::C#build calls 'warn "Output:\n#{result}"' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
28
|
+
DuplicateMethodCall: Inline::C#crap_for_windoze calls 'Config::CONFIG['libdir']' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
29
|
+
DuplicateMethodCall: Inline::C#generate calls 'result.sub!(/\A\n/, '')' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
30
|
+
DuplicateMethodCall: Inline::C#generate calls 'signature['args']' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
31
|
+
DuplicateMethodCall: Inline::C#generate calls 'signature['args'].map' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
32
|
+
DuplicateMethodCall: Inline::C#initialize calls 'stack.empty?' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
33
|
+
DuplicateMethodCall: Module#inline calls 'Inline.const_get(lang)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
34
|
+
DuplicateMethodCall: Module#inline calls 'options[:testing]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
35
|
+
InstanceVariableAssumption: Inline::C assumes too much for instance variable '@module_name' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
36
|
+
InstanceVariableAssumption: Inline::C assumes too much for instance variable '@so_name' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
37
|
+
InstanceVariableAssumption: Inline::C assumes too much for instance variable '@types' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
38
38
|
IrresponsibleModule: CompilationError has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
39
39
|
IrresponsibleModule: Dir has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
40
40
|
IrresponsibleModule: File has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
41
41
|
IrresponsibleModule: Module has no descriptive comment [https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md]
|
42
42
|
NestedIterators: Inline::C#build contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
43
43
|
NilCheck: Inline#self.rootdir performs a nil-check [https://github.com/troessner/reek/blob/master/docs/Nil-Check.md]
|
44
|
-
RepeatedConditional: Inline::C tests $DEBUG at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
45
|
-
RepeatedConditional: Inline::C tests $TESTING at least 4 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
46
|
-
RepeatedConditional: Inline::C tests @@type_map.has_key? type at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
44
|
+
RepeatedConditional: Inline::C tests '$DEBUG' at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
45
|
+
RepeatedConditional: Inline::C tests '$TESTING' at least 4 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
46
|
+
RepeatedConditional: Inline::C tests '@@type_map.has_key? type' at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
47
47
|
TooManyConstants: Inline has 6 constants [https://github.com/troessner/reek/blob/master/docs/Too-Many-Constants.md]
|
48
48
|
TooManyInstanceVariables: Inline::C has at least 13 instance variables [https://github.com/troessner/reek/blob/master/docs/Too-Many-Instance-Variables.md]
|
49
49
|
TooManyMethods: Inline::C has at least 25 methods [https://github.com/troessner/reek/blob/master/docs/Too-Many-Methods.md]
|
@@ -63,7 +63,7 @@ Feature: Basic smell detection
|
|
63
63
|
UncommunicativeVariableName: Inline::C#module_name has the variable name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
64
64
|
UncommunicativeVariableName: Inline::C#parse_signature has the variable name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
65
65
|
UtilityFunction: Inline::C#strip_comments doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
|
66
|
-
optparse.rb --
|
66
|
+
optparse.rb -- 130 warnings:
|
67
67
|
Attribute: OptionParser#banner is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
68
68
|
Attribute: OptionParser#default_argv is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
69
69
|
Attribute: OptionParser#program_name is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
@@ -75,51 +75,51 @@ Feature: Basic smell detection
|
|
75
75
|
BooleanParameter: OptionParser#complete has boolean parameter 'icase' [https://github.com/troessner/reek/blob/master/docs/Boolean-Parameter.md]
|
76
76
|
BooleanParameter: OptionParser::Completion#complete has boolean parameter 'icase' [https://github.com/troessner/reek/blob/master/docs/Boolean-Parameter.md]
|
77
77
|
BooleanParameter: OptionParser::List#complete has boolean parameter 'icase' [https://github.com/troessner/reek/blob/master/docs/Boolean-Parameter.md]
|
78
|
-
ControlParameter: OptionParser#summarize is controlled by argument blk [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
79
|
-
ControlParameter: OptionParser::Arguable#options= is controlled by argument opt [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
80
|
-
ControlParameter: OptionParser::ParseError#set_option is controlled by argument eq [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
81
|
-
DuplicateMethodCall: OptionParser#getopts calls result[opt] = false 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
82
|
-
DuplicateMethodCall: OptionParser#make_switch calls default_style.guess(arg = a) 4 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
83
|
-
DuplicateMethodCall: OptionParser#make_switch calls long << (o = q.downcase) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
84
|
-
DuplicateMethodCall: OptionParser#make_switch calls notwice(NilClass, klass, 'type') 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
85
|
-
DuplicateMethodCall: OptionParser#make_switch calls notwice(a ? Object : TrueClass, klass, 'type') 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
86
|
-
DuplicateMethodCall: OptionParser#make_switch calls pattern.method(:convert) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
87
|
-
DuplicateMethodCall: OptionParser#make_switch calls pattern.method(:convert).to_proc 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
88
|
-
DuplicateMethodCall: OptionParser#make_switch calls pattern.respond_to?(:convert) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
89
|
-
DuplicateMethodCall: OptionParser#make_switch calls q.downcase 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
90
|
-
DuplicateMethodCall: OptionParser#make_switch calls sdesc << "-#{q}" 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
91
|
-
DuplicateMethodCall: OptionParser#make_switch calls search(:atype, FalseClass) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
92
|
-
DuplicateMethodCall: OptionParser#make_switch calls search(:atype, o) 6 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
93
|
-
DuplicateMethodCall: OptionParser#order calls argv[0] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
94
|
-
DuplicateMethodCall: OptionParser#parse calls argv[0] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
95
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls $!.set_option(arg, true) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
96
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls cb.call(val) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
97
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls raise $!.set_option(arg, true) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
98
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls raise(*exc) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
99
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls setter.call(sw.switch_name, val) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
100
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls sw.block 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
101
|
-
DuplicateMethodCall: OptionParser#parse_in_order calls sw.switch_name 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
102
|
-
DuplicateMethodCall: OptionParser#permute calls argv[0] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
103
|
-
DuplicateMethodCall: OptionParser::Completion#complete calls candidates.size 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
104
|
-
DuplicateMethodCall: OptionParser::Completion#complete calls k.id2name 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
105
|
-
DuplicateMethodCall: OptionParser::Switch#parse_arg calls s.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
106
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls indent + l 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
107
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left.collect 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
108
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left.collect {|s| s.length} 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
109
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left.collect {|s| s.length}.max 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
110
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left.collect
|
111
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left.shift 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
112
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls left[-1] 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
113
|
-
DuplicateMethodCall: OptionParser::Switch#summarize calls s.length 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
114
|
-
FeatureEnvy: OptionParser#order refers to argv more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
115
|
-
FeatureEnvy: OptionParser#parse refers to argv more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
116
|
-
FeatureEnvy: OptionParser#permute refers to argv more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
117
|
-
FeatureEnvy: OptionParser::Completion#complete refers to candidates more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
118
|
-
FeatureEnvy: OptionParser::List#accept refers to pat more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
119
|
-
FeatureEnvy: OptionParser::List#add_banner refers to opt more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
120
|
-
FeatureEnvy: OptionParser::List#summarize refers to opt more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
121
|
-
InstanceVariableAssumption: OptionParser assumes too much for instance variable @release [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
122
|
-
InstanceVariableAssumption: OptionParser assumes too much for instance variable @version [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
78
|
+
ControlParameter: OptionParser#summarize is controlled by argument 'blk' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
79
|
+
ControlParameter: OptionParser::Arguable#options= is controlled by argument 'opt' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
80
|
+
ControlParameter: OptionParser::ParseError#set_option is controlled by argument 'eq' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
81
|
+
DuplicateMethodCall: OptionParser#getopts calls 'result[opt] = false' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
82
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'default_style.guess(arg = a)' 4 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
83
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'long << (o = q.downcase)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
84
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'notwice(NilClass, klass, 'type')' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
85
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'notwice(a ? Object : TrueClass, klass, 'type')' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
86
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'pattern.method(:convert)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
87
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'pattern.method(:convert).to_proc' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
88
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'pattern.respond_to?(:convert)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
89
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'q.downcase' 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
90
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'sdesc << "-#{q}"' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
91
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'search(:atype, FalseClass)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
92
|
+
DuplicateMethodCall: OptionParser#make_switch calls 'search(:atype, o)' 6 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
93
|
+
DuplicateMethodCall: OptionParser#order calls 'argv[0]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
94
|
+
DuplicateMethodCall: OptionParser#parse calls 'argv[0]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
95
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls '$!.set_option(arg, true)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
96
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'cb.call(val)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
97
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'raise $!.set_option(arg, true)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
98
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'raise(*exc)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
99
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'setter.call(sw.switch_name, val)' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
100
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'sw.block' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
101
|
+
DuplicateMethodCall: OptionParser#parse_in_order calls 'sw.switch_name' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
102
|
+
DuplicateMethodCall: OptionParser#permute calls 'argv[0]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
103
|
+
DuplicateMethodCall: OptionParser::Completion#complete calls 'candidates.size' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
104
|
+
DuplicateMethodCall: OptionParser::Completion#complete calls 'k.id2name' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
105
|
+
DuplicateMethodCall: OptionParser::Switch#parse_arg calls 's.length' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
106
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'indent + l' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
107
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left.collect {|s| s.length}' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
108
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left.collect {|s| s.length}.max' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
109
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left.collect {|s| s.length}.max.to_i' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
110
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left.collect' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
111
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left.shift' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
112
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 'left[-1]' 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
113
|
+
DuplicateMethodCall: OptionParser::Switch#summarize calls 's.length' 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
114
|
+
FeatureEnvy: OptionParser#order refers to 'argv' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
115
|
+
FeatureEnvy: OptionParser#parse refers to 'argv' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
116
|
+
FeatureEnvy: OptionParser#permute refers to 'argv' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
117
|
+
FeatureEnvy: OptionParser::Completion#complete refers to 'candidates' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
118
|
+
FeatureEnvy: OptionParser::List#accept refers to 'pat' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
119
|
+
FeatureEnvy: OptionParser::List#add_banner refers to 'opt' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
120
|
+
FeatureEnvy: OptionParser::List#summarize refers to 'opt' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
121
|
+
InstanceVariableAssumption: OptionParser assumes too much for instance variable '@release' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
122
|
+
InstanceVariableAssumption: OptionParser assumes too much for instance variable '@version' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
123
123
|
LongParameterList: OptionParser#complete has 4 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
124
124
|
LongParameterList: OptionParser#summarize has 4 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
125
125
|
LongParameterList: OptionParser::List#complete has 4 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
@@ -127,6 +127,10 @@ Feature: Basic smell detection
|
|
127
127
|
LongParameterList: OptionParser::Switch#initialize has 7 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
128
128
|
LongParameterList: OptionParser::Switch#summarize has 5 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
129
129
|
ManualDispatch: OptionParser#make_switch manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
130
|
+
ManualDispatch: OptionParser#make_switch manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
131
|
+
ManualDispatch: OptionParser#make_switch manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
132
|
+
ManualDispatch: OptionParser::List#accept manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
133
|
+
ManualDispatch: OptionParser::List#accept manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
130
134
|
ManualDispatch: OptionParser::List#accept manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
131
135
|
ManualDispatch: OptionParser::List#add_banner manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
132
136
|
ManualDispatch: OptionParser::List#summarize manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
@@ -134,13 +138,13 @@ Feature: Basic smell detection
|
|
134
138
|
NestedIterators: OptionParser#make_switch contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
135
139
|
NilCheck: OptionParser#make_switch performs a nil-check [https://github.com/troessner/reek/blob/master/docs/Nil-Check.md]
|
136
140
|
NilCheck: OptionParser#self.inc performs a nil-check [https://github.com/troessner/reek/blob/master/docs/Nil-Check.md]
|
137
|
-
RepeatedConditional: OptionParser tests a at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
138
|
-
RepeatedConditional: OptionParser tests argv.size == 1 and Array === argv[0] at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
139
|
-
RepeatedConditional: OptionParser tests default_pattern at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
140
|
-
RepeatedConditional: OptionParser tests not_style at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
141
|
-
RepeatedConditional: OptionParser tests s at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
142
|
-
SubclassedFromCoreClass: OptionParser::CompletingHash inherits from
|
143
|
-
SubclassedFromCoreClass: OptionParser::OptionMap inherits from
|
141
|
+
RepeatedConditional: OptionParser tests 'a' at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
142
|
+
RepeatedConditional: OptionParser tests 'argv.size == 1 and Array === argv[0]' at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
143
|
+
RepeatedConditional: OptionParser tests 'default_pattern' at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
144
|
+
RepeatedConditional: OptionParser tests 'not_style' at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
145
|
+
RepeatedConditional: OptionParser tests 's' at least 7 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
146
|
+
SubclassedFromCoreClass: OptionParser::CompletingHash inherits from core class 'Hash' [https://github.com/troessner/reek/blob/master/docs/Subclassed-From-Core-Class.md]
|
147
|
+
SubclassedFromCoreClass: OptionParser::OptionMap inherits from core class 'Hash' [https://github.com/troessner/reek/blob/master/docs/Subclassed-From-Core-Class.md]
|
144
148
|
TooManyConstants: OptionParser has 16 constants [https://github.com/troessner/reek/blob/master/docs/Too-Many-Constants.md]
|
145
149
|
TooManyInstanceVariables: OptionParser has at least 6 instance variables [https://github.com/troessner/reek/blob/master/docs/Too-Many-Instance-Variables.md]
|
146
150
|
TooManyInstanceVariables: OptionParser::Switch has at least 7 instance variables [https://github.com/troessner/reek/blob/master/docs/Too-Many-Instance-Variables.md]
|
@@ -190,7 +194,7 @@ Feature: Basic smell detection
|
|
190
194
|
UnusedParameters: OptionParser::Completion#convert has unused parameter 'opt' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
191
195
|
UnusedParameters: OptionParser::Switch::NoArgument#parse has unused parameter 'argv' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
192
196
|
UnusedParameters: OptionParser::Switch::OptionalArgument#parse has unused parameter 'argv' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
193
|
-
redcloth.rb --
|
197
|
+
redcloth.rb -- 111 warnings:
|
194
198
|
Attribute: RedCloth#filter_html is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
195
199
|
Attribute: RedCloth#filter_styles is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
196
200
|
Attribute: RedCloth#hard_breaks is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
@@ -198,42 +202,43 @@ Feature: Basic smell detection
|
|
198
202
|
Attribute: RedCloth#no_span_caps is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
199
203
|
Attribute: RedCloth#rules is a writable attribute [https://github.com/troessner/reek/blob/master/docs/Attribute.md]
|
200
204
|
BooleanParameter: RedCloth#blocks has boolean parameter 'deep_code' [https://github.com/troessner/reek/blob/master/docs/Boolean-Parameter.md]
|
201
|
-
ControlParameter: RedCloth#blocks is controlled by argument deep_code [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
202
|
-
ControlParameter: RedCloth#htmlesc is controlled by argument mode [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
203
|
-
ControlParameter: RedCloth#lT is controlled by argument text [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
204
|
-
ControlParameter: RedCloth#pba is controlled by argument element [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
205
|
-
DataClump: RedCloth takes parameters [atts, cite, content, tag] to 3 methods [https://github.com/troessner/reek/blob/master/docs/Data-Clump.md]
|
206
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls depth.last 5 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
207
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls depth.last.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
208
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls depth[i] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
209
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls line_id - 1 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
210
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls lines[line_id - 1] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
211
|
-
DuplicateMethodCall: RedCloth#block_textile_lists calls tl.length 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
212
|
-
DuplicateMethodCall: RedCloth#clean_html calls tags[tag] 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
213
|
-
DuplicateMethodCall: RedCloth#pba calls $1.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
214
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls @pre_list.last 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
215
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls @pre_list.last
|
216
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls codepre - used_offtags.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
217
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls codepre - used_offtags.length
|
218
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls codepre.zero? 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
219
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls htmlesc( line, :NoQuotes ) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
220
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls used_offtags.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
221
|
-
DuplicateMethodCall: RedCloth#rip_offtags calls used_offtags['notextile'] 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
222
|
-
FeatureEnvy: RedCloth#block_markdown_atx refers to text more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
223
|
-
FeatureEnvy: RedCloth#block_markdown_setext refers to text more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
224
|
-
FeatureEnvy: RedCloth#block_textile_lists refers to depth more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
225
|
-
FeatureEnvy: RedCloth#blocks refers to blk more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
226
|
-
FeatureEnvy: RedCloth#clean_white_space refers to text more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
227
|
-
FeatureEnvy: RedCloth#pba refers to text more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
228
|
-
InstanceVariableAssumption: RedCloth assumes too much for instance variable @lite_mode [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
229
|
-
InstanceVariableAssumption: RedCloth assumes too much for instance variable @pre_list [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
230
|
-
InstanceVariableAssumption: RedCloth assumes too much for instance variable @rules [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
231
|
-
InstanceVariableAssumption: RedCloth assumes too much for instance variable @shelf [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
232
|
-
InstanceVariableAssumption: RedCloth assumes too much for instance variable @urlrefs [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
205
|
+
ControlParameter: RedCloth#blocks is controlled by argument 'deep_code' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
206
|
+
ControlParameter: RedCloth#htmlesc is controlled by argument 'mode' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
207
|
+
ControlParameter: RedCloth#lT is controlled by argument 'text' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
208
|
+
ControlParameter: RedCloth#pba is controlled by argument 'element' [https://github.com/troessner/reek/blob/master/docs/Control-Parameter.md]
|
209
|
+
DataClump: RedCloth takes parameters ['atts', 'cite', 'content', 'tag'] to 3 methods [https://github.com/troessner/reek/blob/master/docs/Data-Clump.md]
|
210
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'depth.last' 5 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
211
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'depth.last.length' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
212
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'depth[i]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
213
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'line_id - 1' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
214
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'lines[line_id - 1]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
215
|
+
DuplicateMethodCall: RedCloth#block_textile_lists calls 'tl.length' 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
216
|
+
DuplicateMethodCall: RedCloth#clean_html calls 'tags[tag]' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
217
|
+
DuplicateMethodCall: RedCloth#pba calls '$1.length' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
218
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls '@pre_list.last << line' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
219
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls '@pre_list.last' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
220
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'codepre - used_offtags.length > 0' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
221
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'codepre - used_offtags.length' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
222
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'codepre.zero?' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
223
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'htmlesc( line, :NoQuotes )' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
224
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'used_offtags.length' 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
225
|
+
DuplicateMethodCall: RedCloth#rip_offtags calls 'used_offtags['notextile']' 3 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
226
|
+
FeatureEnvy: RedCloth#block_markdown_atx refers to 'text' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
227
|
+
FeatureEnvy: RedCloth#block_markdown_setext refers to 'text' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
228
|
+
FeatureEnvy: RedCloth#block_textile_lists refers to 'depth' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
229
|
+
FeatureEnvy: RedCloth#blocks refers to 'blk' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
230
|
+
FeatureEnvy: RedCloth#clean_white_space refers to 'text' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
231
|
+
FeatureEnvy: RedCloth#pba refers to 'text' more than self (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Feature-Envy.md]
|
232
|
+
InstanceVariableAssumption: RedCloth assumes too much for instance variable '@lite_mode' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
233
|
+
InstanceVariableAssumption: RedCloth assumes too much for instance variable '@pre_list' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
234
|
+
InstanceVariableAssumption: RedCloth assumes too much for instance variable '@rules' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
235
|
+
InstanceVariableAssumption: RedCloth assumes too much for instance variable '@shelf' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
236
|
+
InstanceVariableAssumption: RedCloth assumes too much for instance variable '@urlrefs' [https://github.com/troessner/reek/blob/master/docs/Instance-Variable-Assumption.md]
|
233
237
|
LongParameterList: RedCloth#textile_bq has 4 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
234
238
|
LongParameterList: RedCloth#textile_fn_ has 5 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
235
239
|
LongParameterList: RedCloth#textile_p has 4 parameters [https://github.com/troessner/reek/blob/master/docs/Long-Parameter-List.md]
|
236
240
|
ManualDispatch: RedCloth#block_textile_prefix manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
241
|
+
ManualDispatch: RedCloth#block_textile_prefix manually dispatches method call [https://github.com/troessner/reek/blob/master/docs/Manual-Dispatch.md]
|
237
242
|
NestedIterators: RedCloth#block_textile_lists contains iterators nested 3 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
238
243
|
NestedIterators: RedCloth#block_textile_table contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
239
244
|
NestedIterators: RedCloth#block_textile_table contains iterators nested 3 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
@@ -241,11 +246,11 @@ Feature: Basic smell detection
|
|
241
246
|
NestedIterators: RedCloth#clean_html contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
242
247
|
NestedIterators: RedCloth#inline contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
243
248
|
NestedIterators: RedCloth#inline_textile_span contains iterators nested 2 deep [https://github.com/troessner/reek/blob/master/docs/Nested-Iterators.md]
|
244
|
-
RepeatedConditional: RedCloth tests atts at least 6 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
245
|
-
RepeatedConditional: RedCloth tests codepre.zero? at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
246
|
-
RepeatedConditional: RedCloth tests href at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
247
|
-
RepeatedConditional: RedCloth tests title at least 4 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
248
|
-
SubclassedFromCoreClass: RedCloth inherits from
|
249
|
+
RepeatedConditional: RedCloth tests 'atts' at least 6 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
250
|
+
RepeatedConditional: RedCloth tests 'codepre.zero?' at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
251
|
+
RepeatedConditional: RedCloth tests 'href' at least 3 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
252
|
+
RepeatedConditional: RedCloth tests 'title' at least 4 times [https://github.com/troessner/reek/blob/master/docs/Repeated-Conditional.md]
|
253
|
+
SubclassedFromCoreClass: RedCloth inherits from core class 'String' [https://github.com/troessner/reek/blob/master/docs/Subclassed-From-Core-Class.md]
|
249
254
|
TooManyConstants: RedCloth has 45 constants [https://github.com/troessner/reek/blob/master/docs/Too-Many-Constants.md]
|
250
255
|
TooManyMethods: RedCloth has at least 44 methods [https://github.com/troessner/reek/blob/master/docs/Too-Many-Methods.md]
|
251
256
|
TooManyStatements: RedCloth#block_markdown_bq has approx 6 statements [https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md]
|
@@ -301,5 +306,5 @@ Feature: Basic smell detection
|
|
301
306
|
UtilityFunction: RedCloth#lT doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
|
302
307
|
UtilityFunction: RedCloth#no_textile doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
|
303
308
|
UtilityFunction: RedCloth#v_align doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
|
304
|
-
|
309
|
+
292 total warnings
|
305
310
|
"""
|
@@ -10,5 +10,5 @@ Feature: Smell - SubclassedFromCoreClass
|
|
10
10
|
Then it reports:
|
11
11
|
"""
|
12
12
|
my_hash.rb -- 1 warning:
|
13
|
-
[2]:SubclassedFromCoreClass: MyHash inherits from
|
13
|
+
[2]:SubclassedFromCoreClass: MyHash inherits from core class 'Hash' [https://github.com/troessner/reek/blob/master/docs/Subclassed-From-Core-Class.md]
|
14
14
|
"""
|
data/lib/reek/code_comment.rb
CHANGED
@@ -7,10 +7,19 @@ module Reek
|
|
7
7
|
# module, class and method definitions.
|
8
8
|
#
|
9
9
|
class CodeComment
|
10
|
-
CONFIGURATION_REGEX
|
10
|
+
CONFIGURATION_REGEX = /
|
11
|
+
:reek: # prefix
|
12
|
+
(\w+) # smell detector e.g.: UncommunicativeVariableName
|
13
|
+
(
|
14
|
+
:? # legacy separator
|
15
|
+
\s*
|
16
|
+
(\{.*?\}) # optional details in hash style e.g.: { max_methods: 30 }
|
17
|
+
)?
|
18
|
+
/x
|
11
19
|
SANITIZE_REGEX = /(#|\n|\s)+/ # Matches '#', newlines and > 1 whitespaces.
|
12
|
-
DISABLE_DETECTOR_CONFIGURATION = '
|
20
|
+
DISABLE_DETECTOR_CONFIGURATION = '{ enabled: false }'.freeze
|
13
21
|
MINIMUM_CONTENT_LENGTH = 2
|
22
|
+
LEGACY_SEPARATOR = ':'.freeze
|
14
23
|
|
15
24
|
attr_reader :config
|
16
25
|
|
@@ -23,8 +32,8 @@ module Reek
|
|
23
32
|
@original_comment = comment
|
24
33
|
@config = Hash.new { |hash, key| hash[key] = {} }
|
25
34
|
|
26
|
-
@original_comment.scan(CONFIGURATION_REGEX) do |
|
27
|
-
@config.merge! YAML.load(
|
35
|
+
@original_comment.scan(CONFIGURATION_REGEX) do |detector, _option_string, options|
|
36
|
+
@config.merge! detector => YAML.load(options || DISABLE_DETECTOR_CONFIGURATION)
|
28
37
|
end
|
29
38
|
end
|
30
39
|
|