reek 1.6.6 → 2.0.0

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +6 -9
  3. data/features/command_line_interface/options.feature +20 -16
  4. data/features/command_line_interface/stdin.feature +1 -1
  5. data/features/rake_task/rake_task.feature +0 -12
  6. data/features/reports/reports.feature +63 -23
  7. data/features/reports/yaml.feature +3 -3
  8. data/features/samples.feature +3 -3
  9. data/lib/reek/cli/application.rb +5 -5
  10. data/lib/reek/cli/input.rb +1 -1
  11. data/lib/reek/cli/option_interpreter.rb +77 -0
  12. data/lib/reek/cli/options.rb +89 -82
  13. data/lib/reek/cli/report/formatter.rb +33 -24
  14. data/lib/reek/cli/report/heading_formatter.rb +45 -0
  15. data/lib/reek/cli/report/location_formatter.rb +23 -0
  16. data/lib/reek/cli/report/report.rb +32 -17
  17. data/lib/reek/configuration/app_configuration.rb +2 -2
  18. data/lib/reek/configuration/configuration_file_finder.rb +10 -10
  19. data/lib/reek/core/smell_repository.rb +3 -28
  20. data/lib/reek/rake/task.rb +35 -76
  21. data/lib/reek/smell_warning.rb +31 -16
  22. data/lib/reek/smells/nested_iterators.rb +1 -1
  23. data/lib/reek/smells/smell_detector.rb +9 -0
  24. data/lib/reek/smells/utility_function.rb +2 -1
  25. data/lib/reek/spec/should_reek.rb +0 -3
  26. data/lib/reek/spec/should_reek_of.rb +61 -12
  27. data/lib/reek/spec/should_reek_only_of.rb +12 -10
  28. data/lib/reek/version.rb +1 -1
  29. data/reek.gemspec +2 -2
  30. data/spec/factories/factories.rb +2 -5
  31. data/spec/reek/cli/html_report_spec.rb +28 -0
  32. data/spec/reek/cli/option_interperter_spec.rb +14 -0
  33. data/spec/reek/cli/text_report_spec.rb +95 -0
  34. data/spec/reek/cli/yaml_report_spec.rb +23 -0
  35. data/spec/reek/configuration/configuration_file_finder_spec.rb +5 -6
  36. data/spec/reek/core/module_context_spec.rb +1 -1
  37. data/spec/reek/core/smell_repository_spec.rb +17 -0
  38. data/spec/reek/smell_warning_spec.rb +9 -11
  39. data/spec/reek/smells/boolean_parameter_spec.rb +11 -11
  40. data/spec/reek/smells/control_parameter_spec.rb +40 -40
  41. data/spec/reek/smells/data_clump_spec.rb +17 -17
  42. data/spec/reek/smells/duplicate_method_call_spec.rb +56 -33
  43. data/spec/reek/smells/feature_envy_spec.rb +44 -40
  44. data/spec/reek/smells/irresponsible_module_spec.rb +1 -1
  45. data/spec/reek/smells/long_parameter_list_spec.rb +12 -12
  46. data/spec/reek/smells/long_yield_list_spec.rb +4 -4
  47. data/spec/reek/smells/module_initialize_spec.rb +3 -3
  48. data/spec/reek/smells/nested_iterators_spec.rb +71 -52
  49. data/spec/reek/smells/nil_check_spec.rb +6 -6
  50. data/spec/reek/smells/prima_donna_method_spec.rb +2 -2
  51. data/spec/reek/smells/too_many_statements_spec.rb +34 -34
  52. data/spec/reek/smells/uncommunicative_method_name_spec.rb +1 -1
  53. data/spec/reek/smells/uncommunicative_module_name_spec.rb +7 -3
  54. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +12 -12
  55. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +28 -38
  56. data/spec/reek/smells/unused_parameters_spec.rb +16 -17
  57. data/spec/reek/smells/utility_function_spec.rb +21 -8
  58. data/spec/reek/spec/should_reek_of_spec.rb +18 -5
  59. data/spec/reek/spec/should_reek_only_of_spec.rb +7 -1
  60. data/spec/spec_helper.rb +22 -14
  61. metadata +15 -20
  62. data/lib/reek/cli/help_command.rb +0 -15
  63. data/lib/reek/cli/report/strategy.rb +0 -64
  64. data/lib/reek/cli/version_command.rb +0 -16
  65. data/spec/matchers/smell_of_matcher.rb +0 -95
  66. data/spec/reek/cli/help_command_spec.rb +0 -25
  67. data/spec/reek/cli/report_spec.rb +0 -132
  68. data/spec/reek/cli/version_command_spec.rb +0 -31
