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.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +0 -9
  3. data/.travis.yml +1 -2
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +1 -1
  6. data/docs/API.md +4 -4
  7. data/docs/Duplicate-Method-Call.md +68 -1
  8. data/docs/How-To-Write-New-Detectors.md +4 -4
  9. data/docs/Reek-Driven-Development.md +19 -12
  10. data/features/command_line_interface/options.feature +2 -2
  11. data/features/reports/json.feature +3 -3
  12. data/features/reports/reports.feature +4 -4
  13. data/features/reports/yaml.feature +3 -3
  14. data/lib/reek/source/source_code.rb +2 -2
  15. data/lib/reek/version.rb +1 -1
  16. data/spec/reek/ast/node_spec.rb +2 -2
  17. data/spec/reek/code_comment_spec.rb +6 -6
  18. data/spec/reek/context/code_context_spec.rb +2 -2
  19. data/spec/reek/context_builder_spec.rb +30 -30
  20. data/spec/reek/examiner_spec.rb +6 -6
  21. data/spec/reek/report/json_report_spec.rb +2 -2
  22. data/spec/reek/smell_detectors/attribute_spec.rb +32 -32
  23. data/spec/reek/smell_detectors/boolean_parameter_spec.rb +4 -4
  24. data/spec/reek/smell_detectors/class_variable_spec.rb +16 -16
  25. data/spec/reek/smell_detectors/control_parameter_spec.rb +18 -18
  26. data/spec/reek/smell_detectors/data_clump_spec.rb +16 -16
  27. data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +20 -20
  28. data/spec/reek/smell_detectors/feature_envy_spec.rb +32 -32
  29. data/spec/reek/smell_detectors/instance_variable_assumption_spec.rb +12 -12
  30. data/spec/reek/smell_detectors/irresponsible_module_spec.rb +36 -36
  31. data/spec/reek/smell_detectors/long_parameter_list_spec.rb +6 -6
  32. data/spec/reek/smell_detectors/long_yield_list_spec.rb +6 -6
  33. data/spec/reek/smell_detectors/manual_dispatch_spec.rb +10 -10
  34. data/spec/reek/smell_detectors/missing_safe_method_spec.rb +8 -8
  35. data/spec/reek/smell_detectors/module_initialize_spec.rb +12 -12
  36. data/spec/reek/smell_detectors/nested_iterators_spec.rb +48 -48
  37. data/spec/reek/smell_detectors/nil_check_spec.rb +16 -16
  38. data/spec/reek/smell_detectors/repeated_conditional_spec.rb +8 -8
  39. data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +10 -10
  40. data/spec/reek/smell_detectors/too_many_constants_spec.rb +22 -22
  41. data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +16 -16
  42. data/spec/reek/smell_detectors/too_many_methods_spec.rb +6 -6
  43. data/spec/reek/smell_detectors/too_many_statements_spec.rb +10 -10
  44. data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +2 -2
  45. data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +2 -2
  46. data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +4 -4
  47. data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +18 -18
  48. data/spec/reek/smell_detectors/unused_parameters_spec.rb +4 -4
  49. data/spec/reek/smell_detectors/unused_private_method_spec.rb +24 -24
  50. data/spec/reek/smell_detectors/utility_function_spec.rb +30 -30
  51. metadata +3 -3
@@ -3,11 +3,11 @@ require_lib 'reek/smell_detectors/utility_function'
3
3
 
4
4
  RSpec.describe Reek::SmellDetectors::UtilityFunction do
5
5
  it 'reports the right values' do
6
- src = <<-EOS
6
+ src = <<-RUBY
7
7
  def alfa(bravo)
8
8
  bravo.charlie.delta
9
9
  end
10
- EOS
10
+ RUBY
11
11
 
