rubocop 0.67.2 → 0.68.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +86 -233
  4. data/exe/rubocop +0 -12
  5. data/lib/rubocop.rb +13 -30
  6. data/lib/rubocop/ast/builder.rb +4 -0
  7. data/lib/rubocop/ast/node/alias_node.rb +24 -0
  8. data/lib/rubocop/ast/node/class_node.rb +31 -0
  9. data/lib/rubocop/ast/node/module_node.rb +24 -0
  10. data/lib/rubocop/ast/node/range_node.rb +7 -0
  11. data/lib/rubocop/ast/node/resbody_node.rb +12 -0
  12. data/lib/rubocop/ast/node/self_class_node.rb +24 -0
  13. data/lib/rubocop/cli.rb +40 -4
  14. data/lib/rubocop/config.rb +9 -7
  15. data/lib/rubocop/config_loader.rb +48 -7
  16. data/lib/rubocop/config_loader_resolver.rb +5 -4
  17. data/lib/rubocop/cop/commissioner.rb +24 -0
  18. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +18 -6
  19. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +12 -14
  20. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +9 -20
  21. data/lib/rubocop/cop/layout/align_arguments.rb +93 -0
  22. data/lib/rubocop/cop/layout/align_parameters.rb +57 -33
  23. data/lib/rubocop/cop/layout/class_structure.rb +5 -5
  24. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +6 -8
  25. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +3 -6
  26. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -2
  27. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -0
  28. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +292 -0
  29. data/lib/rubocop/cop/layout/{first_parameter_indentation.rb → indent_first_argument.rb} +11 -12
  30. data/lib/rubocop/cop/layout/{indent_array.rb → indent_first_array_element.rb} +2 -2
  31. data/lib/rubocop/cop/layout/{indent_hash.rb → indent_first_hash_element.rb} +2 -2
  32. data/lib/rubocop/cop/layout/indent_first_parameter.rb +96 -0
  33. data/lib/rubocop/cop/layout/indentation_width.rb +4 -16
  34. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -4
  35. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -16
  36. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -2
  37. data/lib/rubocop/cop/lint/duplicate_methods.rb +6 -8
  38. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +4 -8
  39. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +157 -0
  40. data/lib/rubocop/cop/lint/inherit_exception.rb +3 -4
  41. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +18 -1
  42. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -5
  43. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +25 -5
  44. data/lib/rubocop/cop/lint/useless_assignment.rb +2 -6
  45. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -2
  46. data/lib/rubocop/cop/message_annotator.rb +1 -0
  47. data/lib/rubocop/cop/metrics/line_length.rb +139 -28
  48. data/lib/rubocop/cop/metrics/perceived_complexity.rb +3 -4
  49. data/lib/rubocop/cop/mixin/check_line_breakable.rb +190 -0
  50. data/lib/rubocop/cop/mixin/{array_hash_indentation.rb → multiline_element_indentation.rb} +3 -2
  51. data/lib/rubocop/cop/mixin/too_many_lines.rb +3 -7
  52. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +33 -4
  53. data/lib/rubocop/cop/rails/active_record_override.rb +23 -8
  54. data/lib/rubocop/cop/rails/delegate.rb +5 -8
  55. data/lib/rubocop/cop/rails/environment_comparison.rb +5 -3
  56. data/lib/rubocop/cop/rails/find_each.rb +1 -1
  57. data/lib/rubocop/cop/rails/redundant_allow_nil.rb +3 -3
  58. data/lib/rubocop/cop/rails/reflection_class_name.rb +1 -1
  59. data/lib/rubocop/cop/rails/skips_model_validations.rb +6 -7
  60. data/lib/rubocop/cop/rails/time_zone.rb +3 -10
  61. data/lib/rubocop/cop/rails/validation.rb +3 -0
  62. data/lib/rubocop/cop/registry.rb +3 -3
  63. data/lib/rubocop/cop/style/alias.rb +13 -7
  64. data/lib/rubocop/cop/style/block_delimiters.rb +20 -0
  65. data/lib/rubocop/cop/style/class_and_module_children.rb +19 -21
  66. data/lib/rubocop/cop/style/class_methods.rb +16 -24
  67. data/lib/rubocop/cop/style/conditional_assignment.rb +20 -49
  68. data/lib/rubocop/cop/style/documentation.rb +3 -7
  69. data/lib/rubocop/cop/style/format_string.rb +18 -21
  70. data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
  71. data/lib/rubocop/cop/style/inverse_methods.rb +4 -0
  72. data/lib/rubocop/cop/style/lambda.rb +12 -8
  73. data/lib/rubocop/cop/style/mixin_grouping.rb +8 -10
  74. data/lib/rubocop/cop/style/module_function.rb +2 -3
  75. data/lib/rubocop/cop/style/next.rb +10 -14
  76. data/lib/rubocop/cop/style/one_line_conditional.rb +5 -3
  77. data/lib/rubocop/cop/style/optional_arguments.rb +1 -4
  78. data/lib/rubocop/cop/style/random_with_offset.rb +44 -47
  79. data/lib/rubocop/cop/style/redundant_return.rb +6 -14
  80. data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
  81. data/lib/rubocop/cop/style/safe_navigation.rb +3 -0
  82. data/lib/rubocop/cop/style/struct_inheritance.rb +2 -3
  83. data/lib/rubocop/cop/style/symbol_proc.rb +20 -40
  84. data/lib/rubocop/cop/style/unless_else.rb +1 -2
  85. data/lib/rubocop/cop/style/yoda_condition.rb +8 -7
  86. data/lib/rubocop/cop/util.rb +2 -4
  87. data/lib/rubocop/file_finder.rb +5 -10
  88. data/lib/rubocop/formatter/disabled_config_formatter.rb +5 -0
  89. data/lib/rubocop/node_pattern.rb +304 -170
  90. data/lib/rubocop/options.rb +4 -1
  91. data/lib/rubocop/rspec/shared_contexts.rb +3 -0
  92. data/lib/rubocop/version.rb +1 -1
  93. data/lib/rubocop/yaml_duplication_checker.rb +1 -1
  94. metadata +26 -50
  95. data/lib/rubocop/cop/performance/caller.rb +0 -69
  96. data/lib/rubocop/cop/performance/case_when_splat.rb +0 -177
  97. data/lib/rubocop/cop/performance/casecmp.rb +0 -108
  98. data/lib/rubocop/cop/performance/chain_array_allocation.rb +0 -78
  99. data/lib/rubocop/cop/performance/compare_with_block.rb +0 -122
  100. data/lib/rubocop/cop/performance/count.rb +0 -102
  101. data/lib/rubocop/cop/performance/detect.rb +0 -110
  102. data/lib/rubocop/cop/performance/double_start_end_with.rb +0 -94
  103. data/lib/rubocop/cop/performance/end_with.rb +0 -56
  104. data/lib/rubocop/cop/performance/fixed_size.rb +0 -97
  105. data/lib/rubocop/cop/performance/flat_map.rb +0 -78
  106. data/lib/rubocop/cop/performance/inefficient_hash_search.rb +0 -99
  107. data/lib/rubocop/cop/performance/open_struct.rb +0 -46
  108. data/lib/rubocop/cop/performance/range_include.rb +0 -50
  109. data/lib/rubocop/cop/performance/redundant_block_call.rb +0 -93
  110. data/lib/rubocop/cop/performance/redundant_match.rb +0 -56
  111. data/lib/rubocop/cop/performance/redundant_merge.rb +0 -183
  112. data/lib/rubocop/cop/performance/regexp_match.rb +0 -265
  113. data/lib/rubocop/cop/performance/reverse_each.rb +0 -42
  114. data/lib/rubocop/cop/performance/size.rb +0 -77
  115. data/lib/rubocop/cop/performance/start_with.rb +0 -59
  116. data/lib/rubocop/cop/performance/string_replacement.rb +0 -173
  117. data/lib/rubocop/cop/performance/times_map.rb +0 -71
  118. data/lib/rubocop/cop/performance/unfreeze_string.rb +0 -50
  119. data/lib/rubocop/cop/performance/uri_default_parser.rb +0 -47
