tailor 1.3.1 → 1.4.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/Gemfile.lock +27 -25
  4. data/History.md +36 -0
  5. data/README.md +10 -4
  6. data/Rakefile +6 -6
  7. data/features/support/env.rb +2 -2
  8. data/features/support/legacy/bad_ternary_colon_spacing.rb +1 -1
  9. data/features/support/legacy/long_file_with_indentation.rb +2 -2
  10. data/features/support/world.rb +1 -1
  11. data/features/valid_ruby.feature +1 -1
  12. data/lib/tailor/cli/options.rb +19 -1
  13. data/lib/tailor/configuration.rb +2 -2
  14. data/lib/tailor/configuration/style.rb +6 -0
  15. data/lib/tailor/lexed_line.rb +2 -2
  16. data/lib/tailor/lexer/lexer_constants.rb +1 -0
  17. data/lib/tailor/lexer/token.rb +2 -2
  18. data/lib/tailor/logger.rb +2 -2
  19. data/lib/tailor/rake_task.rb +2 -2
  20. data/lib/tailor/ruler.rb +0 -1
  21. data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +0 -1
  22. data/lib/tailor/rulers/allow_conditional_parentheses.rb +65 -0
  23. data/lib/tailor/rulers/allow_unnecessary_double_quotes_ruler.rb +61 -0
  24. data/lib/tailor/rulers/allow_unnecessary_interpolation_ruler.rb +87 -0
  25. data/lib/tailor/rulers/indentation_spaces_ruler.rb +40 -50
  26. data/lib/tailor/rulers/indentation_spaces_ruler/argument_alignment.rb +63 -0
  27. data/lib/tailor/rulers/indentation_spaces_ruler/ast_xml.rb +89 -0
  28. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +2 -14
  29. data/lib/tailor/rulers/indentation_spaces_ruler/line_continuations.rb +58 -0
  30. data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +3 -3
  31. data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +3 -3
  32. data/lib/tailor/rulers/spaces_after_comma_ruler.rb +3 -3
  33. data/lib/tailor/rulers/spaces_after_conditional_ruler.rb +3 -3
  34. data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +3 -3
  35. data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +3 -3
  36. data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +3 -3
  37. data/lib/tailor/rulers/spaces_before_comma_ruler.rb +3 -3
  38. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +2 -2
  39. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +2 -2
  40. data/lib/tailor/tailorrc.erb +28 -0
  41. data/lib/tailor/version.rb +1 -1
  42. data/spec/functional/conditional_parentheses_spec.rb +325 -0
  43. data/spec/functional/conditional_spacing_spec.rb +66 -42
  44. data/spec/functional/configuration_spec.rb +1 -1
  45. data/spec/functional/horizontal_spacing/braces_spec.rb +10 -9
  46. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +4 -4
  47. data/spec/functional/horizontal_spacing_spec.rb +5 -5
  48. data/spec/functional/indentation_spacing/argument_alignment_spec.rb +511 -0
  49. data/spec/functional/indentation_spacing/line_continuations_spec.rb +181 -0
  50. data/spec/functional/indentation_spacing_spec.rb +17 -0
  51. data/spec/functional/string_interpolation_spec.rb +117 -0
  52. data/spec/functional/string_quoting_spec.rb +97 -0
  53. data/spec/functional/vertical_spacing/class_length_spec.rb +1 -1
  54. data/spec/spec_helper.rb +8 -2
  55. data/spec/support/argument_alignment_cases.rb +93 -0
  56. data/spec/support/bad_indentation_cases.rb +20 -20
  57. data/spec/support/conditional_parentheses_cases.rb +60 -0
  58. data/spec/support/good_indentation_cases.rb +31 -31
  59. data/spec/support/horizontal_spacing_cases.rb +1 -1
  60. data/spec/support/line_indentation_cases.rb +71 -0
  61. data/spec/support/string_interpolation_cases.rb +45 -0
  62. data/spec/support/string_quoting_cases.rb +25 -0
  63. data/spec/unit/tailor/configuration/file_set_spec.rb +3 -3
  64. data/spec/unit/tailor/configuration/style_spec.rb +24 -21
  65. data/spec/unit/tailor/configuration_spec.rb +4 -1
  66. data/spec/unit/tailor/formatter_spec.rb +10 -10
  67. data/spec/unit/tailor/reporter_spec.rb +0 -1
  68. data/spec/unit/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +0 -11
  69. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +1 -1
  70. data/spec/unit/tailor/version_spec.rb +1 -1
  71. data/tailor.gemspec +1 -0
  72. metadata +72 -33
  73. data/.infinity_test +0 -4
