rubocop 1.14.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/config/default.yml +120 -34
  4. data/lib/rubocop.rb +8 -0
  5. data/lib/rubocop/cli/command/suggest_extensions.rb +3 -3
  6. data/lib/rubocop/config_loader.rb +1 -1
  7. data/lib/rubocop/config_validator.rb +5 -5
  8. data/lib/rubocop/cop/base.rb +2 -2
  9. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
  10. data/lib/rubocop/cop/bundler/gem_version.rb +38 -4
  11. data/lib/rubocop/cop/corrector.rb +4 -4
  12. data/lib/rubocop/cop/generator.rb +1 -1
  13. data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
  14. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
  15. data/lib/rubocop/cop/layout/argument_alignment.rb +30 -12
  16. data/lib/rubocop/cop/layout/array_alignment.rb +2 -2
  17. data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
  18. data/lib/rubocop/cop/layout/case_indentation.rb +57 -9
  19. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +7 -1
  20. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  21. data/lib/rubocop/cop/layout/dot_position.rb +7 -1
  22. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +13 -15
  23. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
  24. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +14 -2
  25. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  26. data/lib/rubocop/cop/layout/hash_alignment.rb +40 -14
  27. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
  28. data/lib/rubocop/cop/layout/indentation_width.rb +13 -2
  29. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +122 -0
  30. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +6 -6
  31. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +2 -2
  32. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +6 -6
  33. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +6 -6
  34. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +6 -6
  35. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -3
  36. data/lib/rubocop/cop/layout/parameter_alignment.rb +2 -2
  37. data/lib/rubocop/cop/layout/redundant_line_break.rb +11 -9
  38. data/lib/rubocop/cop/layout/space_around_keyword.rb +28 -0
  39. data/lib/rubocop/cop/layout/space_around_operators.rb +7 -1
  40. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +4 -0
  41. data/lib/rubocop/cop/lint/empty_block.rb +18 -2
  42. data/lib/rubocop/cop/lint/empty_in_pattern.rb +62 -0
  43. data/lib/rubocop/cop/lint/literal_as_condition.rb +13 -1
  44. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +32 -17
  45. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  46. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  47. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  48. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +105 -74
  49. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -0
  50. data/lib/rubocop/cop/lint/symbol_conversion.rb +3 -13
  51. data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
  52. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
  53. data/lib/rubocop/cop/lint/void.rb +1 -1
  54. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  55. data/lib/rubocop/cop/migration/department_name.rb +3 -1
  56. data/lib/rubocop/cop/mixin/check_line_breakable.rb +28 -3
  57. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +6 -0
  58. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +14 -3
  59. data/lib/rubocop/cop/mixin/string_literals_help.rb +2 -4
  60. data/lib/rubocop/cop/mixin/symbol_help.rb +13 -0
  61. data/lib/rubocop/cop/naming/inclusive_language.rb +249 -0
  62. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +2 -2
  63. data/lib/rubocop/cop/style/class_and_module_children.rb +28 -2
  64. data/lib/rubocop/cop/style/empty_literal.rb +8 -1
  65. data/lib/rubocop/cop/style/hash_each_methods.rb +18 -1
  66. data/lib/rubocop/cop/style/identical_conditional_branches.rb +58 -8
  67. data/lib/rubocop/cop/style/in_pattern_then.rb +56 -0
  68. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -1
  69. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +62 -0
  70. data/lib/rubocop/cop/style/multiline_when_then.rb +2 -11
  71. data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
  72. data/lib/rubocop/cop/style/nil_lambda.rb +29 -12
  73. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  74. data/lib/rubocop/cop/style/quoted_symbols.rb +110 -0
  75. data/lib/rubocop/cop/style/raise_args.rb +2 -0
  76. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  77. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  78. data/lib/rubocop/cop/style/redundant_self.rb +24 -2
  79. data/lib/rubocop/cop/style/regexp_literal.rb +10 -1
  80. data/lib/rubocop/cop/style/special_global_vars.rb +3 -3
  81. data/lib/rubocop/cop/style/string_concatenation.rb +32 -5
  82. data/lib/rubocop/cop/style/string_literals.rb +3 -2
  83. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -0
  84. data/lib/rubocop/cop/style/swap_values.rb +1 -1
  85. data/lib/rubocop/cop/style/top_level_method_definition.rb +83 -0
  86. data/lib/rubocop/cop/style/trivial_accessors.rb +65 -0
  87. data/lib/rubocop/cop/style/unpack_first.rb +1 -1
  88. data/lib/rubocop/cop/style/when_then.rb +6 -2
  89. data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
  90. data/lib/rubocop/directive_comment.rb +58 -6
  91. data/lib/rubocop/formatter/junit_formatter.rb +21 -6
  92. data/lib/rubocop/options.rb +18 -24
  93. data/lib/rubocop/rake_task.rb +1 -1
  94. data/lib/rubocop/remote_config.rb +10 -2
  95. data/lib/rubocop/rspec/cop_helper.rb +1 -1
  96. data/lib/rubocop/rspec/expect_offense.rb +1 -1
  97. data/lib/rubocop/version.rb +1 -1
  98. metadata +13 -5