@@ -48,7 +48,7 @@ describe IrresponsibleModule do
48
48
  #
49
49
  class #{@bad_module_name}; end
50
50
  EOS
51
- expect(src).to smell_of IrresponsibleModule
51
+ expect(src).to reek_of IrresponsibleModule
52
52
  end
53
53
 
54
54
  it 'reports a class with a preceding comment with intermittent material' do
@@ -8,17 +8,17 @@ include Reek::Smells
8
8
  describe LongParameterList do
9
9
  context 'for methods with few parameters' do
10
10
  it 'should report nothing for no parameters' do
11
- expect('def simple; f(3);true; end').not_to smell_of(LongParameterList)
11
+ expect('def simple; f(3);true; end').not_to reek_of(LongParameterList)
12
12
  end
13
13
  it 'should report nothing for 1 parameter' do
14
- expect('def simple(yep) f(3);true end').not_to smell_of(LongParameterList)
14
+ expect('def simple(yep) f(3);true end').not_to reek_of(LongParameterList)
15
15
  end
16
16
  it 'should report nothing for 2 parameters' do
17
- expect('def simple(yep,zero) f(3);true end').not_to smell_of(LongParameterList)
17
+ expect('def simple(yep,zero) f(3);true end').not_to reek_of(LongParameterList)
18
18
  end
19
19
  it 'should not count an optional block' do
20
20
  src = 'def simple(alpha, yep, zero, &opt) f(3); true end'
21
- expect(src).not_to smell_of(LongParameterList)
21
+ expect(src).not_to reek_of(LongParameterList)
22
22
  end
23
23
  it 'should not report inner block with too many parameters' do
24
24
  src = '
@@ -26,20 +26,20 @@ describe LongParameterList do
26
26
  m[3]; rand(34); f.each { |arga, argb, argc, argd| true}
27
27
  end
28
28
  '
29
- expect(src).not_to smell_of(LongParameterList)
29
+ expect(src).not_to reek_of(LongParameterList)
30
30
  end
31
31
 
32
32
  describe 'and default values' do
33
33
  it 'should report nothing for 1 parameter' do
34
- expect('def simple(zero=nil) f(3);false end').not_to smell_of(LongParameterList)
34
+ expect('def simple(zero=nil) f(3);false end').not_to reek_of(LongParameterList)
35
35
  end
36
36
  it 'should report nothing for 2 parameters with 1 default' do
37
37
  source = 'def simple(yep, zero=nil) f(3); false end'
38
- expect(source).not_to smell_of(LongParameterList)
38
+ expect(source).not_to reek_of(LongParameterList)
39
39
  end
40
40
  it 'should report nothing for 2 defaulted parameters' do
41
41
  source = 'def simple(yep=4, zero=nil) f(3); false end'
42
- expect(source).not_to smell_of(LongParameterList)
42
+ expect(source).not_to reek_of(LongParameterList)
43
43
  end
44
44
  end
45
45
  end
@@ -47,21 +47,21 @@ describe LongParameterList do
47
47
  describe 'for methods with too many parameters' do
48
48
  it 'should report 4 parameters' do
