reek 4.4.1 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +46 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +5 -1
  5. data/docs/Duplicate-Method-Call.md +96 -0
  6. data/docs/How-To-Write-New-Detectors.md +16 -0
  7. data/docs/Large-Class.md +2 -1
  8. data/docs/Simulated-Polymorphism.md +1 -1
  9. data/features/configuration_via_source_comments/erroneous_source_comments.feature +39 -0
  10. data/lib/reek/ast/node.rb +4 -0
  11. data/lib/reek/code_comment.rb +11 -3
  12. data/lib/reek/context/code_context.rb +3 -1
  13. data/lib/reek/context/module_context.rb +1 -1
  14. data/lib/reek/errors.rb +32 -0
  15. data/lib/reek/examiner.rb +6 -1
  16. data/lib/reek/rake/task.rb +0 -2
  17. data/lib/reek/smells/boolean_parameter.rb +1 -1
  18. data/lib/reek/smells/class_variable.rb +2 -2
  19. data/lib/reek/smells/instance_variable_assumption.rb +1 -1
  20. data/lib/reek/smells/prima_donna_method.rb +18 -17
  21. data/lib/reek/smells/smell_detector.rb +19 -2
  22. data/lib/reek/smells/unused_private_method.rb +1 -1
  23. data/lib/reek/spec/should_reek_of.rb +2 -0
  24. data/lib/reek/version.rb +1 -1
  25. data/spec/factories/factories.rb +11 -0
  26. data/spec/quality/reek_source_spec.rb +1 -1
  27. data/spec/reek/ast/node_spec.rb +40 -0
  28. data/spec/reek/ast/object_refs_spec.rb +20 -59
  29. data/spec/reek/ast/sexp_extensions_spec.rb +16 -19
  30. data/spec/reek/cli/application_spec.rb +25 -25
  31. data/spec/reek/cli/command/report_command_spec.rb +1 -2
  32. data/spec/reek/cli/command/todo_list_command_spec.rb +1 -1
  33. data/spec/reek/cli/options_spec.rb +7 -5
  34. data/spec/reek/code_comment_spec.rb +74 -44
  35. data/spec/reek/configuration/default_directive_spec.rb +3 -3
  36. data/spec/reek/configuration/directory_directives_spec.rb +10 -10
  37. data/spec/reek/configuration/excluded_paths_spec.rb +2 -2
  38. data/spec/reek/context/code_context_spec.rb +22 -26
  39. data/spec/reek/context/ghost_context_spec.rb +1 -1
  40. data/spec/reek/context/method_context_spec.rb +13 -7
  41. data/spec/reek/context/module_context_spec.rb +4 -4
  42. data/spec/reek/context/root_context_spec.rb +1 -1
  43. data/spec/reek/context_builder_spec.rb +34 -38
  44. data/spec/reek/examiner_spec.rb +43 -22
  45. data/spec/reek/rake/task_spec.rb +3 -3
  46. data/spec/reek/report/code_climate_formatter_spec.rb +42 -40
  47. data/spec/reek/report/code_climate_report_spec.rb +1 -1
  48. data/spec/reek/report/html_report_spec.rb +1 -1
  49. data/spec/reek/report/json_report_spec.rb +1 -1
  50. data/spec/reek/report/location_formatter_spec.rb +18 -16
  51. data/spec/reek/report/text_report_spec.rb +12 -8
  52. data/spec/reek/report/xml_report_spec.rb +1 -1
  53. data/spec/reek/report/yaml_report_spec.rb +1 -1
  54. data/spec/reek/report_spec.rb +4 -4
  55. data/spec/reek/smells/attribute_spec.rb +7 -10
  56. data/spec/reek/smells/boolean_parameter_spec.rb +14 -20
  57. data/spec/reek/smells/class_variable_spec.rb +6 -5
  58. data/spec/reek/smells/control_parameter_spec.rb +3 -2
  59. data/spec/reek/smells/data_clump_spec.rb +3 -6
  60. data/spec/reek/smells/duplicate_method_call_spec.rb +10 -14
  61. data/spec/reek/smells/feature_envy_spec.rb +34 -25
  62. data/spec/reek/smells/instance_variable_assumption_spec.rb +6 -9
  63. data/spec/reek/smells/irresponsible_module_spec.rb +3 -6
  64. data/spec/reek/smells/long_parameter_list_spec.rb +5 -7
  65. data/spec/reek/smells/long_yield_list_spec.rb +3 -6
  66. data/spec/reek/smells/manual_dispatch_spec.rb +3 -6
  67. data/spec/reek/smells/nested_iterators_spec.rb +10 -8
  68. data/spec/reek/smells/nil_check_spec.rb +2 -1
  69. data/spec/reek/smells/prima_donna_method_spec.rb +5 -8
  70. data/spec/reek/smells/smell_configuration_spec.rb +3 -3
  71. data/spec/reek/smells/smell_detector_spec.rb +10 -0
  72. data/spec/reek/smells/smell_repository_spec.rb +6 -6
  73. data/spec/reek/smells/smell_warning_spec.rb +35 -39
  74. data/spec/reek/smells/subclassed_from_core_class_spec.rb +5 -5
  75. data/spec/reek/smells/too_many_constants_spec.rb +10 -10
  76. data/spec/reek/smells/too_many_instance_variables_spec.rb +1 -1
  77. data/spec/reek/smells/too_many_methods_spec.rb +1 -1
  78. data/spec/reek/smells/too_many_statements_spec.rb +3 -6
  79. data/spec/reek/smells/uncommunicative_method_name_spec.rb +9 -6
  80. data/spec/reek/smells/uncommunicative_module_name_spec.rb +3 -3
  81. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +6 -9
  82. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +20 -24
  83. data/spec/reek/smells/unused_parameters_spec.rb +35 -24
  84. data/spec/reek/smells/unused_private_method_spec.rb +25 -33
  85. data/spec/reek/smells/utility_function_spec.rb +27 -14
  86. data/spec/reek/source/source_code_spec.rb +6 -6
  87. data/spec/reek/source/source_locator_spec.rb +34 -17
  88. data/spec/reek/spec/should_reek_of_spec.rb +17 -12
  89. data/spec/reek/spec/should_reek_only_of_spec.rb +5 -5
  90. data/spec/reek/spec/should_reek_spec.rb +3 -3
  91. data/spec/reek/tree_dresser_spec.rb +6 -4
  92. data/spec/spec_helper.rb +3 -0
  93. data/tasks/rubocop.rake +9 -3
  94. metadata +4 -2