@@ -155,7 +155,13 @@ module RuboCop
155
155
  end
156
156
 
157
157
  def all_elements_aligned?(elements)
158
- elements.map { |e| e.loc.column }.uniq.count == 1
158
+ elements.flat_map do |e|
159
+ if e.hash_type?
160
+ e.each_pair.map { |pair| pair.loc.column }
161
+ else
162
+ e.loc.column
163
+ end
164
+ end.uniq.count == 1
159
165
  end
160
166
 
161
167
  def first_argument_line(elements)
@@ -37,7 +37,7 @@ module RuboCop
37
37
  extend AutoCorrector
38
38
 
39
39
  MSG = 'Incorrect indentation detected (column %<column>d ' \
40
- 'instead of %<correct_comment_indentation>d).'
40
+ 'instead of %<correct_comment_indentation>d).'
41
41
 
42
42
  def on_new_investigation
43
43
  processed_source.comments.each { |comment| check(comment) }
@@ -24,6 +24,7 @@ module RuboCop
24
24
  # method
25
25
  class DotPosition < Base
26
26
  include ConfigurableEnforcedStyle
27
+ include RangeHelp
27
28
  extend AutoCorrector
28
29
 
29
30
  def on_send(node)
@@ -42,7 +43,12 @@ module RuboCop
42
43
  private
43
44
 
44
45
  def autocorrect(corrector, dot, node)
45
- corrector.remove(dot)
46
+ dot_range = if processed_source[dot.line - 1].strip == '.'
47
+ range_by_whole_lines(dot, include_final_newline: true)
48
+ else
49
+ dot
50
+ end
51
+ corrector.remove(dot_range)
46
52
  case style
47
53
  when :leading
48
54
  corrector.insert_before(selector_range(node), dot.source)
@@ -45,8 +45,7 @@ module RuboCop
45
45
  def on_if(node)
46
46
  return if correct_style?(node)
47
47
 
48
- if node.modifier_form? && last_argument_is_heredoc?(node)
49
- heredoc_node = last_heredoc_argument(node)
48
+ if node.modifier_form? && (heredoc_node = last_heredoc_argument(node))
50
49
  return if next_line_empty_or_enable_directive_comment?(heredoc_line(node, heredoc_node))
51
50
 
52
51
  add_offense(heredoc_node.loc.heredoc_end) do |corrector|
@@ -62,7 +61,7 @@ module RuboCop
62
61
  private
63
62
 
64
63
  def autocorrect(corrector, node)
65
- node_range = if node.respond_to?(:heredoc?) && node.heredoc?
64
+ node_range = if heredoc?(node)
66
65
  range_by_whole_lines(node.loc.heredoc_body)
67
66
  else
68
67
  range_by_whole_lines(node.source_range)
@@ -125,19 +124,8 @@ module RuboCop
125
124
  next_sibling.if_type? && contains_guard_clause?(next_sibling)
126
125
  end
127
126
 
128
- def last_argument_is_heredoc?(node)
129
- last_children = node.if_branch
130
- return false unless last_children&.send_type?
131
-
132
- heredoc?(last_heredoc_argument(node))
133
- end
134
-
135
127
  def last_heredoc_argument(node)
136
- n = if node.respond_to?(:if_branch)
137
- node.if_branch.children.last
138
- else
139
- node
140
- end
128
+ n = last_heredoc_argument_node(node)
141
129
 
142
130
  return n if heredoc?(n)
143
131
  return unless n.respond_to?(:arguments)
@@ -150,6 +138,16 @@ module RuboCop
150
138
  return last_heredoc_argument(n.receiver) if n.respond_to?(:receiver)
151
139
  end
152
140
 
141
+ def last_heredoc_argument_node(node)
142
+ return node unless node.respond_to?(:if_branch)
143
+
144
+ if node.if_branch.and_type?
145
+ node.if_branch.children.first
146
+ else
147
+ node.if_branch.children.last
148
+ end
149
+ end
150
+
153
151
  def heredoc_line(node, heredoc_node)
