reek 5.3.1 → 5.3.2
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.
- checksums.yaml +5 -5
- data/.rubocop.yml +0 -9
- data/.travis.yml +1 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/docs/API.md +4 -4
- data/docs/Duplicate-Method-Call.md +68 -1
- data/docs/How-To-Write-New-Detectors.md +4 -4
- data/docs/Reek-Driven-Development.md +19 -12
- data/features/command_line_interface/options.feature +2 -2
- data/features/reports/json.feature +3 -3
- data/features/reports/reports.feature +4 -4
- data/features/reports/yaml.feature +3 -3
- data/lib/reek/source/source_code.rb +2 -2
- data/lib/reek/version.rb +1 -1
- data/spec/reek/ast/node_spec.rb +2 -2
- data/spec/reek/code_comment_spec.rb +6 -6
- data/spec/reek/context/code_context_spec.rb +2 -2
- data/spec/reek/context_builder_spec.rb +30 -30
- data/spec/reek/examiner_spec.rb +6 -6
- data/spec/reek/report/json_report_spec.rb +2 -2
- data/spec/reek/smell_detectors/attribute_spec.rb +32 -32
- data/spec/reek/smell_detectors/boolean_parameter_spec.rb +4 -4
- data/spec/reek/smell_detectors/class_variable_spec.rb +16 -16
- data/spec/reek/smell_detectors/control_parameter_spec.rb +18 -18
- data/spec/reek/smell_detectors/data_clump_spec.rb +16 -16
- data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +20 -20
- data/spec/reek/smell_detectors/feature_envy_spec.rb +32 -32
- data/spec/reek/smell_detectors/instance_variable_assumption_spec.rb +12 -12
- data/spec/reek/smell_detectors/irresponsible_module_spec.rb +36 -36
- data/spec/reek/smell_detectors/long_parameter_list_spec.rb +6 -6
- data/spec/reek/smell_detectors/long_yield_list_spec.rb +6 -6
- data/spec/reek/smell_detectors/manual_dispatch_spec.rb +10 -10
- data/spec/reek/smell_detectors/missing_safe_method_spec.rb +8 -8
- data/spec/reek/smell_detectors/module_initialize_spec.rb +12 -12
- data/spec/reek/smell_detectors/nested_iterators_spec.rb +48 -48
- data/spec/reek/smell_detectors/nil_check_spec.rb +16 -16
- data/spec/reek/smell_detectors/repeated_conditional_spec.rb +8 -8
- data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +10 -10
- data/spec/reek/smell_detectors/too_many_constants_spec.rb +22 -22
- data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +16 -16
- data/spec/reek/smell_detectors/too_many_methods_spec.rb +6 -6
- data/spec/reek/smell_detectors/too_many_statements_spec.rb +10 -10
- data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +2 -2
- data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +2 -2
- data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +4 -4
- data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +18 -18
- data/spec/reek/smell_detectors/unused_parameters_spec.rb +4 -4
- data/spec/reek/smell_detectors/unused_private_method_spec.rb +24 -24
- data/spec/reek/smell_detectors/utility_function_spec.rb +30 -30
- metadata +3 -3
@@ -7,14 +7,14 @@ RSpec.describe Reek::SmellDetectors::TooManyMethods do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
10
|
-
src = <<-
|
10
|
+
src = <<-RUBY
|
11
11
|
class Alfa
|
12
12
|
def bravo; end
|
13
13
|
def charlie; end
|
14
14
|
def delta; end
|
15
15
|
def echo; end
|
16
16
|
end
|
17
|
-
|
17
|
+
RUBY
|
18
18
|
|
19
19
|
expect(src).to reek_of(:TooManyMethods,
|
20
20
|
lines: [1],
|
@@ -25,19 +25,19 @@ RSpec.describe Reek::SmellDetectors::TooManyMethods do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'does not report if we stay below max_methods' do
|
28
|
-
src = <<-
|
28
|
+
src = <<-RUBY
|
29
29
|
class Alfa
|
30
30
|
def bravo; end
|
31
31
|
def charlie; end
|
32
32
|
def delta; end
|
33
33
|
end
|
34
|
-
|
34
|
+
RUBY
|
35
35
|
|
36
36
|
expect(src).not_to reek_of(:TooManyMethods).with_config(config)
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'stops at a nested module' do
|
40
|
-
src = <<-
|
40
|
+
src = <<-RUBY
|
41
41
|
class Alfa
|
42
42
|
def bravo; end
|
43
43
|
def charlie; end
|
@@ -47,7 +47,7 @@ RSpec.describe Reek::SmellDetectors::TooManyMethods do
|
|
47
47
|
def echo; end
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
RUBY
|
51
51
|
|
52
52
|
expect(src).not_to reek_of(:TooManyMethods).with_config(config)
|
53
53
|
end
|
@@ -7,7 +7,7 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
10
|
-
src = <<-
|
10
|
+
src = <<-RUBY
|
11
11
|
class Alfa
|
12
12
|
def bravo
|
13
13
|
charlie = 1
|
@@ -15,7 +15,7 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
15
15
|
echo = 3
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
RUBY
|
19
19
|
|
20
20
|
expect(src).to reek_of(:TooManyStatements,
|
21
21
|
lines: [2],
|
@@ -26,7 +26,7 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'does count all occurences' do
|
29
|
-
src = <<-
|
29
|
+
src = <<-RUBY
|
30
30
|
class Alfa
|
31
31
|
def bravo
|
32
32
|
charlie = 1
|
@@ -40,7 +40,7 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
40
40
|
india = 3
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
RUBY
|
44
44
|
|
45
45
|
expect(src).
|
46
46
|
to reek_of(:TooManyStatements, lines: [2], context: 'Alfa#bravo').with_config(config).
|
@@ -48,20 +48,20 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'does not report short methods' do
|
51
|
-
src = <<-
|
51
|
+
src = <<-RUBY
|
52
52
|
class Alfa
|
53
53
|
def bravo
|
54
54
|
charlie = 1
|
55
55
|
delta = 2
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
RUBY
|
59
59
|
|
60
60
|
expect(src).not_to reek_of(:TooManyStatements).with_config(config)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'does not report initialize' do
|
64
|
-
src = <<-
|
64
|
+
src = <<-RUBY
|
65
65
|
class Alfa
|
66
66
|
def initialize
|
67
67
|
charlie = 1
|
@@ -69,13 +69,13 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
69
69
|
echo = 3
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
RUBY
|
73
73
|
|
74
74
|
expect(src).not_to reek_of(:TooManyStatements).with_config(config)
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'reports long inner block' do
|
78
|
-
src = <<-
|
78
|
+
src = <<-RUBY
|
79
79
|
def long
|
80
80
|
self.each do |x|
|
81
81
|
charlie = 1
|
@@ -83,7 +83,7 @@ RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
|
83
83
|
echo = 3
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
RUBY
|
87
87
|
|
88
88
|
expect(src).to reek_of(:TooManyStatements).with_config(config)
|
89
89
|
end
|
@@ -3,9 +3,9 @@ require_lib 'reek/smell_detectors/uncommunicative_method_name'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UncommunicativeMethodName do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
def m; end
|
8
|
-
|
8
|
+
RUBY
|
9
9
|
|
10
10
|
expect(src).to reek_of(:UncommunicativeMethodName,
|
11
11
|
lines: [1],
|
@@ -3,10 +3,10 @@ require_lib 'reek/smell_detectors/uncommunicative_module_name'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UncommunicativeModuleName do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
class K
|
8
8
|
end
|
9
|
-
|
9
|
+
RUBY
|
10
10
|
|
11
11
|
expect(src).to reek_of(:UncommunicativeModuleName,
|
12
12
|
lines: [1],
|
@@ -3,11 +3,11 @@ require_lib 'reek/smell_detectors/uncommunicative_parameter_name'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UncommunicativeParameterName do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
def alfa(x)
|
8
8
|
x
|
9
9
|
end
|
10
|
-
|
10
|
+
RUBY
|
11
11
|
|
12
12
|
expect(src).to reek_of(:UncommunicativeParameterName,
|
13
13
|
lines: [1],
|
@@ -18,11 +18,11 @@ RSpec.describe Reek::SmellDetectors::UncommunicativeParameterName do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'does count all occurences' do
|
21
|
-
src = <<-
|
21
|
+
src = <<-RUBY
|
22
22
|
def alfa(x, y)
|
23
23
|
[x, y]
|
24
24
|
end
|
25
|
-
|
25
|
+
RUBY
|
26
26
|
|
27
27
|
expect(src).
|
28
28
|
to reek_of(:UncommunicativeParameterName, lines: [1], name: 'x').
|
@@ -3,11 +3,11 @@ require_lib 'reek/smell_detectors/uncommunicative_variable_name'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
def alfa
|
8
8
|
x = 5
|
9
9
|
end
|
10
|
-
|
10
|
+
RUBY
|
11
11
|
|
12
12
|
expect(src).to reek_of(:UncommunicativeVariableName,
|
13
13
|
lines: [2],
|
@@ -18,12 +18,12 @@ RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'does count all occurences' do
|
21
|
-
src = <<-
|
21
|
+
src = <<-RUBY
|
22
22
|
def alfa
|
23
23
|
x = 3
|
24
24
|
y = 7
|
25
25
|
end
|
26
|
-
|
26
|
+
RUBY
|
27
27
|
|
28
28
|
expect(src).to reek_of(:UncommunicativeVariableName, lines: [2], name: 'x').
|
29
29
|
and reek_of(:UncommunicativeVariableName, lines: [3], name: 'y')
|
@@ -80,64 +80,64 @@ RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
|
|
80
80
|
|
81
81
|
context 'when examining block parameters' do
|
82
82
|
it 'reports all relevant block parameters' do
|
83
|
-
src = <<-
|
83
|
+
src = <<-RUBY
|
84
84
|
def alfa
|
85
85
|
@bravo.map { |x, y| x + y }
|
86
86
|
end
|
87
|
-
|
87
|
+
RUBY
|
88
88
|
|
89
89
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x').
|
90
90
|
and reek_of(:UncommunicativeVariableName, name: 'y')
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'reports block parameters used outside of methods' do
|
94
|
-
src = <<-
|
94
|
+
src = <<-RUBY
|
95
95
|
class Alfa
|
96
96
|
@bravo.map { |x| x * 2 }
|
97
97
|
end
|
98
|
-
|
98
|
+
RUBY
|
99
99
|
|
100
100
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x')
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'reports splatted block parameters correctly' do
|
104
|
-
src = <<-
|
104
|
+
src = <<-RUBY
|
105
105
|
def alfa
|
106
106
|
@bravo.map { |*y| y << 1 }
|
107
107
|
end
|
108
|
-
|
108
|
+
RUBY
|
109
109
|
|
110
110
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'y')
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'reports nested block parameters' do
|
114
|
-
src = <<-
|
114
|
+
src = <<-RUBY
|
115
115
|
def alfa
|
116
116
|
@bravo.map { |(x, y)| x + y }
|
117
117
|
end
|
118
|
-
|
118
|
+
RUBY
|
119
119
|
|
120
120
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x').
|
121
121
|
and reek_of(:UncommunicativeVariableName, name: 'y')
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'reports splatted nested block parameters' do
|
125
|
-
src = <<-
|
125
|
+
src = <<-RUBY
|
126
126
|
def def alfa
|
127
127
|
@bravo.map { |(x, *y)| x + y }
|
128
128
|
end
|
129
|
-
|
129
|
+
RUBY
|
130
130
|
|
131
131
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x').
|
132
132
|
and reek_of(:UncommunicativeVariableName, name: 'y')
|
133
133
|
end
|
134
134
|
|
135
135
|
it 'reports deeply nested block parameters' do
|
136
|
-
src = <<-
|
136
|
+
src = <<-RUBY
|
137
137
|
def alfa
|
138
138
|
@bravo.map { |(x, (y, z))| x + y + z }
|
139
139
|
end
|
140
|
-
|
140
|
+
RUBY
|
141
141
|
|
142
142
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x').
|
143
143
|
and reek_of(:UncommunicativeVariableName, name: 'y').
|
@@ -145,11 +145,11 @@ RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it 'reports shadowed block parameters' do
|
148
|
-
src = <<-
|
148
|
+
src = <<-RUBY
|
149
149
|
def alfa
|
150
150
|
@bravo.map { |x; y| y = x * 2 }
|
151
151
|
end
|
152
|
-
|
152
|
+
RUBY
|
153
153
|
|
154
154
|
expect(src).to reek_of(:UncommunicativeVariableName, name: 'x').
|
155
155
|
and reek_of(:UncommunicativeVariableName, name: 'y')
|
@@ -3,10 +3,10 @@ require_lib 'reek/smell_detectors/unused_parameters'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UnusedParameters do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
def alfa(bravo)
|
8
8
|
end
|
9
|
-
|
9
|
+
RUBY
|
10
10
|
|
11
11
|
expect(src).to reek_of(:UnusedParameters,
|
12
12
|
lines: [1],
|
@@ -17,10 +17,10 @@ RSpec.describe Reek::SmellDetectors::UnusedParameters do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'does count all occurences' do
|
20
|
-
src = <<-
|
20
|
+
src = <<-RUBY
|
21
21
|
def alfa(bravo, charlie)
|
22
22
|
end
|
23
|
-
|
23
|
+
RUBY
|
24
24
|
|
25
25
|
expect(src).
|
26
26
|
to reek_of(:UnusedParameters, lines: [1], name: 'bravo').
|
@@ -3,14 +3,14 @@ require_lib 'reek/smell_detectors/unused_private_method'
|
|
3
3
|
|
4
4
|
RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
5
5
|
it 'reports the right values' do
|
6
|
-
src = <<-
|
6
|
+
src = <<-RUBY
|
7
7
|
class Alfa
|
8
8
|
private
|
9
9
|
|
10
10
|
def charlie
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
RUBY
|
14
14
|
|
15
15
|
expect(src).to reek_of(:UnusedPrivateMethod,
|
16
16
|
lines: [4],
|
@@ -21,7 +21,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'does count all occurences' do
|
24
|
-
src = <<-
|
24
|
+
src = <<-RUBY
|
25
25
|
class Alfa
|
26
26
|
private
|
27
27
|
|
@@ -31,7 +31,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
31
31
|
def charlie
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
RUBY
|
35
35
|
|
36
36
|
expect(src).
|
37
37
|
to reek_of(:UnusedPrivateMethod, lines: [4], name: 'charlie').
|
@@ -40,13 +40,13 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
40
40
|
|
41
41
|
context 'when a class has unused private methods' do
|
42
42
|
it 'reports instance methods' do
|
43
|
-
source = <<-
|
43
|
+
source = <<-RUBY
|
44
44
|
class Alfa
|
45
45
|
private
|
46
46
|
def bravo; end
|
47
47
|
def charlie; end
|
48
48
|
end
|
49
|
-
|
49
|
+
RUBY
|
50
50
|
|
51
51
|
expect(source).
|
52
52
|
to reek_of(:UnusedPrivateMethod, name: 'bravo').
|
@@ -54,14 +54,14 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'reports instance methods in the correct class' do
|
57
|
-
source = <<-
|
57
|
+
source = <<-RUBY
|
58
58
|
class Alfa
|
59
59
|
class Bravo
|
60
60
|
private
|
61
61
|
def charlie; end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
RUBY
|
65
65
|
|
66
66
|
expect(source).
|
67
67
|
to reek_of(:UnusedPrivateMethod, context: 'Alfa::Bravo', name: 'charlie').
|
@@ -69,7 +69,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'discounts calls to identically named methods in nested classes' do
|
72
|
-
source = <<-
|
72
|
+
source = <<-RUBY
|
73
73
|
class Alfa
|
74
74
|
class Bravo
|
75
75
|
def bravo
|
@@ -83,7 +83,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
83
83
|
private
|
84
84
|
def charlie; end
|
85
85
|
end
|
86
|
-
|
86
|
+
RUBY
|
87
87
|
|
88
88
|
expect(source).
|
89
89
|
to reek_of(:UnusedPrivateMethod, context: 'Alfa', name: 'charlie').
|
@@ -91,13 +91,13 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'creates warnings correctly' do
|
94
|
-
source = <<-
|
94
|
+
source = <<-RUBY
|
95
95
|
class Alfa
|
96
96
|
private
|
97
97
|
def bravo; end
|
98
98
|
def charlie; end
|
99
99
|
end
|
100
|
-
|
100
|
+
RUBY
|
101
101
|
|
102
102
|
expect(source).
|
103
103
|
to reek_of(:UnusedPrivateMethod, name: 'bravo', lines: [3]).
|
@@ -105,11 +105,11 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'reports instance methods defined as private with a modifier' do
|
108
|
-
source = <<-
|
108
|
+
source = <<-RUBY
|
109
109
|
class Alfa
|
110
110
|
private def bravo; end
|
111
111
|
end
|
112
|
-
|
112
|
+
RUBY
|
113
113
|
|
114
114
|
expect(source).
|
115
115
|
to reek_of(:UnusedPrivateMethod, name: 'bravo')
|
@@ -118,14 +118,14 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
118
118
|
|
119
119
|
context 'when the detector is configured via a source code comment' do
|
120
120
|
it 'does not report methods we excluded' do
|
121
|
-
source = <<-
|
121
|
+
source = <<-RUBY
|
122
122
|
# :reek:UnusedPrivateMethod { exclude: [ bravo ] }
|
123
123
|
class Alfa
|
124
124
|
private
|
125
125
|
def bravo; end
|
126
126
|
def charlie; end
|
127
127
|
end
|
128
|
-
|
128
|
+
RUBY
|
129
129
|
|
130
130
|
expect(source).
|
131
131
|
to reek_of(:UnusedPrivateMethod, name: 'charlie').
|
@@ -135,7 +135,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
135
135
|
|
136
136
|
context 'when a class has only used private methods' do
|
137
137
|
it 'reports nothing' do
|
138
|
-
source = <<-
|
138
|
+
source = <<-RUBY
|
139
139
|
class Alfa
|
140
140
|
def bravo
|
141
141
|
charlie
|
@@ -144,7 +144,7 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
144
144
|
private
|
145
145
|
def charlie; end
|
146
146
|
end
|
147
|
-
|
147
|
+
RUBY
|
148
148
|
|
149
149
|
expect(source).not_to reek_of(:UnusedPrivateMethod)
|
150
150
|
end
|
@@ -152,12 +152,12 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
152
152
|
|
153
153
|
context 'when a class has unused protected methods' do
|
154
154
|
it 'reports nothing' do
|
155
|
-
source = <<-
|
155
|
+
source = <<-RUBY
|
156
156
|
class Alfa
|
157
157
|
protected
|
158
158
|
def bravo; end
|
159
159
|
end
|
160
|
-
|
160
|
+
RUBY
|
161
161
|
|
162
162
|
expect(source).not_to reek_of(:UnusedPrivateMethod)
|
163
163
|
end
|
@@ -165,11 +165,11 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
165
165
|
|
166
166
|
context 'when a class has unused public methods' do
|
167
167
|
it 'reports nothing' do
|
168
|
-
source = <<-
|
168
|
+
source = <<-RUBY
|
169
169
|
class Alfa
|
170
170
|
def bravo; end
|
171
171
|
end
|
172
|
-
|
172
|
+
RUBY
|
173
173
|
|
174
174
|
expect(source).not_to reek_of(:UnusedPrivateMethod)
|
175
175
|
end
|
@@ -177,13 +177,13 @@ RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
|
177
177
|
|
178
178
|
describe 'preventing methods from being reported' do
|
179
179
|
let(:source) do
|
180
|
-
<<-
|
180
|
+
<<-RUBY
|
181
181
|
class Alfa
|
182
182
|
private
|
183
183
|
def bravo; end
|
184
184
|
def charlie; end
|
185
185
|
end
|
186
|
-
|
186
|
+
RUBY
|
187
187
|
end
|
188
188
|
|
189
189
|
it 'excludes them via direct match in the app configuration' do
|