@@ -17,7 +17,7 @@ RSpec.describe Reek::Smells::InstanceVariableAssumption do
17
17
  context: 'Alfa',
18
18
  message: "assumes too much for instance variable '@charlie'",
19
19
  source: 'string',
20
- assumption: :@charlie)
20
+ assumption: '@charlie')
21
21
  end
22
22
 
23
23
  it 'does count all occurences' do
@@ -34,15 +34,12 @@ RSpec.describe Reek::Smells::InstanceVariableAssumption do
34
34
 
35
35
  EOS
36
36
 
37
- expect(src).to reek_of(:InstanceVariableAssumption,
38
- lines: [1],
39
- assumption: :@charlie)
40
- expect(src).to reek_of(:InstanceVariableAssumption,
41
- lines: [1],
42
- assumption: :@echo)
37
+ expect(src).
38
+ to reek_of(:InstanceVariableAssumption, lines: [1], assumption: '@charlie').
39
+ and reek_of(:InstanceVariableAssumption, lines: [1], assumption: '@echo')
43
40
  end
44
41
 
45
- it 'should not report an empty class' do
42
+ it 'does not report an empty class' do
46
43
  src = <<-EOS
47
44
  class Alfa
48
45
  end
@@ -76,7 +73,7 @@ RSpec.describe Reek::Smells::InstanceVariableAssumption do
76
73
  end
77
74
  EOS
78
75
 