154
152
  heredoc_body = heredoc_node.loc.heredoc_body
155
153
  num_of_heredoc_lines = heredoc_body.last_line - heredoc_body.first_line
@@ -161,10 +161,10 @@ module RuboCop
161
161
  'Indent the right bracket the same as the left bracket.'
162
162
  elsif style == :special_inside_parentheses && left_parenthesis
163
163
  'Indent the right bracket the same as the first position ' \
164
- 'after the preceding left parenthesis.'
164
+ 'after the preceding left parenthesis.'
165
165
  else
166
166
  'Indent the right bracket the same as the start of the line' \
167
- ' where the left bracket is.'
167
+ ' where the left bracket is.'
168
168
  end
169
169
  end
170
170
  end
@@ -91,6 +91,8 @@ module RuboCop
91
91
  end
92
92
 
93
93
  def on_send(node)
94
+ return if enforce_first_argument_with_fixed_indentation?
95
+
94
96
  each_argument_node(node, :hash) do |hash_node, left_parenthesis|
95
97
  check(hash_node, left_parenthesis)
96
98
  end
@@ -176,12 +178,22 @@ module RuboCop
176
178
  'Indent the right brace the same as the left brace.'
177
179
  elsif style == :special_inside_parentheses && left_parenthesis
178
180
  'Indent the right brace the same as the first position ' \
179
- 'after the preceding left parenthesis.'
181
+ 'after the preceding left parenthesis.'
180
182
  else
181
183
  'Indent the right brace the same as the start of the line ' \
182
- 'where the left brace is.'
184
+ 'where the left brace is.'
183
185
  end
184
186
  end
187
+
188
+ def enforce_first_argument_with_fixed_indentation?
189
+ return false unless argument_alignment_config['Enabled']
190
+
191
+ argument_alignment_config['EnforcedStyle'] == 'with_fixed_indentation'
192
+ end
193
+
194
+ def argument_alignment_config
195
+ config.for_cop('Layout/ArgumentAlignment')
196
+ end
185
197
  end
186
198
  end
187
199
  end
@@ -48,7 +48,7 @@ module RuboCop
48
48
  extend AutoCorrector
49
49
 
50
50
  MSG = 'Use %<configured_indentation_width>d spaces for indentation ' \
51
- 'in method args, relative to %<base_description>s.'
51
+ 'in method args, relative to %<base_description>s.'
52
52
 
53
53
  def on_def(node)
54
54
  return if node.arguments.empty?
@@ -180,12 +180,15 @@ module RuboCop
180
180
  include RangeHelp
181
181
  extend AutoCorrector
182
182
 
183
- MESSAGES = { KeyAlignment => 'Align the keys of a hash literal if ' \
184
- 'they span more than one line.',
185
- SeparatorAlignment => 'Align the separators of a hash ' \
186
- 'literal if they span more than one line.',
187
- TableAlignment => 'Align the keys and values of a hash ' \
188
- 'literal if they span more than one line.' }.freeze
183
+ MESSAGES = {
184
+ KeyAlignment => 'Align the keys of a hash literal if they span more than one line.',
185
+ SeparatorAlignment => 'Align the separators of a hash literal if they span more than ' \
186
+ 'one line.',
187
+ TableAlignment => 'Align the keys and values of a hash literal if they span more than ' \
188
+ 'one line.',
189
+ KeywordSplatAlignment => 'Align keyword splats with the rest of the hash if it spans ' \
190
+ 'more than one line.'
191
+ }.freeze
189
192
 
190
193
  def on_send(node)
191
194
  return if double_splat?(node)
@@ -200,14 +203,12 @@ module RuboCop
200
203
  alias on_super on_send
201
204
  alias on_yield on_send
202
205
 
203
- def on_hash(node) # rubocop:todo Metrics/CyclomaticComplexity
204
- return if ignored_node?(node)
205
- return if node.pairs.empty? || node.single_line?
206
+ def on_hash(node)
207
+ return if autocorrect_incompatible_with_other_cops?(node) || ignored_node?(node) ||
208
+ node.pairs.empty? || node.single_line?
206
209
 
207
- return unless alignment_for_hash_rockets
208
- .any? { |a| a.checkable_layout?(node) } &&
209
- alignment_for_colons
210
- .any? { |a| a.checkable_layout?(node) }
210
+ proc = ->(a) { a.checkable_layout?(node) }
211
+ return unless alignment_for_hash_rockets.any?(proc) && alignment_for_colons.any?(proc)
211
212
 
212
213
  check_pairs(node)
213
214
  end
@@ -216,6 +217,12 @@ module RuboCop
216
217
 
217
218
  private