12
12
  expect(src).to reek_of(:UtilityFunction,
13
13
  lines: [1],
@@ -48,7 +48,7 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
48
48
  end
49
49
 
50
50
  it 'recognises a deep call' do
51
- src = <<-EOS
51
+ src = <<-RUBY
52
52
  class Alfa
53
53
  def bravo(charlie)
54
54
  charlie.each { |delta| foxtrot(delta) }
@@ -58,7 +58,7 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
58
58
  @india << golf
59
59
  end
60
60
  end
61
- EOS
61
+ RUBY
62
62
 
63
63
  expect(src).not_to reek_of(:UtilityFunction)
64
64
  end
@@ -113,49 +113,49 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
113
113
 
114
114
  context 'when defined by using `module_function`' do
115
115
  it 'does not report UtilityFunction also when using multiple arguments' do
116
- src = <<-EOS
116
+ src = <<-RUBY
117
117
  class Alfa
118
118
  def bravo(charlie) charlie.to_s; end
119
119
  def delta(echo) echo.to_s; end
120
120
  module_function :bravo, :delta
121
121
  end
122
- EOS
122
+ RUBY
123
123
 
124
124
  expect(src).not_to reek_of(:UtilityFunction)
125
125
  end
126
126
 
127
127
  it 'does not report module functions defined by earlier modifier' do
128
- src = <<-EOF
128
+ src = <<-RUBY
129
129
  module Alfa
130
130
  module_function
131
131
  def bravo(charlie) charlie.to_s; end
132
132
  end
133
- EOF
133
+ RUBY
134
134
 
135
135
  expect(src).not_to reek_of(:UtilityFunction)
136
136
  end
137
137
 
138
138
  it 'reports functions preceded by canceled modifier' do
139
- src = <<-EOF
139
+ src = <<-RUBY
140
140
  module Alfa
141
141
  module_function
142
142
  public
143
143
  def bravo(charlie) charlie.to_s; end
144
144
  end
145
- EOF
145
+ RUBY
146
146
 
147
147
  expect(src).to reek_of(:UtilityFunction, context: 'Alfa#bravo')
148
148
  end
149
149
 
150
150
  it 'does not report when module_function is called in separate scope' do
151
- src = <<-EOF
151
+ src = <<-RUBY
152
152
  class Alfa
153
153
  def bravo(charlie) charlie.to_s; end
154
154
  begin
155
155
  module_function :bravo
156
156
  end
157
157
  end
158
- EOF
158
+ RUBY
159
159
  expect(src).not_to reek_of(:UtilityFunction)
160
160
  end
161
161
  end
@@ -163,27 +163,27 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
163
163
 
164
164
  describe 'method visibility' do
165
165
  it 'reports private methods' do
166
- src = <<-EOS
166
+ src = <<-RUBY
167
167
  class Alfa
168
168
  private
169
169
  def bravo(charlie)
170
170
  charlie.delta.echo
171
171
  end
172
172
  end
173
- EOS
173
+ RUBY
174
174
 
175
175
  expect(src).to reek_of(:UtilityFunction, context: 'Alfa#bravo')
176
176
  end
177
177
 
178
178
  it 'reports protected methods' do
179
- src = <<-EOS
179
+ src = <<-RUBY
180
180
  class Alfa
181
181
  protected
182
182
  def bravo(charlie)
183
183
  charlie.delta.echo
184
184
  end
185
185
  end
186
- EOS
186
+ RUBY
187
187
 
188
188
  expect(src).to reek_of(:UtilityFunction, context: 'Alfa#bravo')
189
189
  end
@@ -196,13 +196,13 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
196
196
 
197
197
  context 'when examining public methods' do
198
198
  it 'still reports UtilityFunction' do
199
- src = <<-EOS
199
+ src = <<-RUBY
200
200
  class Alfa
201
201
  def bravo(charlie)
202
202
  charlie.delta.echo
203
203
  end
204
204
  end
205
- EOS
205
+ RUBY
206
206
 
207
207
  expect(src).to reek_of(:UtilityFunction, context: 'Alfa#bravo').with_config(config)
208
208
  end
@@ -210,26 +210,26 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
210
210
 
211
211
  context 'when examining private methods' do
212
212
  it 'does not report UtilityFunction' do
213
- src = <<-EOS
213
+ src = <<-RUBY
214
214
  class Alfa
215
215
  private
216
216
  def bravo(charlie)
217
217
  charlie.delta.echo
218
218
  end
219
219
  end
220
- EOS
220
+ RUBY
221
221
 
222
222
  expect(src).not_to reek_of(:UtilityFunction).with_config(config)
223
223
  end
224
224
 
225
225
  it 'does not report UtilityFunction when private is used as a def modifier' do
226
- src = <<-EOS
226
+ src = <<-RUBY
227
227
  class Alfa
228
228
  private def bravo(charlie)
229
229
  charlie.delta.echo
230
230
  end
231
231
  end
232
- EOS
232
+ RUBY
233
233
 
234
234
  expect(src).not_to reek_of(:UtilityFunction).with_config(config)
235
235
  end
@@ -237,26 +237,26 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
237
237
 
238
238
  context 'when examining protected methods' do
239
239
  it 'does not report UtilityFunction' do
240
- src = <<-EOS
240
+ src = <<-RUBY
241
241
  class Alfa
242
242
  protected
243
243
  def bravo(charlie)
244
244
  charlie.delta.echo
245
245
  end
246
246
  end
247
- EOS
247
+ RUBY
248
248
 
249
249
  expect(src).not_to reek_of(:UtilityFunction).with_config(config)
250
250
  end
251
251
 
252
252
  it 'does not report UtilityFunction when protected is used as a def modifier' do
253
- src = <<-EOS
253
+ src = <<-RUBY
254
254
  class Alfa
255
255
  protected def bravo(charlie)
256
256
  charlie.delta.echo
257
257
  end
258
258
  end
259
- EOS
259
+ RUBY
260
260
 
261
261
  expect(src).not_to reek_of(:UtilityFunction).with_config(config)
262
262
  end
@@ -265,27 +265,27 @@ RSpec.describe Reek::SmellDetectors::UtilityFunction do
265
265
 
266
266
  describe 'disabling with a comment' do
267
267
  it 'disables the method following the comment' do
268
- src = <<-EOS
268
+ src = <<-RUBY
269
269
  class Alfa
270
270
  # :reek:UtilityFunction
271
271
  def bravo(charlie)
272
272
  charlie.delta.echo
273
273
  end
274
274
  end
275
- EOS
275
+ RUBY
276
276
 
277
277
  expect(src).not_to reek_of(:UtilityFunction)
278
278
  end
279
279
 
280
280
  it 'disables a method when it has a visibility modifier' do
281
- src = <<-EOS
281
+ src = <<-RUBY
282
282
  class Alfa
283
283
  # :reek:UtilityFunction
284
284
  private def bravo(charlie)
285
285
  charlie.delta.echo
286
286
  end
287
287
  end
288
- EOS
288
+ RUBY
289
289
 
290
290
  expect(src).not_to reek_of(:UtilityFunction)
291
291
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reek
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rutherford
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-02-08 00:00:00.000000000 Z
14
+ date: 2019-03-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: codeclimate-engine-rb
@@ -500,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
500
500
  version: '0'
501
501
  requirements: []
502
502
  rubyforge_project:
503
- rubygems_version: 2.7.7
503
+ rubygems_version: 2.5.2.3
504
504
  signing_key:
505
505
  specification_version: 4
506
506
  summary: Code smell detector for Ruby