79
- expect(src).to reek_of(:InstanceVariableAssumption, assumption: :@delta)
76
+ expect(src).to reek_of(:InstanceVariableAssumption, assumption: '@delta')
80
77
  end
81
78
 
82
79
  it 'reports inner class even if outer class initializes the variable' do
@@ -25,12 +25,9 @@ RSpec.describe Reek::Smells::IrresponsibleModule do
25
25
  end
26
26
  EOS
27
27
 
28
- expect(src).to reek_of(:IrresponsibleModule,
29
- lines: [1],
30
- context: 'Alfa')
31
- expect(src).to reek_of(:IrresponsibleModule,
32
- lines: [4],
33
- context: 'Alfa::Charlie')
28
+ expect(src).
29
+ to reek_of(:IrresponsibleModule, lines: [1], context: 'Alfa').
30
+ and reek_of(:IrresponsibleModule, lines: [4], context: 'Alfa::Charlie')
34
31
  end
35
32
 
36
33
  %w(class module).each do |scope|
@@ -29,16 +29,14 @@ RSpec.describe Reek::Smells::LongParameterList do
29
29
  end
30
30
  EOS
31
31
 
32
- expect(src).to reek_of(:LongParameterList,
33
- lines: [2],
34
- context: 'Alfa#bravo')
35
- expect(src).to reek_of(:LongParameterList,
36
- lines: [5],
37
- context: 'Alfa#golf')
32
+ expect(src).
33
+ to reek_of(:LongParameterList, lines: [2], context: 'Alfa#bravo').
34
+ and reek_of(:LongParameterList, lines: [5], context: 'Alfa#golf')
38
35
  end
39
36
 
40
37
  it 'reports nothing for 3 parameters' do
41
- expect('def alfa(bravo, charlie, delta); end').not_to reek_of(:LongParameterList)
38
+ src = 'def alfa(bravo, charlie, delta); end'
39
+ expect(src).not_to reek_of(:LongParameterList)
42
40
  end
43
41
 
44
42
  it 'does not count an optional block' do
@@ -32,12 +32,9 @@ RSpec.describe Reek::Smells::LongYieldList do
32
32
  end
33
33
  EOS
34
34
 
35
- expect(src).to reek_of(:LongYieldList,
36
- lines: [3],
37
- context: 'Alfa#bravo')
38
- expect(src).to reek_of(:LongYieldList,
39
- lines: [7],
40
- context: 'Alfa#golf')
35
+ expect(src).
36
+ to reek_of(:LongYieldList, lines: [3], context: 'Alfa#bravo').
37
+ and reek_of(:LongYieldList, lines: [7], context: 'Alfa#golf')
41
38
  end
42
39
 
43
40
  it 'does not report yield with 3 parameters' do
@@ -31,12 +31,9 @@ RSpec.describe Reek::Smells::ManualDispatch do
31
31
  end
32
32
  EOS
33
33
 
34
- expect(src).to reek_of(:ManualDispatch,
35
- lines: [3],
36
- context: 'Alfa#bravo')
37
- expect(src).to reek_of(:ManualDispatch,
38
- lines: [7],
39
- context: 'Alfa#delta')
34
+ expect(src).
35
+ to reek_of(:ManualDispatch, lines: [3], context: 'Alfa#bravo').
36
+ and reek_of(:ManualDispatch, lines: [7], context: 'Alfa#delta')
40
37
  end
41
38
 
42
39
  it 'reports manual dispatch smell when using #respond_to? on implicit self' do
@@ -34,8 +34,9 @@ RSpec.describe Reek::Smells::NestedIterators do
34
34
  end
35
35
  EOS
36
36
 
37
- expect(src).to reek_of(:NestedIterators, lines: [3], depth: 2)
38
- expect(src).to reek_of(:NestedIterators, lines: [8], depth: 3)
37
+ expect(src).
38
+ to reek_of(:NestedIterators, lines: [3], depth: 2).
39
+ and reek_of(:NestedIterators, lines: [8], depth: 3)
39
40
  end
40
41
 