218
219
 
220
+ def autocorrect_incompatible_with_other_cops?(node)
221
+ enforce_first_argument_with_fixed_indentation? &&
222
+ node.pairs.any? &&
223
+ node.parent&.call_type? && node.parent.loc.line == node.pairs.first.loc.line
224
+ end
225
+
219
226
  def reset!
220
227
  self.offences_by = {}
221
228
  self.column_deltas = Hash.new { |hash, key| hash[key] = {} }
@@ -245,7 +252,14 @@ module RuboCop
245
252
  end
246
253
 
247
254
  def add_offences
255
+ kwsplat_offences = offences_by.delete(KeywordSplatAlignment)
256
+ register_offences_with_format(kwsplat_offences, KeywordSplatAlignment)
257
+
248
258
  format, offences = offences_by.min_by { |_, v| v.length }
259
+ register_offences_with_format(offences, format)
260
+ end
261
+
262
+ def register_offences_with_format(offences, format)
249
263
  (offences || []).each do |offence|
250
264
  add_offense(offence, message: MESSAGES[format]) do |corrector|
251
265
  delta = column_deltas[alignment_for(offence).first.class][offence]
@@ -273,7 +287,9 @@ module RuboCop
273
287
  end
274
288
 
275
289
  def alignment_for(pair)
276
- if pair.hash_rocket?
290
+ if pair.kwsplat_type?
291
+ [KeywordSplatAlignment.new]
292
+ elsif pair.hash_rocket?
277
293
  alignment_for_hash_rockets
278
294
  else
279
295
  alignment_for_colons
@@ -353,6 +369,16 @@ module RuboCop
353
369
  def good_alignment?(column_deltas)
354
370
  column_deltas.values.all?(&:zero?)
355
371
  end
372
+
373
+ def enforce_first_argument_with_fixed_indentation?
374
+ return false unless argument_alignment_config['Enabled']
375
+
376
+ argument_alignment_config['EnforcedStyle'] == 'with_fixed_indentation'
377
+ end
378
+
379
+ def argument_alignment_config
380
+ config.for_cop('Layout/ArgumentAlignment')
381
+ end
356
382
  end
357
383
  end
358
384
  end
@@ -55,7 +55,7 @@ module RuboCop
55
55
  extend AutoCorrector
56
56
 
57
57
  MSG = 'Put the closing parenthesis for a method call with a ' \
58
- 'HEREDOC parameter on the same line as the HEREDOC opening.'
58
+ 'HEREDOC parameter on the same line as the HEREDOC opening.'
59
59
 
60
60
  def self.autocorrect_incompatible_with
61
61
  [Style::TrailingCommaInArguments]
@@ -138,6 +138,14 @@ module RuboCop
138
138
  check_indentation(case_node.when_branches.last.loc.keyword, case_node.else_branch)
139
139
  end
140
140
 
141
+ def on_case_match(case_match)
142
+ case_match.each_in_pattern do |in_pattern_node|
143
+ check_indentation(in_pattern_node.loc.keyword, in_pattern_node.body)
144
+ end
145
+
146
+ check_indentation(case_match.in_pattern_branches.last.loc.keyword, case_match.else_branch)
147
+ end
148
+
141
149
  def on_if(node, base = node)
142
150
  return if ignored_node?(node)
143
151
  return if node.ternary? || node.modifier_form?
@@ -313,9 +321,12 @@ module RuboCop
313
321
  check_rescue?(body_node)
314
322
  elsif body_node.ensure_type?
315
323
  block_body, = *body_node
316
- return unless block_body
317
324
 
318
- check_rescue?(block_body) if block_body.rescue_type?
325
+ if block_body&.rescue_type?
326
+ check_rescue?(block_body)
327
+ else
328
+ !block_body.nil?
329
+ end
319
330
  else
320
331
  true