49
49
  src = 'def simple(arga, argb, argc, argd) f(3);true end'
50
- expect(src).to smell_of(LongParameterList, count: 4)
50
+ expect(src).to reek_of(LongParameterList, count: 4)
51
51
  end
52
52
  it 'should report 8 parameters' do
53
53
  src = 'def simple(arga, argb, argc, argd,arge, argf, argg, argh) f(3);true end'
54
- expect(src).to smell_of(LongParameterList, count: 8)
54
+ expect(src).to reek_of(LongParameterList, count: 8)
55
55
  end
56
56
 
57
57
  describe 'and default values' do
58
58
  it 'should report 3 with 1 defaulted' do
59
59
  src = 'def simple(polly, queue, yep, zero=nil) f(3);false end'
60
- expect(src).to smell_of(LongParameterList, count: 4)
60
+ expect(src).to reek_of(LongParameterList, count: 4)
61
61
  end
62
62
  it 'should report with 3 defaulted' do
63
63
  src = 'def simple(aarg, polly=2, yep=:truth, zero=nil) f(3);false end'
64
- expect(src).to smell_of(LongParameterList, count: 4)
64
+ expect(src).to reek_of(LongParameterList, count: 4)
65
65
  end
66
66
  end
67
67
  end
@@ -18,19 +18,19 @@ describe LongYieldList do
18
18
  context 'yield' do
19
19
  it 'should not report yield with no parameters' do
20
20
  src = 'def simple(arga, argb, &blk) f(3);yield; end'
21
- expect(src).not_to smell_of(LongYieldList)
21
+ expect(src).not_to reek_of(LongYieldList)
22
22
  end
23
23
  it 'should not report yield with few parameters' do
24
24
  src = 'def simple(arga, argb, &blk) f(3);yield a,b; end'
25
- expect(src).not_to smell_of(LongYieldList)
25
+ expect(src).not_to reek_of(LongYieldList)
26
26
  end
27
27
  it 'should report yield with many parameters' do
28
28
  src = 'def simple(arga, argb, &blk) f(3);yield arga,argb,arga,argb; end'
29
- expect(src).to smell_of(LongYieldList, count: 4)
29
+ expect(src).to reek_of(LongYieldList, count: 4)
30
30
  end
31
31
  it 'should not report yield of a long expression' do
32
32
  src = 'def simple(arga, argb, &blk) f(3);yield(if @dec then argb else 5+3 end); end'
33
- expect(src).not_to smell_of(LongYieldList)
33
+ expect(src).not_to reek_of(LongYieldList)
34
34
  end
35
35
  end
36
36
 
@@ -13,7 +13,7 @@ describe ModuleInitialize do
13
13
  def initialize; end
14
14
  end
15
15
  EOF
16
- expect(src).to smell_of(ModuleInitialize)
16
+ expect(src).to reek_of(ModuleInitialize)
17
17
  end
18
18
  end
19
19
 
@@ -26,7 +26,7 @@ describe ModuleInitialize do
26
26
  end
27
27
  end
28
28
  EOF
29
- expect(src).not_to smell_of(ModuleInitialize)
29
+ expect(src).not_to reek_of(ModuleInitialize)
30
30
  end
31
31
  end
32
32
 
@@ -39,7 +39,7 @@ describe ModuleInitialize do
39
39
  end
40
40
  end
41
41
  EOF
42
- expect(src).not_to smell_of(ModuleInitialize)
42
+ expect(src).not_to reek_of(ModuleInitialize)
43
43
  end
44
44
  end
45
45
  end
@@ -8,39 +8,39 @@ describe NestedIterators do
8
8
  context 'with no iterators' do
9
9
  it 'reports no smells' do
10
10
  src = 'def fred() nothing = true; end'
11
- expect(src).not_to smell_of(NestedIterators)
11
+ expect(src).not_to reek_of(NestedIterators)
12
12
  end
13
13
  end
14
14
 