41
42
  it 'reports no smells with no iterators' do
@@ -53,7 +54,7 @@ RSpec.describe Reek::Smells::NestedIterators do
53
54
  expect(src).not_to reek_of(:NestedIterators)
54
55
  end
55
56
 
56
- it 'should not report nested iterators for Object#tap' do
57
+ it 'does not report nested iterators for Object#tap' do
57
58
  src = <<-EOS
58
59
  def alfa(bravo)
59
60
  bravo.tap do |charlie|
@@ -65,7 +66,7 @@ RSpec.describe Reek::Smells::NestedIterators do
65
66
  expect(src).not_to reek_of(:NestedIterators)
66
67
  end
67
68
 
68
- it 'should not report method with successive iterators' do
69
+ it 'does not report method with successive iterators' do
69
70
  src = <<-EOS
70
71
  def alfa
71
72
  @bravo.each { |charlie| charlie }
@@ -76,7 +77,7 @@ RSpec.describe Reek::Smells::NestedIterators do
76
77
  expect(src).not_to reek_of(:NestedIterators)
77
78
  end
78
79
 
79
- it 'should not report method with chained iterators' do
80
+ it 'does not report method with chained iterators' do
80
81
  src = <<-EOS
81
82
  def alfa
82
83
  bravo.sort_by { |charlie| charlie }.each { |delta| delta }
@@ -123,8 +124,9 @@ RSpec.describe Reek::Smells::NestedIterators do
123
124
  end
124
125
  EOS
125
126
 
126
- expect(src).not_to reek_of(:NestedIterators, depth: 2)
127
- expect(src).to reek_of(:NestedIterators, depth: 3, lines: [4])
127
+ expect(src).
128
+ to not_reek_of(:NestedIterators, depth: 2).
129
+ and reek_of(:NestedIterators, depth: 3, lines: [4])
128
130
  end
129
131
 
130
132
  it 'reports all lines on which nested iterators occur' do
@@ -314,7 +316,7 @@ RSpec.describe Reek::Smells::NestedIterators do
314
316
  expect(src).to reek_of(:NestedIterators, depth: 2).with_config(config)
315
317
  end
316
318
 
317
- it 'should report nested iterators with the ignored iterator between them' do
319
+ it 'reports nested iterators with the ignored iterator between them' do
318
320
  src = <<-EOS
319
321
  def alfa(bravo)
320
322
  bravo.each do |charlie|
@@ -30,7 +30,8 @@ RSpec.describe Reek::Smells::NilCheck do
30
30
  end
31
31
 
32
32
  it 'reports nothing when scope includes no nil checks' do
33
- expect('def alfa; end').not_to reek_of(:NilCheck)
33
+ src = 'def alfa; end'
34
+ expect(src).not_to reek_of(:NilCheck)
34
35
  end
35
36
 
36
37
  it 'reports when scope uses == nil' do
@@ -15,7 +15,7 @@ RSpec.describe Reek::Smells::PrimaDonnaMethod do
15
15
  context: 'Alfa',
16
16
  message: "has prima donna method 'bravo!'",
17
17
  source: 'string',
18
- name: :bravo!)
18
+ name: 'bravo!')
19
19
  end
20
20
 
21
21
  it 'does count all occurences' do
@@ -29,15 +29,12 @@ RSpec.describe Reek::Smells::PrimaDonnaMethod do
29
29
  end
30
30
  EOS
31
31
 
32
- expect(src).to reek_of(:PrimaDonnaMethod,
33
- lines: [1],
34
- name: :bravo!)
35
- expect(src).to reek_of(:PrimaDonnaMethod,
36
- lines: [1],
37
- name: :charlie!)
32
+ expect(src).
33
+ to reek_of(:PrimaDonnaMethod, lines: [1], name: 'bravo!').
34
+ and reek_of(:PrimaDonnaMethod, lines: [1], name: 'charlie!')
38
35
  end
39
36
 
40
- it 'should report nothing when method and bang counterpart exist' do
37
+ it 'reports nothing when method and bang counterpart exist' do
41
38
  src = <<-EOS