@@ -36,10 +36,8 @@ module RuboCop
36
36
  end
37
37
 
38
38
  def on_class(node)
39
- _name, superclass, _body = *node
40
-
41
- @class_or_module_def_first_line = if superclass
42
- superclass.first_line
39
+ @class_or_module_def_first_line = if node.parent_class
40
+ node.parent_class.first_line
43
41
  else
44
42
  node.source_range.first_line
45
43
  end
@@ -52,10 +50,10 @@ module RuboCop
52
50
  end
53
51
 
54
52
  def on_sclass(node)
55
- self_node, _body = *node
56
-
57
- @class_or_module_def_first_line = self_node.source_range.first_line
58
- @class_or_module_def_last_line = self_node.source_range.last_line
53
+ @class_or_module_def_first_line =
54
+ node.identifier.source_range.first_line
55
+ @class_or_module_def_last_line =
56
+ node.source_range.last_line
59
57
  end
60
58
 
61
59
  def on_block(node)
@@ -70,16 +70,13 @@ module RuboCop
70
70
  KIND = 'class'.freeze
71
71
 
72
72
  def on_class(node)
73
- _name, superclass, body = *node
73
+ first_line = node.parent_class.first_line if node.parent_class
74
74
 
75
- adjusted_first_line = superclass.first_line if superclass
76
-
77
- check(node, body, adjusted_first_line: adjusted_first_line)
75
+ check(node, node.body, adjusted_first_line: first_line)
78
76
  end