15
15
  context 'with one iterator' do
16
16
  it 'reports no smells' do
17
17
  src = 'def fred() nothing.each {|item| item}; end'
18
- expect(src).not_to smell_of(NestedIterators)
18
+ expect(src).not_to reek_of(NestedIterators)
19
19
  end
20
20
  end
21
21
 
22
22
  it 'should report nested iterators in a method' do
23
23
  src = 'def bad(fred) @fred.each {|item| item.each {|ting| ting.ting} } end'
24
- expect(src).to smell_of(NestedIterators)
24
+ expect(src).to reek_of(NestedIterators)
25
25
  end
26
26
 
27
27
  it 'should not report method with successive iterators' do
28
- src = <<EOS
29
- def bad(fred)
30
- @fred.each {|item| item.each }
31
- @jim.each {|ting| ting.each }
32
- end
33
- EOS
34
- expect(src).not_to smell_of(NestedIterators)
28
+ src = <<-EOS
29
+ def bad(fred)
30
+ @fred.each {|item| item.each }
31
+ @jim.each {|ting| ting.each }
32
+ end
33
+ EOS
34
+ expect(src).not_to reek_of(NestedIterators)
35
35
  end
36
36
 
37
37
  it 'should not report method with chained iterators' do
38
- src = <<EOS
39
- def chained
40
- @sig.keys.sort_by { |xray| xray.to_s }.each { |min| md5 << min.to_s }
41
- end
42
- EOS
43
- expect(src).not_to smell_of(NestedIterators)
38
+ src = <<-EOS
39
+ def chained
40
+ @sig.keys.sort_by { |xray| xray.to_s }.each { |min| md5 << min.to_s }
41
+ end
42
+ EOS
43
+ expect(src).not_to reek_of(NestedIterators)
44
44
  end
45
45
 
46
46
  it 'detects an iterator with an empty block' do
@@ -49,17 +49,17 @@ EOS
49
49
  bar { baz { } }
50
50
  end
51
51
  EOS
52
- expect(src).to smell_of(NestedIterators, {})
52
+ expect(src).to reek_of(NestedIterators)
53
53
  end
54
54
 
55
55
  it 'should report nested iterators only once per method' do
56
- src = <<EOS
57
- def bad(fred)
58
- @fred.each {|item| item.each {|part| @joe.send} }
59
- @jim.each {|ting| ting.each {|piece| @hal.send} }
60
- end
61
- EOS
62
- expect(src).to smell_of(NestedIterators, {})
56
+ src = <<-EOS
57
+ def bad(fred)
58
+ @fred.each {|item| item.each {|part| @joe.send} }
59
+ @jim.each {|ting| ting.each {|piece| @hal.send} }
60
+ end
61
+ EOS
62
+ expect(src).to reek_of(NestedIterators)
63
63
  end
64
64
 
65
65
  it 'reports nested iterators only once per method even if levels are different' do
@@ -69,7 +69,7 @@ EOS
69
69
  @jim.each {|ting| ting.each {|piece| piece.each {|atom| atom.foo } } }
70
70
  end
71
71
  EOS
72
- expect(src).to smell_of(NestedIterators, {})
72
+ expect(src).to reek_of(NestedIterators)
73
73
  end
74
74
 
75
75
  it 'reports nesting inside iterator arguments' do
@@ -84,7 +84,7 @@ EOS
84
84
  ) { |qux| qux.quuz }
85
85
  end
86
86
  EOS
87
- expect(src).to smell_of(NestedIterators, count: 2)
87
+ expect(src).to reek_of(NestedIterators, count: 2)
88
88
  end
89
89
 
90
90
  it 'reports the deepest level of nesting only' do
@@ -97,55 +97,68 @@ EOS
97
97
  }
98
98
  end
99
99
  EOS
100
- expect(src).to smell_of(NestedIterators, count: 3)
100
+ expect(src).to reek_of(NestedIterators, count: 3)
101
101
  end