42
39
  class Alfa
43
40
  def bravo
@@ -27,7 +27,7 @@ RSpec.describe Reek::Smells::SmellConfiguration do
27
27
  expect(updated).to eq(base_config)
28
28
  end
29
29
 
30
- it 'should override single values' do
30
+ it 'overrides single values' do
31
31
  updated = smell_config.merge('enabled' => false)
32
32
  expect(updated).to eq('accept' => ['_'],
33
33
  'enabled' => false,
@@ -35,7 +35,7 @@ RSpec.describe Reek::Smells::SmellConfiguration do
35
35
  'reject' => [/^.$/, /[0-9]$/, /[A-Z]/])
36
36
  end
37
37
 
38
- it 'should override arrays of values' do
38
+ it 'overrides arrays of values' do
39
39
  updated = smell_config.merge('reject' => [/^.$/, /[3-9]$/])
40
40
  expect(updated).to eq('accept' => ['_'],
41
41
  'enabled' => true,
@@ -43,7 +43,7 @@ RSpec.describe Reek::Smells::SmellConfiguration do
43
43
  'reject' => [/^.$/, /[3-9]$/])
44
44
  end
45
45
 
46
- it 'should override multiple values' do
46
+ it 'overrides multiple values' do
47
47
  updated = smell_config.merge('accept' => [/[A-Z]$/], 'enabled' => false)