79
77
 
80
78
  def on_sclass(node)
81
- _obj, body = *node
82
- check(node, body)
79
+ check(node, node.body)
83
80
  end
84
81
 
85
82
  def autocorrect(node)
@@ -50,8 +50,7 @@ module RuboCop
50
50
  KIND = 'module'.freeze
51
51
 
52
52
  def on_module(node)
53
- _name, body = *node
54
- check(node, body)
53
+ check(node, node.body)
55
54
  end
56
55
 
57
56
  def autocorrect(node)
@@ -44,6 +44,7 @@ module RuboCop
44
44
  check_method_line_break(node, args)
45
45
  end
46
46
  alias on_csend on_send
47
+ alias on_super on_send
47
48
 
48
49
  def autocorrect(node)
49
50
  EmptyLineCorrector.insert_before(node)
@@ -0,0 +1,292 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Layout
6
+ # This cop checks for the placement of the closing parenthesis
7
+ # in a method call that passes a HEREDOC string as an argument.
8
+ # It should be placed at the end of the line containing the
9
+ # opening HEREDOC tag.
10
+ #
11
+ # @example
12
+ # # bad
13
+ #
14
+ # foo(<<-SQL
15
+ # bar
16
+ # SQL
17
+ # )
18
+ #
19
+ # foo(<<-SQL, 123, <<-NOSQL,
20
+ # bar
21
+ # SQL
22
+ # baz
23
+ # NOSQL
24
+ # )
25
+ #
26
+ # foo(
27
+ # bar(<<-SQL
28
+ # baz
29
+ # SQL
30
+ # ),
31
+ # 123,
32
+ # )
33
+ #
34
+ # # good
35
+ #
36
+ # foo(<<-SQL)
37
+ # bar
38
+ # SQL
39
+ #
40
+ # foo(<<-SQL, 123, <<-NOSQL)
41
+ # bar
42
+ # SQL
43
+ # baz
44
+ # NOSQL
45
+ #
46
+ # foo(
47
+ # bar(<<-SQL),
48
+ # baz
49
+ # SQL
50
+ # 123,
51
+ # )
52
+ #
53
+ class HeredocArgumentClosingParenthesis < Cop
54
+ include RangeHelp
55
+
56
+ MSG = 'Put the closing parenthesis for a method call with a ' \
57
+ 'HEREDOC parameter on the same line as the HEREDOC opening.'.freeze
58
+
59
+ STRING_TYPES = %i[str dstr xstr].freeze
60
+ def on_send(node)
61
+ heredoc_arg = extract_heredoc_argument(node)
62
+ return unless heredoc_arg
63
+
64
+ outermost_send = outermost_send_on_same_line(heredoc_arg)
65
+ return unless outermost_send
66
+ return unless outermost_send.loc.end
67
+ return unless heredoc_arg.first_line != outermost_send.loc.end.line
68
+
69
+ add_offense(outermost_send, location: :end)
70
+ end
71
+
72
+ # Autocorrection note:
73
+ #
74
+ # Commas are a bit tricky to handle when the method call is
75
+ # embedded in another expression. Here's an example:
76
+ #
77
+ # [
78
+ # first_array_value,
79
+ # foo(<<-SQL, 123, 456,
80
+ # SELECT * FROM db
81
+ # SQL
82
+ # ),
83
+ # third_array_value,
84
+ # ]
85
+ #
86
+ # The "internal" trailing comma is after `456`.
87
+ # The "external" trailing comma is after `)`.
88
+ #
89
+ # To autocorrect, we remove the latter, and move the former up:
90
+ #
91
+ # [
92
+ # first_array_value,
93
+ # foo(<<-SQL, 123, 456),
94
+ # SELECT * FROM db
95
+ # SQL
96
+ # third_array_value,
97
+ # ]
98
+ def autocorrect(node)
99
+ lambda do |corrector|
100
+ fix_closing_parenthesis(node, corrector)
101
+
102
+ if internal_trailing_comma?(node)
103
+ remove_internal_trailing_comma(node, corrector)
104
+ end
105
+
106
+ if external_trailing_comma?(node)
107
+ fix_external_trailing_comma(node, corrector)
108
+ end
109
+ end
110
+ end
111
+
112
+ private
113
+
114
+ def outermost_send_on_same_line(heredoc)
115
+ previous = heredoc
116
+ current = previous.parent
117
+ until send_missing_closing_parens?(current, previous, heredoc)
118
+ previous = current
119
+ current = current.parent
120
+ return unless previous && current
121
+ end
122
+ current
123
+ end
124
+
125
+ def send_missing_closing_parens?(parent, child, heredoc)
126
+ send_node?(parent) &&
127
+ parent.arguments.include?(child) &&
128
+ parent.loc.begin &&
129
+ parent.loc.end.line != heredoc.last_line
130
+ end
131
+
132
+ def send_node?(node)
133
+ return nil unless node
134
+
135
+ node.send_type? || node.csend_type?
136
+ end
137
+
138
+ def extract_heredoc_argument(node)
139
+ node.arguments.find do |arg_node|
140
+ extract_heredoc(arg_node)
141
+ end
142
+ end
143
+
144
+ def extract_heredoc(node)
145
+ return node if heredoc_node?(node)
146
+ return node.receiver if single_line_send_with_heredoc_receiver?(node)
147
+
148
+ return unless node.hash_type?
149
+
150
+ node.values.find do |v|
151
+ heredoc = extract_heredoc(v)
152
+ return heredoc if heredoc
153
+ end
154
+ end
155
+
156
+ def heredoc_node?(node)
157
+ node && STRING_TYPES.include?(node.type) && node.heredoc?
158
+ end
159
+
160
+ def single_line_send_with_heredoc_receiver?(node)
161
+ return false unless node.send_type?
162
+ return false unless heredoc_node?(node.receiver)
163
+
164
+ node.receiver.location.heredoc_end.end_pos > node.source_range.end_pos
165
+ end
166
+
167
+ # Closing parenthesis helpers.
168
+
169
+ def fix_closing_parenthesis(node, corrector)
170
+ remove_incorrect_closing_paren(node, corrector)
171
+ add_correct_closing_paren(node, corrector)
172
+ end
173
+
174
+ def add_correct_closing_paren(node, corrector)
175
+ corrector.insert_after(node.arguments.last.source_range, ')')
176
+ end
177
+
178
+ def remove_incorrect_closing_paren(node, corrector)
179
+ corrector.remove(
180
+ range_between(
181
+ incorrect_parenthesis_removal_begin(node),
182
+ incorrect_parenthesis_removal_end(node)
183
+ )
184
+ )
185
+ end
186
+
187
+ def incorrect_parenthesis_removal_begin(node)
188
+ end_pos = node.source_range.end_pos
189
+ if safe_to_remove_line_containing_closing_paren?(node)
190
+ last_line_length = node.source.scan(/\n(.*)$/).last[0].size
191
+ end_pos - last_line_length - 1 # Add one for the line break itself.
192
+ else
193
+ end_pos - 1 # Just the `)` at the end of the string
194
+ end
195
+ end
196
+
197
+ def safe_to_remove_line_containing_closing_paren?(node)
198
+ last_line = processed_source[node.loc.end.line - 1]
199
+ # Safe to remove if last line only contains `)`, `,`, and whitespace.
200
+ last_line.match(/^[ ]*\)[ ]{0,20},{0,1}[ ]*$/)
201
+ end
202
+
203
+ def incorrect_parenthesis_removal_end(node)
204
+ end_pos = node.source_range.end_pos
205
+ if processed_source.buffer.source[end_pos] == ','
206
+ end_pos + 1
207
+ else
208
+ end_pos
209
+ end
210
+ end
211
+
212
+ # Internal trailing comma helpers.
213
+
214
+ def remove_internal_trailing_comma(node, corrector)
215
+ offset = internal_trailing_comma_offset_from_last_arg(node)
216
+ last_arg_end_pos = node.children.last.source_range.end_pos
217
+ corrector.remove(
218
+ range_between(
219
+ last_arg_end_pos,
220
+ last_arg_end_pos + offset
221
+ )
222
+ )
223
+ end
224
+
225
+ def internal_trailing_comma?(node)
226
+ !internal_trailing_comma_offset_from_last_arg(node).nil?
227
+ end
228
+
229
+ # Returns nil if no trailing internal comma.
230
+ def internal_trailing_comma_offset_from_last_arg(node)
231
+ source_after_last_arg = range_between(
232
+ node.children.last.source_range.end_pos,
233
+ node.loc.end.begin_pos
234
+ ).source
235
+
236
+ first_comma_offset = source_after_last_arg.index(',')
237
+ first_new_line_offset = source_after_last_arg.index("\n")
238
+ return if first_comma_offset.nil?
239
+ return if first_new_line_offset.nil?
240
+ return if first_comma_offset > first_new_line_offset
241
+
242
+ first_comma_offset + 1
243
+ end
244
+
245
+ # External trailing comma helpers.
246
+
247
+ def fix_external_trailing_comma(node, corrector)
248
+ remove_incorrect_external_trailing_comma(node, corrector)
249
+ add_correct_external_trailing_comma(node, corrector)
250
+ end
251
+
252
+ def add_correct_external_trailing_comma(node, corrector)
253
+ return unless external_trailing_comma?(node)
254
+
255
+ corrector.insert_after(node.arguments.last.source_range, ',')
256
+ end
257
+
258
+ def remove_incorrect_external_trailing_comma(node, corrector)
259
+ end_pos = node.source_range.end_pos
260
+ return unless external_trailing_comma?(node)
261
+
262
+ corrector.remove(
263
+ range_between(
264
+ end_pos,
265
+ end_pos + external_trailing_comma_offset_from_loc_end(node)
266
+ )
267
+ )
268
+ end
269
+
270
+ def external_trailing_comma?(node)
271
+ !external_trailing_comma_offset_from_loc_end(node).nil?
272
+ end
273
+
274
+ # Returns nil if no trailing external comma.
275
+ def external_trailing_comma_offset_from_loc_end(node)
276
+ end_pos = node.source_range.end_pos
277
+ offset = 0
278
+ limit = 20
279
+ offset += 1 while offset < limit && space?(end_pos + offset)
280
+ char = processed_source.buffer.source[end_pos + offset]
281
+ return unless char == ','
282
+
283
+ offset + 1 # Add one to include the comma.
284
+ end
285
+
286
+ def space?(pos)
287
+ processed_source.buffer.source[pos] == ' '
288
+ end
289
+ end
290
+ end
291
+ end
292
+ end
@@ -4,9 +4,8 @@ module RuboCop
4
4
  module Cop