102
102
 
103
103
  context 'when the allowed nesting depth is 3' do
104
104
  before :each do
105
- @config = { NestedIterators::MAX_ALLOWED_NESTING_KEY => 3 }
105
+ @config = { NestedIterators: { NestedIterators::MAX_ALLOWED_NESTING_KEY => 3 } }
106
106
  end
107
107
 
108
108
  it 'should not report nested iterators 2 levels deep' do
109
- src = <<EOS
110
- def bad(fred)
111
- @fred.each {|one| one.each {|two| two.two} }
112
- end
113
- EOS
114
- expect(src).not_to smell_of(NestedIterators).with_config(@config)
109
+ src = <<-EOS
110
+ def bad(fred)
111
+ @fred.each {|one| one.each {|two| two.two} }
112
+ end
113
+ EOS
114
+
115
+ with_test_config(@config) do
116
+ expect(src).not_to reek_of(NestedIterators)
117
+ end
115
118
  end
116
119
 
117
120
  it 'should not report nested iterators 3 levels deep' do
118
- src = <<EOS
119
- def bad(fred)
120
- @fred.each {|one| one.each {|two| two.each {|three| three.three} } }
121
- end
122
- EOS
123
- expect(src).not_to smell_of(NestedIterators).with_config(@config)
121
+ src = <<-EOS
122
+ def bad(fred)
123
+ @fred.each {|one| one.each {|two| two.each {|three| three.three} } }
124
+ end
125
+ EOS
126
+
127
+ with_test_config(@config) do
128
+ expect(src).not_to reek_of(NestedIterators)
129
+ end
124
130
  end
125
131
 
126
132
  it 'should report nested iterators 4 levels deep' do
127
- src = <<EOS
128
- def bad(fred)
129
- @fred.each {|one| one.each {|two| two.each {|three| three.each {|four| four.four} } } }
130
- end
131
- EOS
132
- expect(src).to smell_of(NestedIterators).with_config(@config)
133
+ src = <<-EOS
134
+ def bad(fred)
135
+ @fred.each {|one| one.each {|two| two.each {|three| three.each {|four| four.four} } } }
136
+ end
137
+ EOS
138
+
139
+ with_test_config(@config) do
140
+ expect(src).to reek_of(NestedIterators)
141
+ end
133
142
  end
134
143
  end
135
144
 
136
145
  context 'when ignoring iterators' do
137
146
  before :each do
138
- @config = { NestedIterators::IGNORE_ITERATORS_KEY => ['ignore_me'] }
147
+ @config = { NestedIterators: { NestedIterators::IGNORE_ITERATORS_KEY => ['ignore_me'] } }
139
148
  end
140
149
 
141
150
  it 'should not report nesting the ignored iterator inside another' do
142
151
  src = 'def bad(fred) @fred.each {|item| item.ignore_me {|ting| ting.ting} } end'
143
- expect(src).not_to smell_of(NestedIterators).with_config(@config)
152
+ with_test_config(@config) do
153
+ expect(src).not_to reek_of(NestedIterators)
154
+ end
144
155
  end
145
156
 
146
157
  it 'should not report nesting inside the ignored iterator' do
147
158
  src = 'def bad(fred) @fred.ignore_me {|item| item.each {|ting| ting.ting} } end'
148
- expect(src).not_to smell_of(NestedIterators).with_config(@config)
159
+ with_test_config(@config) do
160
+ expect(src).not_to reek_of(NestedIterators)
161
+ end
149
162
  end
150
163
 
151
164
  it 'should report nested iterators inside the ignored iterator' do
@@ -154,7 +167,9 @@ EOS
154
167
  @fred.ignore_me {|item| item.each {|ting| ting.each {|other| other.other} } }
155
168
  end
156
169
  '