48
48
  expect(updated).to eq('accept' => [/[A-Z]$/],
49
49
  'enabled' => false,
@@ -33,4 +33,14 @@ RSpec.describe Reek::Smells::SmellDetector do
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ describe '.valid_detector?' do
38
+ it 'returns true for a valid detector' do
39
+ expect(described_class.valid_detector?('DuplicateMethodCall')).to be true
40
+ end
41
+
42
+ it 'returns false for an invalid detector' do
43
+ expect(described_class.valid_detector?('Unknown')).to be false
44
+ end
45
+ end
36
46
  end
@@ -6,16 +6,16 @@ RSpec.describe Reek::Smells::SmellRepository do
6
6
  describe '.smell_types' do
7
7
  let(:smell_types) { described_class.smell_types }
8
8
 
9
- it 'should include existing smell_types' do
10
- expect(smell_types).to include(Reek::Smells::IrresponsibleModule)
11
- expect(smell_types).to include(Reek::Smells::TooManyStatements)
9
+ it 'includes existing smell_types' do
10
+ expect(smell_types).to include(Reek::Smells::IrresponsibleModule).
11
+ and include(Reek::Smells::TooManyStatements)
12
12
  end
13
13
 
14
- it 'should exclude the smell detector base class' do
15
- expect(smell_types).to_not include(Reek::Smells::SmellDetector)
14
+ it 'excludes the smell detector base class' do
15
+ expect(smell_types).not_to include(Reek::Smells::SmellDetector)
16
16
  end
17
17
 
18
- it 'should return the smell types in alphabetic order' do
18
+ it 'returns the smell types in alphabetic order' do
19
19
  expect(smell_types).to eq(smell_types.sort_by(&:name))
20
20
  end
21
21
  end
@@ -12,15 +12,17 @@ RSpec.describe Reek::Smells::SmellWarning do
12
12
  it 'hash differently' do
13
13
  expect(first.hash).not_to eq(second.hash)
14
14
  end
15
+
15
16
  it 'are not equal' do
16
17
  expect(first).not_to eq(second)
17
18
  end
19
+
18
20
  it 'sort correctly' do
19
21
  expect(first <=> second).to be < 0
20
22
  end
23
+
21
24
  it 'does not match using eql?' do
22
25
  expect(first).not_to eql(second)
23
- expect(second).not_to eql(first)
24
26
  end
25
27
  end
26
28
 
@@ -96,52 +98,46 @@ RSpec.describe Reek::Smells::SmellWarning do
96
98
  end
97
99
 
98
100
  context '#yaml_hash' do
99
- let(:class) { 'FeatureEnvy' }
100
101
  let(:context_name) { 'Module::Class#method/block' }
101
102
  let(:lines) { [24, 513] }
102
103
  let(:message) { 'test message' }
104
+ let(:detector) { Reek::Smells::FeatureEnvy.new }
105
+ let(:parameters) { { 'one' => 34, 'two' => 'second' } }
106
+ let(:smell_type) { 'FeatureEnvy' }
107
+ let(:source) { 'a/ruby/source/file.rb' }
108
+
109
+ let(:yaml) do
110
+ warning = described_class.new(detector, source: source,
111
+ context: context_name,
112
+ lines: lines,
113
+ message: message,
114
+ parameters: parameters)
115
+ warning.yaml_hash
116
+ end
103
117
 
104
- shared_examples_for 'common fields' do
105
- it 'includes the smell type' do
106
- expect(yaml['smell_type']).to eq 'FeatureEnvy'
107
- end
108
- it 'includes the context' do
109
- expect(yaml['context']).to eq context_name
110
- end
111
- it 'includes the message' do
112
- expect(yaml['message']).to eq message
113
- end
114
- it 'includes the line numbers' do
115
- expect(yaml['lines']).to match_array lines
116
- end
118
+ it 'includes the smell type' do
119
+ expect(yaml['smell_type']).to eq 'FeatureEnvy'
117
120
  end
118
121
 
119
- context 'with all details specified' do
120
- let(:detector) { Reek::Smells::FeatureEnvy.new }
121
- let(:parameters) { { 'one' => 34, 'two' => 'second' } }
122
- let(:smell_type) { 'FeatureEnvy' }
123
- let(:source) { 'a/ruby/source/file.rb' }
124
- let(:yaml) do
125
- warning = Reek::Smells::SmellWarning.new(detector, source: source,
126
- context: context_name,
127
- lines: lines,
128
- message: message,
129
- parameters: parameters)
130
- warning.yaml_hash
131
- end
122
+ it 'includes the context' do
123
+ expect(yaml['context']).to eq context_name
124
+ end
132
125
 
133
- it_should_behave_like 'common fields'
126
+ it 'includes the message' do
127
+ expect(yaml['message']).to eq message
128
+ end
134
129
 
135
- it 'includes the smell type' do
136
- expect(yaml['smell_type']).to eq smell_type
137
- end
138
- it 'includes the source' do
139
- expect(yaml['source']).to eq source
140
- end
141
- it 'includes the parameters' do
142
- parameters.each do |key, value|
143
- expect(yaml[key]).to eq value
144
- end
130
+ it 'includes the line numbers' do
131
+ expect(yaml['lines']).to match_array lines
132
+ end
133
+
134
+ it 'includes the source' do
135
+ expect(yaml['source']).to eq source
136
+ end
137
+
138
+ it 'includes the parameters' do
139
+ parameters.each do |key, value|
140
+ expect(yaml[key]).to eq value
145
141
  end
146
142
  end
147
143
  end
@@ -33,7 +33,7 @@ RSpec.describe Reek::Smells::SubclassedFromCoreClass do
33
33
  end
34
34
  EOS
35
35
 
36
- expect(src).to_not reek_of(:SubclassedFromCoreClass)
36
+ expect(src).not_to reek_of(:SubclassedFromCoreClass)
37
37
  end
38
38
 
39
39
  it 'does not report on coincidental core class names in other namespaces' do
@@ -42,7 +42,7 @@ RSpec.describe Reek::Smells::SubclassedFromCoreClass do
42
42
  end
43
43
  EOS
44
44
 
45
- expect(src).to_not reek_of(:SubclassedFromCoreClass)
45
+ expect(src).not_to reek_of(:SubclassedFromCoreClass)
46
46
  end
47
47
 
48
48
  it 'reports if we inherit from a core class using Class#new' do
@@ -67,16 +67,16 @@ RSpec.describe Reek::Smells::SubclassedFromCoreClass do
67
67
 
68
68
  it 'does not report class which inherits from allowed class via Class.new' do
69
69
  src = 'Alfa = Class.new(StandardError)'
70
- expect(src).to_not reek_of(:SubclassedFromCoreClass)
70
+ expect(src).not_to reek_of(:SubclassedFromCoreClass)
71
71
  end
72
72
 
73
73
  it 'does not report classes created with Struct.new' do
74
74
  src = "Alfa = Struct.new('Array')"
75
- expect(src).to_not reek_of(:SubclassedFromCoreClass)
75
+ expect(src).not_to reek_of(:SubclassedFromCoreClass)
76
76
  end
77
77
 
78
78
  it 'does not report class created by another class constructor taking a core class as argument' do
79
79
  src = 'Charlie = Delta.new(Array)'
80
- expect(src).to_not reek_of(:SubclassedFromCoreClass)
80
+ expect(src).not_to reek_of(:SubclassedFromCoreClass)
81
81
  end
82
82
  end
@@ -21,7 +21,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
21
21
  count: 3).with_config(config)