@@ -128,7 +128,7 @@ end
128
128
 
129
129
  it 'applies the nested configuration within the fileset' do
130
130
  expect(config.file_sets[:default].style[
131
- :max_line_length]).to eql [90, { :level => :warn }]
131
+ :max_line_length]).to eql [90, { level: :warn }]
132
132
  end
133
133
 
134
134
  end
@@ -224,15 +224,16 @@ describe "Detection of spacing around braces" do
224
224
 
225
225
  context "no space before consecutive rbraces" do
226
226
  let(:file_name) { 'no_space_before_consecutive_rbraces' }
227
- specify { critic.problems[file_name].size.should be 2 }
228
- specify { critic.problems[file_name].first[:type].should == "spaces_before_rbrace" }
229
- specify { critic.problems[file_name].first[:line].should be 1 }
230
- specify { critic.problems[file_name].first[:column].should be 72 }
231
- specify { critic.problems[file_name].first[:level].should be :error }
232
- specify { critic.problems[file_name].last[:type].should == "spaces_before_rbrace" }
233
- specify { critic.problems[file_name].last[:line].should be 1 }
234
- specify { critic.problems[file_name].last[:column].should be 73 }
235
- specify { critic.problems[file_name].last[:level].should be :error }
227
+ let(:problems) { critic.problems[file_name].select { |p| p[:type] == 'spaces_before_rbrace' } }
228
+ specify { problems.size.should be 2 }
229
+ specify { problems.first[:type].should == "spaces_before_rbrace" }
230
+ specify { problems.first[:line].should be 1 }
231
+ specify { problems.first[:column].should be 72 }
232
+ specify { problems.first[:level].should be :error }
233
+ specify { problems.last[:type].should == "spaces_before_rbrace" }
234
+ specify { problems.last[:line].should be 1 }
235
+ specify { problems.last[:column].should be 73 }
236
+ specify { problems.last[:level].should be :error }
236
237
  end
237
238
  end
238
239
  end
@@ -9,13 +9,13 @@ HARD_TABS = {}
9
9
 
10
10
  HARD_TABS['hard_tab'] =
11
11
  %Q{def something
12
- \tputs "something"
12
+ \tputs 'something'
13
13
  end}
14
14
 
15
15
  HARD_TABS['hard_tab_with_spaces'] =
16
16
  %Q{class Thing
17
17
  def something
18
- \t puts "something"
18
+ \t puts 'something'
19
19
  end
20
20
  end}
21
21
 
@@ -27,14 +27,14 @@ end}
27
27
  HARD_TABS['hard_tab_with_1_indented_space'] =
28
28
  %Q{class Thing
29
29
  def something
30
- \t puts "something"
30
+ \t puts 'something'
31
31
  end
32
32
  end}
33
33
 
34
34
  HARD_TABS['hard_tab_with_2_indented_spaces'] =
35
35
  %Q{class Thing
36
36
  def something
37
- \t puts "something"
37
+ \t puts 'something'
38
38
  end
39
39
  end}
40
40
 
@@ -70,11 +70,11 @@ end}
70
70
  critic.problems.should == {
71
71
  file_name => [
72
72
  {
73
- :type => 'max_line_length',
74
- :line => 3,
75
- :column => 81,
76
- :message => 'Line is 81 chars long, but should be 80.',
77
- :level=>:error
73
+ type: 'max_line_length',
74
+ line: 3,
75
+ column: 81,
76
+ message: 'Line is 81 chars long, but should be 80.',
77
+ level: :error
78
78
  }
79
79
  ]
80
80
  }