5
5
  # rubocop:disable Metrics/LineLength
6
6
  module Layout
7
- # This cop checks the indentation of the first parameter in a method call.
8
- # Parameters after the first one are checked by Layout/AlignParameters,
9
- # not by this cop.
7
+ # This cop checks the indentation of the first argument in a method call
8
+ # or definition.
10
9
  #
11
10
  # @example
12
11
  #
@@ -33,7 +32,7 @@ module RuboCop
33
32
  # second_param
34
33
  #
35
34
  # @example EnforcedStyle: consistent
36
- # # The first parameter should always be indented one step more than the
35
+ # # The first argument should always be indented one step more than the
37
36
  # # preceding line.
38
37
  #
39
38
  # # good
@@ -59,8 +58,8 @@ module RuboCop
59
58
  # second_param
60
59
  #
61
60
  # @example EnforcedStyle: consistent_relative_to_receiver
62
- # # The first parameter should always be indented one level relative to
63
- # # the parent that is receiving the parameter
61
+ # # The first argument should always be indented one level relative to
62
+ # # the parent that is receiving the argument
64
63
  #
65
64
  # # good
66
65
  # some_method(
@@ -85,9 +84,9 @@ module RuboCop
85
84
  # second_params
86
85
  #
87
86
  # @example EnforcedStyle: special_for_inner_method_call