157
- expect(src).to smell_of(NestedIterators, count: 2).with_config(@config)
170
+ with_test_config(@config) do
171
+ expect(src).to reek_of(NestedIterators, count: 2)
172
+ end
158
173
  end
159
174
 
160
175
  it 'should report nested iterators outside the ignored iterator' do
@@ -163,7 +178,9 @@ EOS
163
178
  @fred.each {|item| item.each {|ting| ting.ignore_me {|other| other.other} } }
164
179
  end
165
180
  '
166
- expect(src).to smell_of(NestedIterators, count: 2).with_config(@config)
181
+ with_test_config(@config) do
182
+ expect(src).to reek_of(NestedIterators, count: 2)
183
+ end
167
184
  end
168
185
 
169
186
  it 'should report nested iterators with the ignored iterator between them' do
@@ -172,7 +189,9 @@ EOS
172
189
  @fred.each {|item| item.ignore_me {|ting| ting.ting {|other| other.other} } }
173
190
  end
174
191
  '
175
- expect(src).to smell_of(NestedIterators, count: 2).with_config(@config)
192
+ with_test_config(@config) do
193
+ expect(src).to reek_of(NestedIterators, count: 2)
194
+ end
176
195
  end
177
196
  end
178
197
  end
@@ -20,7 +20,7 @@ describe NilCheck do
20
20
  end
21
21
 
22
22
  it 'reports nothing when scope includes no nil checks' do
23
- expect('def no_nils; end').not_to smell_of(NilCheck)
23
+ expect('def no_nils; end').not_to reek_of(NilCheck)
24
24
  end
25
25
 
26
26
  it 'reports when scope uses multiple nil? methods' do
@@ -31,7 +31,7 @@ describe NilCheck do
31
31
  \"\".nil?
32
32
  end
33
33
  eos
34
- expect(src).to smell_of(NilCheck, {}, {})
34
+ expect(src).to reek_of(NilCheck)
35
35
  end
36
36
 
37
37
  it 'reports twice when scope uses == nil and === nil' do
@@ -41,11 +41,11 @@ describe NilCheck do
41
41
  para === nil
42
42
  end
43
43
  eos
44
- expect(src).to smell_of(NilCheck, {}, {})
44
+ expect(src).to reek_of(NilCheck)
45
45
  end
46
46
 
47
47
  it 'reports when scope uses nil ==' do
48
- expect('def chk_eq_nil_rev(para); nil == para; end').to smell_of(NilCheck)
48
+ expect('def chk_eq_nil_rev(para); nil == para; end').to reek_of(NilCheck)
49
49
  end
50
50
 
51
51
  it 'reports when scope uses multiple case-clauses checking nil' do
@@ -61,7 +61,7 @@ describe NilCheck do
61
61
  end
62
62
  end
63
63
  eos
64
- expect(src).to smell_of(NilCheck, {}, {})
64
+ expect(src).to reek_of(NilCheck)
65
65
  end
66
66
 
67
67
  it 'reports a when clause that checks nil and other values' do
@@ -72,7 +72,7 @@ describe NilCheck do
72
72
  end
73
73
  end
74
74
  eos
75
- expect(src).to smell_of(NilCheck)
75
+ expect(src).to reek_of(NilCheck)
76
76
  end
77
77
  end
78
78
  end
@@ -7,11 +7,11 @@ include Reek::Smells
7
7
 
8
8
  describe PrimaDonnaMethod do
9
9
  it 'should report nothing when method and bang counterpart exist' do
10
- expect('class C; def m; end; def m!; end; end').not_to smell_of(PrimaDonnaMethod)
10
+ expect('class C; def m; end; def m!; end; end').not_to reek_of(PrimaDonnaMethod)
11
11
  end
12
12
 
13
13
  it 'should report PrimaDonnaMethod when only bang method exists' do
14
- expect('class C; def m!; end; end').to smell_of(PrimaDonnaMethod)
14
+ expect('class C; def m!; end; end').to reek_of(PrimaDonnaMethod)
15
15
  end