321
332
  end
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Layout
6
+ # This cop checks the indentation of the next line after a line that ends with a string
7
+ # literal and a backslash.
8
+ #
9
+ # If `EnforcedStyle: aligned` is set, the concatenated string parts shall be aligned with the
10
+ # first part. There are some exceptions, such as implicit return values, where the
11
+ # concatenated string parts shall be indented regardless of `EnforcedStyle` configuration.
12
+ #
13
+ # If `EnforcedStyle: indented` is set, it's the second line that shall be indented one step
14
+ # more than the first line. Lines 3 and forward shall be aligned with line 2. Here too there
15
+ # are exceptions. Values in a hash literal are always aligned.
16
+ #
17
+ # @example
18
+ # # bad
19
+ # def some_method
20
+ # 'x' \
21
+ # 'y' \
22
+ # 'z'
23
+ # end
24
+ #
25
+ # my_hash = {
26
+ # first: 'a message' \
27
+ # 'in two parts'
28
+ # }
29
+ #
30
+ # # good
31
+ # def some_method
32
+ # 'x' \
33
+ # 'y' \
34
+ # 'z'
35
+ # end
36
+ #
37
+ # my_hash = {
38
+ # first: 'a message' \
39
+ # 'in two parts'
40
+ # }
41
+ #
42
+ # @example EnforcedStyle: aligned (default)
43
+ # # bad
44
+ # puts 'x' \
45
+ # 'y'
46
+ #
47
+ # # good
48
+ # puts 'x' \
49
+ # 'y'
50
+ #
51
+ # @example EnforcedStyle: indented
52
+ # # bad
53
+ # result = 'x' \
54
+ # 'y'
55
+ #
56
+ # # good
57
+ # result = 'x' \
58
+ # 'y'
59
+ #
60
+ class LineEndStringConcatenationIndentation < Base
61
+ include ConfigurableEnforcedStyle
62
+ include Alignment
63
+ extend AutoCorrector
64
+
65
+ MSG_ALIGN = 'Align parts of a string concatenated with backslash.'
66
+ MSG_INDENT = 'Indent the first part of a string concatenated with backslash.'
67
+ PARENT_TYPES_FOR_INDENTED = [nil, :block, :begin, :def, :defs, :if].freeze
68
+
69
+ def on_dstr(node)
70
+ return unless strings_concatenated_with_backslash?(node)
71
+
72
+ children = node.children
73
+ if style == :aligned && !always_indented?(node) || always_aligned?(node)
74
+ check_aligned(children, 1)
75
+ else
76
+ check_indented(children)
77
+ check_aligned(children, 2)
78
+ end
79
+ end
80
+
81
+ def autocorrect(corrector, node)
82
+ AlignmentCorrector.correct(corrector, processed_source, node, @column_delta)
83
+ end
84
+
85
+ private
86
+
87
+ def strings_concatenated_with_backslash?(dstr_node)
88
+ !dstr_node.heredoc? &&
89
+ dstr_node.children.length > 1 &&
90
+ dstr_node.children.all? { |c| c.str_type? || c.dstr_type? }
91
+ end
92
+
93
+ def always_indented?(dstr_node)
94
+ PARENT_TYPES_FOR_INDENTED.include?(dstr_node.parent&.type)
95
+ end
96
+
97
+ def always_aligned?(dstr_node)
98
+ dstr_node.parent&.pair_type?
99
+ end
100
+
101
+ def check_aligned(children, start_index)
102
+ base_column = children[start_index - 1].loc.column
103
+ children[start_index..-1].each do |child|
104
+ @column_delta = base_column - child.loc.column
105
+ add_offense_and_correction(child, MSG_ALIGN) if @column_delta != 0
106
+ base_column = child.loc.column
107
+ end
108
+ end
109
+
110
+ def check_indented(children)
111
+ base_column = children[0].source_range.source_line =~ /\S/
112
+ @column_delta = base_column + configured_indentation_width - children[1].loc.column
113
+ add_offense_and_correction(children[1], MSG_INDENT) if @column_delta != 0
114
+ end
115
+
116
+ def add_offense_and_correction(node, message)
117
+ add_offense(node, message: message) { |corrector| autocorrect(corrector, node) }
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
@@ -93,18 +93,18 @@ module RuboCop
93
93
  extend AutoCorrector
94
94
 
95
95
  SAME_LINE_MESSAGE = 'The closing array brace must be on the same ' \
96
- 'line as the last array element when the opening brace is on the ' \
97
- 'same line as the first array element.'
96
+ 'line as the last array element when the opening brace is on the ' \
97
+ 'same line as the first array element.'
98
98
 
99
99
  NEW_LINE_MESSAGE = 'The closing array brace must be on the line ' \
100
- 'after the last array element when the opening brace is on a ' \
101
- 'separate line from the first array element.'
100
+ 'after the last array element when the opening brace is on a ' \
101
+ 'separate line from the first array element.'
102
102
 
103
103
  ALWAYS_NEW_LINE_MESSAGE = 'The closing array brace must be on the ' \
104
- 'line after the last array element.'
104
+ 'line after the last array element.'
105
105
 
106
106
  ALWAYS_SAME_LINE_MESSAGE = 'The closing array brace must be on the ' \
107
- 'same line as the last array element.'
107
+ 'same line as the last array element.'
108
108
 
109
109
  def on_array(node)
110
110
  check_brace_layout(node)