88
- # # The first parameter should normally be indented one step more than
89
- # # the preceding line, but if it's a parameter for a method call that
90
- # # is itself a parameter in a method call, then the inner parameter
87
+ # # The first argument should normally be indented one step more than
88
+ # # the preceding line, but if it's a argument for a method call that
89
+ # # is itself a argument in a method call, then the inner argument
91
90
  # # should be indented relative to the inner method.
92
91
  #
93
92
  # # good
@@ -139,13 +138,13 @@ module RuboCop
139
138
  # nested_first_param),
140
139
  # second_param
141
140
  #
142
- class FirstParameterIndentation < Cop
141
+ class IndentFirstArgument < Cop
143
142
  # rubocop:enable Metrics/LineLength
144
143
  include Alignment
145
144
  include ConfigurableEnforcedStyle
146
145
  include RangeHelp
147
146
 
148
- MSG = 'Indent the first parameter one step more than %<base>s.'.freeze
147
+ MSG = 'Indent the first argument one step more than %<base>s.'.freeze
149
148
 
150
149
  def on_send(node)
151
150
  return if !node.arguments? || node.operator_method?
@@ -163,7 +162,7 @@ module RuboCop
163
162
  private
164
163
 
165
164
  def message(arg_node)
166
- return 'Bad indentation of the first parameter.' unless arg_node
165
+ return 'Bad indentation of the first argument.' unless arg_node
167
166
 
168
167
  send_node = arg_node.parent
169
168
  text = base_range(send_node, arg_node).source.strip
@@ -79,10 +79,10 @@ module RuboCop
79
79
  # and_now_for_something = [
80
80
  # :completely_different
81
81
  # ]
82
- class IndentArray < Cop
82
+ class IndentFirstArrayElement < Cop
83
83
  include Alignment
84
84
  include ConfigurableEnforcedStyle
85
- include ArrayHashIndentation
85
+ include MultilineElementIndentation
86
86
 
87
87
  MSG = 'Use %<configured_indentation_width>d spaces for indentation ' \
88
88
  'in an array, relative to %<base_description>s.'.freeze
@@ -77,10 +77,10 @@ module RuboCop
77
77
  # and_now_for_something = {
78
78
  # completely: :different
79
79
  # }
80
- class IndentHash < Cop
80
+ class IndentFirstHashElement < Cop
81
81
  include Alignment
82
82
  include ConfigurableEnforcedStyle
83
- include ArrayHashIndentation
83
+ include MultilineElementIndentation
84
84
 
85
85
  MSG = 'Use %<configured_indentation_width>d spaces for indentation ' \
86
86
  'in a hash, relative to %<base_description>s.'.freeze