16
16
 
17
17
  describe 'the right smell' do
@@ -22,12 +22,12 @@ end
22
22
  describe TooManyStatements do
23
23
  it 'should not report short methods' do
24
24
  src = 'def short(arga) alf = f(1);@bet = 2;@cut = 3;@dit = 4; @emp = 5;end'
25
- expect(src).not_to smell_of(TooManyStatements)
25
+ expect(src).not_to reek_of(TooManyStatements)
26
26
  end
27
27
 
28
28
  it 'should report long methods' do
29
29
  src = 'def long() alf = f(1);@bet = 2;@cut = 3;@dit = 4; @emp = 5;@fry = 6;end'
30
- expect(src).to reek_only_of(:TooManyStatements, /6 statements/)
30
+ expect(src).to reek_only_of(:TooManyStatements)
31
31
  end
32
32
 
33
33
  it 'should not report initialize' do
@@ -36,45 +36,45 @@ describe TooManyStatements do
36
36
  alf = f(1); @bet = 2; @cut = 3; @dit = 4; @emp = 5; @fry = 6
37
37
  end
38
38
  '
39
- expect(src).not_to smell_of(TooManyStatements)
39
+ expect(src).not_to reek_of(TooManyStatements)
40
40
  end
41
41
 
42
42
  it 'should only report a long method once' do
43
- src = <<EOS
44
- def standard_entries(rbconfig)
45
- @abc = rbconfig
46
- rubypath = File.join(@abc['bindir'], @abcf['ruby_install_name'] + cff['EXEEXT'])
47
- major = yyy['MAJOR'].to_i
48
- minor = zzz['MINOR'].to_i
49
- teeny = ccc['TEENY'].to_i
50
- version = ""
51
- if c['rubylibdir']
52
- @libruby = "/lib/ruby"
53
- @librubyver = "/lib/ruby/"
54
- @librubyverarch = "/lib/ruby/"
55
- @siteruby = "lib/ruby/version/site_ruby"
56
- @siterubyver = siteruby
57
- @siterubyverarch = "$siterubyver/['arch']}"
58
- end
59
- end
60
- EOS
43
+ src = <<-EOS
44
+ def standard_entries(rbconfig)
45
+ @abc = rbconfig
46
+ rubypath = File.join(@abc['bindir'], @abcf['ruby_install_name'] + cff['EXEEXT'])
47
+ major = yyy['MAJOR'].to_i
48
+ minor = zzz['MINOR'].to_i
49
+ teeny = ccc['TEENY'].to_i
50
+ version = ""
51
+ if c['rubylibdir']
52
+ @libruby = "/lib/ruby"
53
+ @librubyver = "/lib/ruby/"
54
+ @librubyverarch = "/lib/ruby/"
55
+ @siteruby = "lib/ruby/version/site_ruby"
56
+ @siterubyver = siteruby
57
+ @siterubyverarch = "$siterubyver/['arch']}"
58
+ end
59
+ end
60
+ EOS
61
61
  expect(src).to reek_only_of(:TooManyStatements)
62
62
  end
63
63
 
64
64
  it 'should report long inner block' do
65
- src = <<EOS
66
- def long()
67
- f(3)
68
- self.each do |xyzero|
69
- xyzero = 1
70
- xyzero = 2
71
- xyzero = 3
72
- xyzero = 4
73
- xyzero = 5
74
- xyzero = 6
75
- end
76
- end
77
- EOS
65
+ src = <<-EOS
66
+ def long()
67
+ f(3)
68
+ self.each do |xyzero|
69
+ xyzero = 1
70
+ xyzero = 2
71
+ xyzero = 3
72
+ xyzero = 4
73
+ xyzero = 5
74
+ xyzero = 6
75
+ end
76
+ end
77
+ EOS
78
78
  expect(src).to reek_only_of(:TooManyStatements)
79
79
  end
80
80
  end