@@ -0,0 +1,511 @@
1
+ require 'spec_helper'
2
+ require_relative '../../support/argument_alignment_cases'
3
+ require 'tailor/critic'
4
+ require 'tailor/configuration/style'
5
+
6
+ describe 'Argument alignment' do
7
+
8
+ def file_name
9
+ self.class.description
10
+ end
11
+
12
+ def contents
13
+ ARG_INDENT[file_name] || begin
14
+ raise "Example not found: #{file_name}"
15
+ end
16
+ end
17
+
18
+ before do
19
+ Tailor::Logger.stub(:log)
20
+ FakeFS.activate!
21
+ FileUtils.touch file_name
22
+ File.open(file_name, 'w') { |f| f.write contents }
23
+ end
24
+
25
+ let(:critic) { Tailor::Critic.new }
26
+
27
+ let(:style) do
28
+ style = Tailor::Configuration::Style.new
29
+ style.trailing_newlines 0, level: :off
30
+ style.allow_invalid_ruby true, level: :off
31
+ style
32
+ end
33
+
34
+ context :def_no_arguments do
35
+
36
+ it 'does not warn when argument alignment is not specified' do
37
+ critic.check_file(file_name, style.to_hash)
38
+ expect(critic.problems[file_name]).to be_empty
39
+ end
40
+
41
+ it 'does not warn when argument alignment is disabled' do
42
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
43
+ critic.check_file(file_name, style.to_hash)
44
+ expect(critic.problems[file_name]).to be_empty
45
+ end
46
+
47
+ it 'does not warn when argument alignment is enabled' do
48
+ style.indentation_spaces 2, level: :error, argument_alignment: true
49
+ critic.check_file(file_name, style.to_hash)
50
+ expect(critic.problems[file_name]).to be_empty
51
+ end
52
+
53
+ end
54
+
55
+ context :def_arguments_fit_on_one_line do
56
+
57
+ it 'does not warn when argument alignment is not specified' do
58
+ critic.check_file(file_name, style.to_hash)
59
+ expect(critic.problems[file_name]).to be_empty
60
+ end
61
+
62
+ it 'does not warn when argument alignment is disabled' do
63
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
64
+ critic.check_file(file_name, style.to_hash)
65
+ expect(critic.problems[file_name]).to be_empty
66
+ end
67
+
68
+ it 'does not warn when argument alignment is enabled' do
69
+ style.indentation_spaces 2, level: :error, argument_alignment: true
70
+ critic.check_file(file_name, style.to_hash)
71
+ expect(critic.problems[file_name]).to be_empty
72
+ end
73
+
74
+ end
75
+
76
+ context :def_arguments_aligned do
77
+
78
+ it 'warns when argument alignment is not specified' do
79
+ critic.check_file(file_name, style.to_hash)
80
+ expect(critic.problems[file_name]).to eql [{
81
+ type: 'indentation_spaces',
82
+ line: 2,
83
+ column: 14,
84
+ message: "Line is indented to column 14, but should be at 2.",
85
+ level: :error
86
+ }]
87
+ end
88
+
89
+ it 'warns when argument alignment is disabled' do
90
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
91
+ critic.check_file(file_name, style.to_hash)
92
+ expect(critic.problems[file_name]).to eql [{
93
+ type: 'indentation_spaces',
94
+ line: 2,
95
+ column: 14,
96
+ message: "Line is indented to column 14, but should be at 2.",
97
+ level: :error
98
+ }]
99
+ end
100
+
101
+ it 'does not warn when argument alignment is enabled' do
102
+ style.indentation_spaces 2, level: :error, argument_alignment: true
103
+ critic.check_file(file_name, style.to_hash)
104
+ expect(critic.problems[file_name]).to be_empty
105
+ end
106
+
107
+ end
108
+
109
+ context :def_arguments_indented do
110
+
111
+ it 'does not warn when argument alignment is not specified' do
112
+ critic.check_file(file_name, style.to_hash)
113
+ expect(critic.problems[file_name]).to be_empty
114
+ end
115
+
116
+ it 'does not warn when argument alignment is disabled' do
117
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
118
+ critic.check_file(file_name, style.to_hash)
119
+ expect(critic.problems[file_name]).to be_empty
120
+ end
121
+
122
+ it 'warns when argument alignment is enabled' do
123
+ style.indentation_spaces 2, level: :error, argument_alignment: true
124
+ critic.check_file(file_name, style.to_hash)
125
+ expect(critic.problems[file_name]).to eql [{
126
+ type: 'indentation_spaces',
127
+ line: 2,
128
+ column: 2,
129
+ message: "Line is indented to column 2, but should be at 14.",
130
+ level: :error
131
+ }]
132
+ end
133
+
134
+ end
135
+
136
+ context :call_arguments_fit_on_one_line do
137
+
138
+ it 'does not warn when argument alignment is not specified' do
139
+ critic.check_file(file_name, style.to_hash)
140
+ expect(critic.problems[file_name]).to be_empty
141
+ end
142
+
143
+ it 'does not warn when argument alignment is disabled' do
144
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
145
+ critic.check_file(file_name, style.to_hash)
146
+ expect(critic.problems[file_name]).to be_empty
147
+ end
148
+
149
+ it 'does not warn when argument alignment is enabled' do
150
+ style.indentation_spaces 2, level: :error, argument_alignment: true
151
+ critic.check_file(file_name, style.to_hash)
152
+ expect(critic.problems[file_name]).to be_empty
153
+ end
154
+
155
+ end
156
+
157
+ context :call_no_arguments do
158
+
159
+ it 'does not warn when argument alignment is not specified' do
160
+ critic.check_file(file_name, style.to_hash)
161
+ expect(critic.problems[file_name]).to be_empty
162
+ end
163
+
164
+ it 'does not warn when argument alignment is disabled' do
165
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
166
+ critic.check_file(file_name, style.to_hash)
167
+ expect(critic.problems[file_name]).to be_empty
168
+ end
169
+
170
+ it 'does not warn when argument alignment is enabled' do
171
+ style.indentation_spaces 2, level: :error, argument_alignment: true
172
+ critic.check_file(file_name, style.to_hash)
173
+ expect(critic.problems[file_name]).to be_empty
174
+ end
175
+
176
+ end
177
+
178
+ context :call_arguments_aligned do
179
+
180
+ it 'warns when argument alignment is not specified' do
181
+ critic.check_file(file_name, style.to_hash)
182
+ expect(critic.problems[file_name]).to eql [{
183
+ type: 'indentation_spaces',
184
+ line: 2,
185
+ column: 49,
186
+ message: "Line is indented to column 49, but should be at 2.",
187
+ level: :error
188
+ }]
189
+ end
190
+
191
+ it 'warns when argument alignment is disabled' do
192
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
193
+ critic.check_file(file_name, style.to_hash)
194
+ expect(critic.problems[file_name]).to eql [{
195
+ type: 'indentation_spaces',
196
+ line: 2,
197
+ column: 49,
198
+ message: "Line is indented to column 49, but should be at 2.",
199
+ level: :error
200
+ }]
201
+ end
202
+
203
+ it 'does not warn when argument alignment is enabled' do
204
+ style.indentation_spaces 2, level: :error, argument_alignment: true
205
+ critic.check_file(file_name, style.to_hash)
206
+ expect(critic.problems[file_name]).to be_empty
207
+ end
208
+
209
+ end
210
+
211
+ context :call_arguments_aligned_args_are_integer_literals do
212
+
213
+ it 'warns when argument alignment is not specified' do
214
+ critic.check_file(file_name, style.to_hash)
215
+ expect(critic.problems[file_name]).to eql [{
216
+ type: 'indentation_spaces',
217
+ line: 2,
218
+ column: 49,
219
+ message: "Line is indented to column 49, but should be at 2.",
220
+ level: :error
221
+ }]
222
+ end
223
+
224
+ it 'warns when argument alignment is disabled' do
225
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
226
+ critic.check_file(file_name, style.to_hash)
227
+ expect(critic.problems[file_name]).to eql [{
228
+ type: 'indentation_spaces',
229
+ line: 2,
230
+ column: 49,
231
+ message: "Line is indented to column 49, but should be at 2.",
232
+ level: :error
233
+ }]
234
+ end
235
+
236
+ it 'does not warn when argument alignment is enabled' do
237
+ style.indentation_spaces 2, level: :error, argument_alignment: true
238
+ critic.check_file(file_name, style.to_hash)
239
+ expect(critic.problems[file_name]).to be_empty
240
+ end
241
+
242
+ end
243
+
244
+ context :call_arguments_aligned_args_are_string_literals do
245
+
246
+ it 'warns when argument alignment is not specified' do
247
+ critic.check_file(file_name, style.to_hash)
248
+ expect(critic.problems[file_name]).to eql [{
249
+ type: 'indentation_spaces',
250
+ line: 2,
251
+ column: 49,
252
+ message: "Line is indented to column 49, but should be at 2.",
253
+ level: :error
254
+ }]
255
+ end
256
+
257
+ it 'warns when argument alignment is disabled' do
258
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
259
+ critic.check_file(file_name, style.to_hash)
260
+ expect(critic.problems[file_name]).to eql [{
261
+ type: 'indentation_spaces',
262
+ line: 2,
263
+ column: 49,
264
+ message: "Line is indented to column 49, but should be at 2.",
265
+ level: :error
266
+ }]
267
+ end
268
+
269
+ it 'does not warn when argument alignment is enabled' do
270
+ style.indentation_spaces 2, level: :error, argument_alignment: true
271
+ critic.check_file(file_name, style.to_hash)
272
+ expect(critic.problems[file_name]).to be_empty
273
+ end
274
+
275
+ end
276
+
277
+ context :call_arguments_aligned_multiple_lines do
278
+
279
+ it 'warns when argument alignment is not specified' do
280
+ critic.check_file(file_name, style.to_hash)
281
+ expect(critic.problems[file_name]).to eql [
282
+ {
283
+ type: 'indentation_spaces',
284
+ line: 2,
285
+ column: 49,
286
+ message: "Line is indented to column 49, but should be at 2.",
287
+ level: :error
288
+ },
289
+ {
290
+ type: 'indentation_spaces',
291
+ line: 3,
292
+ column: 49,
293
+ message: "Line is indented to column 49, but should be at 2.",
294
+ level: :error
295
+ }
296
+ ]
297
+ end
298
+
299
+ it 'warns when argument alignment is disabled' do
300
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
301
+ critic.check_file(file_name, style.to_hash)
302
+ expect(critic.problems[file_name]).to eql [
303
+ {
304
+ type: 'indentation_spaces',
305
+ line: 2,
306
+ column: 49,
307
+ message: "Line is indented to column 49, but should be at 2.",
308
+ level: :error
309
+ },
310
+ {
311
+ type: 'indentation_spaces',
312
+ line: 3,
313
+ column: 49,
314
+ message: "Line is indented to column 49, but should be at 2.",
315
+ level: :error
316
+ }
317
+ ]
318
+ end
319
+
320
+ it 'does not warn when argument alignment is enabled' do
321
+ style.indentation_spaces 2, level: :error, argument_alignment: true
322
+ critic.check_file(file_name, style.to_hash)
323
+ expect(critic.problems[file_name]).to be_empty
324
+ end
325
+
326
+ end
327
+
328
+ context :call_arguments_aligned_args_have_parens do
329
+ it 'warns when argument alignment is not specified' do
330
+ critic.check_file(file_name, style.to_hash)
331
+ expect(critic.problems[file_name]).to eql [
332
+ {
333
+ type: 'indentation_spaces',
334
+ line: 2,
335
+ column: 49,
336
+ message: "Line is indented to column 49, but should be at 2.",
337
+ level: :error
338
+ }
339
+ ]
340
+ end
341
+
342
+ it 'warns when argument alignment is disabled' do
343
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
344
+ critic.check_file(file_name, style.to_hash)
345
+ expect(critic.problems[file_name]).to eql [
346
+ {
347
+ type: 'indentation_spaces',
348
+ line: 2,
349
+ column: 49,
350
+ message: "Line is indented to column 49, but should be at 2.",
351
+ level: :error
352
+ }
353
+ ]
354
+ end
355
+
356
+ it 'does not warn when argument alignment is enabled' do
357
+ style.indentation_spaces 2, level: :error, argument_alignment: true
358
+ critic.check_file(file_name, style.to_hash)
359
+ expect(critic.problems[file_name]).to be_empty
360
+ end
361
+
362
+
363
+ end
364
+
365
+ context :call_arguments_aligned_no_parens do
366
+
367
+ it 'warns when argument alignment is not specified' do
368
+ critic.check_file(file_name, style.to_hash)
369
+ expect(critic.problems[file_name]).to eql [{
370
+ type: 'indentation_spaces',
371
+ line: 2,
372
+ column: 49,
373
+ message: "Line is indented to column 49, but should be at 2.",
374
+ level: :error
375
+ }]
376
+ end
377
+
378
+ it 'warns when argument alignment is disabled' do
379
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
380
+ critic.check_file(file_name, style.to_hash)
381
+ expect(critic.problems[file_name]).to eql [{
382
+ type: 'indentation_spaces',
383
+ line: 2,
384
+ column: 49,
385
+ message: "Line is indented to column 49, but should be at 2.",
386
+ level: :error
387
+ }]
388
+ end
389
+
390
+ it 'does not warn when argument alignment is enabled' do
391
+ style.indentation_spaces 2, level: :error, argument_alignment: true
392
+ critic.check_file(file_name, style.to_hash)
393
+ expect(critic.problems[file_name]).to be_empty
394
+ end
395
+
396
+ end
397
+
398
+ context :call_arguments_indented do
399
+
400
+ it 'does not warn when argument alignment is not specified' do
401
+ critic.check_file(file_name, style.to_hash)
402
+ expect(critic.problems[file_name]).to be_empty
403
+ end
404
+
405
+ it 'does not warn when argument alignment is disabled' do
406
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
407
+ critic.check_file(file_name, style.to_hash)
408
+ expect(critic.problems[file_name]).to be_empty
409
+ end
410
+
411
+ it 'warns when argument alignment is enabled' do
412
+ style.indentation_spaces 2, level: :error, argument_alignment: true
413
+ critic.check_file(file_name, style.to_hash)
414
+ expect(critic.problems[file_name]).to eql [{
415
+ type: 'indentation_spaces',
416
+ line: 2,
417
+ column: 2,
418
+ message: "Line is indented to column 2, but should be at 49.",
419
+ level: :error
420
+ }]
421
+ end
422
+
423
+ end
424
+
425
+ context :call_arguments_indented_separate_line do
426
+
427
+ it 'does not warn when argument alignment is not specified' do
428
+ critic.check_file(file_name, style.to_hash)
429
+ expect(critic.problems[file_name]).to be_empty
430
+ end
431
+
432
+ it 'does not warn when argument alignment is disabled' do
433
+ style.indentation_spaces 2, level: :error, argument_alignment: :off
434
+ critic.check_file(file_name, style.to_hash)
435
+ expect(critic.problems[file_name]).to be_empty
436
+ end
437
+
438
+ it 'does not warn when argument alignment is enabled' do
439
+ style.indentation_spaces 2, level: :error, argument_alignment: true
440
+ critic.check_file(file_name, style.to_hash)
441
+ expect(critic.problems[file_name]).to be_empty
442
+ end
443
+
444
+ end
445
+
446
+ context :call_arguments_on_next_line do
447
+
448
+ it 'does not warn when argument alignment is not specified' do
449
+ style.indentation_spaces 2, level: :error, line_continuations: true
450
+ critic.check_file(file_name, style.to_hash)
451
+ expect(critic.problems[file_name]).to be_empty
452
+ end
453
+
454
+ it 'does not warn when argument alignment is disabled' do
455
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: :off
456
+ critic.check_file(file_name, style.to_hash)
457
+ expect(critic.problems[file_name]).to be_empty
458
+ end
459
+
460
+ it 'does not warn when argument alignment is enabled' do
461
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: true
462
+ critic.check_file(file_name, style.to_hash)
463
+ expect(critic.problems[file_name]).to be_empty
464
+ end
465
+
466
+ end
467
+
468
+ context :call_arguments_on_next_line_nested do
469
+
470
+ it 'does not warn when argument alignment is not specified' do
471
+ style.indentation_spaces 2, level: :error, line_continuations: true
472
+ critic.check_file(file_name, style.to_hash)
473
+ expect(critic.problems[file_name]).to be_empty
474
+ end
475
+
476
+ it 'does not warn when argument alignment is disabled' do
477
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: :off
478
+ critic.check_file(file_name, style.to_hash)
479
+ expect(critic.problems[file_name]).to be_empty
480
+ end
481
+
482
+ it 'does not warn when argument alignment is enabled' do
483
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: true
484
+ critic.check_file(file_name, style.to_hash)
485
+ expect(critic.problems[file_name]).to be_empty
486
+ end
487
+
488
+ end
489
+ context :call_arguments_on_next_line_multiple do
490
+
491
+ it 'does not warn when argument alignment is not specified' do
492
+ style.indentation_spaces 2, level: :error, line_continuations: true
493
+ critic.check_file(file_name, style.to_hash)
494
+ expect(critic.problems[file_name]).to be_empty
495
+ end
496
+
497
+ it 'does not warn when argument alignment is disabled' do
498
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: :off
499
+ critic.check_file(file_name, style.to_hash)
500
+ expect(critic.problems[file_name]).to be_empty
501
+ end
502
+
503
+ it 'does not warn when argument alignment is enabled' do
504
+ style.indentation_spaces 2, level: :error, line_continuations: true, argument_alignment: true
505
+ critic.check_file(file_name, style.to_hash)
506
+ expect(critic.problems[file_name]).to be_empty
507
+ end
508
+
509
+ end
510
+
511
+ end