22
22
  end
23
23
 
24
- it 'should not report for non-excessive constants' do
24
+ it 'does not report for non-excessive constants' do
25
25
  src = <<-EOS
26
26
  class Alfa
27
27
  Bravo = Charlie = 1
@@ -31,7 +31,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
31
31
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
32
32
  end
33
33
 
34
- it 'should not report when increasing default' do
34
+ it 'does not report when increasing default' do
35
35
  src = <<-EOS
36
36
  # :reek:TooManyConstants: { max_constants: 3 }
37
37
  class Alfa
@@ -42,7 +42,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
42
42
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
43
43
  end
44
44
 
45
- it 'should not report when disabled' do
45
+ it 'does not report when disabled' do
46
46
  src = <<-EOS
47
47
  # :reek:TooManyConstants: { enabled: false }
48
48
  class Alfa
@@ -53,7 +53,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
53
53
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
54
54
  end
55
55
 
56
- it 'should not account class definition' do
56
+ it 'does not account class definition' do
57
57
  src = <<-EOS
58
58
  class Alfa
59
59
  Bravo = Charlie = 1
@@ -64,7 +64,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
64
64
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
65
65
  end
66
66
 
67
- it 'should not account struct definition' do
67
+ it 'does not account struct definition' do
68
68
  src = <<-EOS
69
69
  class Alfa
70
70
  Bravo = Charlie = 1
@@ -72,10 +72,10 @@ RSpec.describe Reek::Smells::TooManyConstants do
72
72
  end
73
73
  EOS
74
74
 
75
- expect(src).to_not reek_of(:TooManyConstants).with_config(config)
75
+ expect(src).not_to reek_of(:TooManyConstants).with_config(config)
76
76
  end
77
77
 
78
- it 'should count each constant only once' do
78
+ it 'counts each constant only once' do
79
79
  src = <<-EOS
80
80
  class Alfa
81
81
  Bravo = Charlie = 1
@@ -93,7 +93,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
93
93
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
94
94
  end
95
95
 
96
- it 'should not report outer module when inner module suppressed' do
96
+ it 'does not report outer module when inner module suppressed' do
97
97
  src = <<-EOS
98
98
  module Alfa
99
99
  # ignore :reek:TooManyConstants:
@@ -106,7 +106,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
106
106
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
107
107
  end
108
108
 
109
- it 'should count each constant only once for each namespace' do
109
+ it 'counts each constant only once for each namespace' do
110
110
  src = <<-EOS
111
111
  module Alfa
112
112
  Bravo = Charlie = 1
@@ -120,7 +120,7 @@ RSpec.describe Reek::Smells::TooManyConstants do
120
120
  expect(src).not_to reek_of(:TooManyConstants).with_config(config)
121
121
  end
122
122
 
123
- it 'should report for excessive constants inside a module' do
123
+ it 'reports for excessive constants inside a module' do
124
124
  src = <<-EOS
125
125
  module Alfa
126
126
  Bravo = Charlie = Delta = 1