rubocop 1.75.6 → 1.76.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -13
  3. data/config/default.yml +48 -5
  4. data/config/obsoletion.yml +6 -3
  5. data/lib/rubocop/cop/autocorrect_logic.rb +18 -10
  6. data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
  7. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +50 -6
  8. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  9. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +1 -0
  10. data/lib/rubocop/cop/layout/class_structure.rb +35 -0
  11. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +6 -2
  12. data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -1
  13. data/lib/rubocop/cop/layout/space_before_brackets.rb +6 -32
  14. data/lib/rubocop/cop/lint/duplicate_methods.rb +41 -1
  15. data/lib/rubocop/cop/lint/empty_interpolation.rb +3 -1
  16. data/lib/rubocop/cop/lint/float_comparison.rb +27 -0
  17. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  18. data/lib/rubocop/cop/lint/literal_as_condition.rb +16 -24
  19. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +5 -0
  20. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +87 -0
  21. data/lib/rubocop/cop/lint/useless_or.rb +98 -0
  22. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  23. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  24. data/lib/rubocop/cop/naming/predicate_method.rb +216 -0
  25. data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +2 -2
  26. data/lib/rubocop/cop/style/access_modifier_declarations.rb +32 -10
  27. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  28. data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -5
  29. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
  30. data/lib/rubocop/cop/style/if_unless_modifier.rb +2 -4
  31. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
  32. data/lib/rubocop/cop/style/it_block_parameter.rb +33 -14
  33. data/lib/rubocop/cop/style/map_to_hash.rb +11 -0
  34. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +1 -1
  35. data/lib/rubocop/cop/style/redundant_array_flatten.rb +48 -0
  36. data/lib/rubocop/cop/style/redundant_format.rb +6 -1
  37. data/lib/rubocop/cop/style/redundant_parentheses.rb +16 -5
  38. data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
  39. data/lib/rubocop/cop/style/safe_navigation.rb +10 -7
  40. data/lib/rubocop/cop/team.rb +1 -1
  41. data/lib/rubocop/cop/variable_force/assignment.rb +7 -3
  42. data/lib/rubocop/version.rb +1 -1
  43. data/lib/rubocop.rb +6 -1
  44. metadata +12 -7
@@ -25,8 +25,9 @@ module RuboCop
25
25
  # # good
26
26
  # def foo = do_something
27
27
  #
28
- # # good (without parentheses it's a syntax error)
28
+ # # good - without parentheses it's a syntax error
29
29
  # def foo() do_something end
30
+ # def foo()=do_something
30
31
  #
31
32
  # # bad
32
33
  # def Baz.foo()
@@ -38,19 +39,31 @@ module RuboCop
38
39
  # do_something
39
40
  # end
40
41
  class DefWithParentheses < Base
42
+ include RangeHelp
41
43
  extend AutoCorrector
42
44
 
43
45
  MSG = "Omit the parentheses in defs when the method doesn't accept any arguments."
44
46
 
45
47
  def on_def(node)
46
- return if node.single_line? && !node.endless?
47
- return unless !node.arguments? && (node_arguments = node.arguments.source_range)
48
+ return unless !node.arguments? && (arguments_range = node.arguments.source_range)
49
+ return if parentheses_required?(node, arguments_range)
48
50
 
49
- add_offense(node_arguments) do |corrector|
50
- corrector.remove(node_arguments)
51
+ add_offense(arguments_range) do |corrector|
52
+ corrector.remove(arguments_range)
51
53
  end
52
54
  end
53
55
  alias on_defs on_def
56
+
57
+ private
58
+
59
+ def parentheses_required?(node, arguments_range)
60
+ return true if node.single_line? && !node.endless?
61
+
62
+ end_pos = arguments_range.end.end_pos
63
+ token_after_argument = range_between(end_pos, end_pos + 1).source
64
+
65
+ token_after_argument == '='
66
+ end
54
67
  end
55
68
  end
56
69
  end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ # Checks for empty strings being assigned inside string interpolation.
7
+ #
8
+ # Empty strings are a meaningless outcome inside of string interpolation, so we remove them.
9
+ # Alternatively, when configured to do so, we prioritise using empty strings.
10
+ #
11
+ # While this cop would also apply to variables that are only going to be used as strings,
12
+ # RuboCop can't detect that, so we only check inside of string interpolation.
13
+ #
14
+ # @example EnforcedStyle: trailing_conditional (default)
15
+ # # bad
16
+ # "#{condition ? 'foo' : ''}"
17
+ #
18
+ # # good
19
+ # "#{'foo' if condition}"
20
+ #
21
+ # # bad
22
+ # "#{condition ? '' : 'foo'}"
23
+ #
24
+ # # good
25
+ # "#{'foo' unless condition}"
26
+ #
27
+ # @example EnforcedStyle: ternary
28
+ # # bad
29
+ # "#{'foo' if condition}"
30
+ #
31
+ # # good
32
+ # "#{condition ? 'foo' : ''}"
33
+ #
34
+ # # bad
35
+ # "#{'foo' unless condition}"
36
+ #
37
+ # # good
38
+ # "#{condition ? '' : 'foo'}"
39
+ #
40
+ class EmptyStringInsideInterpolation < Base
41
+ include ConfigurableEnforcedStyle
42
+ include Interpolation
43
+ extend AutoCorrector
44
+
45
+ MSG_TRAILING_CONDITIONAL = 'Do not use trailing conditionals in string interpolation.'
46
+ MSG_TERNARY = 'Do not return empty strings in string interpolation.'
47
+
48
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
49
+ def on_interpolation(node)
50
+ node.each_child_node(:if) do |child_node|
51
+ if style == :trailing_conditional
52
+ if empty_if_outcome?(child_node)
53
+ ternary_style_autocorrect(child_node, child_node.else_branch.source, 'unless')
54
+ end
55
+
56
+ if empty_else_outcome?(child_node)
57
+ ternary_style_autocorrect(child_node, child_node.if_branch.source, 'if')
58
+ end
59
+ elsif style == :ternary
60
+ next unless child_node.modifier_form?
61
+
62
+ ternary_component = if child_node.unless?
63
+ "'' : #{child_node.if_branch.source}"
64
+ else
65
+ "#{child_node.if_branch.source} : ''"
66
+ end
67
+
68
+ add_offense(node, message: MSG_TRAILING_CONDITIONAL) do |corrector|
69
+ corrector.replace(node, "\#{#{child_node.condition.source} ? #{ternary_component}}")
70
+ end
71
+ end
72
+ end
73
+ end
74
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
75
+
76
+ private
77
+
78
+ def empty_if_outcome?(node)
79
+ empty_branch_outcome?(node.if_branch)
80
+ end
81
+
82
+ def empty_else_outcome?(node)
83
+ empty_branch_outcome?(node.else_branch)
84
+ end
85
+
86
+ def empty_branch_outcome?(branch)
87
+ return false unless branch
88
+
89
+ branch.nil_type? || (branch.str_type? && branch.value.empty?)
90
+ end
91
+
92
+ def ternary_style_autocorrect(node, outcome, condition)
93
+ add_offense(node, message: MSG_TERNARY) do |corrector|
94
+ corrector.replace(node, "#{outcome} #{condition} #{node.condition.source}")
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -132,12 +132,10 @@ module RuboCop
132
132
  end
133
133
 
134
134
  def pattern_matching_nodes(condition)
135
- if condition.type?(:match_pattern, :match_pattern_p)
135
+ if condition.any_match_pattern_type?
136
136
  [condition]
137
137
  else
138
- condition.each_descendant.select do |node|
139
- node.type?(:match_pattern, :match_pattern_p)
140
- end
138
+ condition.each_descendant.select(&:any_match_pattern_type?)
141
139
  end
142
140
  end
143
141
 
@@ -28,19 +28,16 @@ module RuboCop
28
28
 
29
29
  MSG = 'Avoid modifier `%<keyword>s` after another conditional.'
30
30
 
31
+ # rubocop:disable Metrics/AbcSize
31
32
  def on_if(node)
32
33
  return unless node.modifier_form? && node.body.if_type?
33
34
 
34
35
  add_offense(node.loc.keyword, message: format(MSG, keyword: node.keyword)) do |corrector|
35
- keyword = node.if? ? 'if' : 'unless'
36
-
37
- corrector.replace(node, <<~RUBY.chop)
38
- #{keyword} #{node.condition.source}
39
- #{node.if_branch.source}
40
- end
41
- RUBY
36
+ corrector.wrap(node.if_branch, "#{node.keyword} #{node.condition.source}\n", "\nend")
37
+ corrector.remove(node.if_branch.source_range.end.join(node.condition.source_range.end))
42
38
  end
43
39
  end
40
+ # rubocop:enable Metrics/AbcSize
44
41
  end
45
42
  end
46
43
  end
@@ -5,15 +5,28 @@ module RuboCop
5
5
  module Style
6
6
  # Checks for blocks with one argument where `it` block parameter can be used.
7
7
  #
8
- # It provides three `EnforcedStyle` options:
8
+ # It provides four `EnforcedStyle` options:
9
9
  #
10
- # 1. `only_numbered_parameters` (default) ... Detects only numbered block parameters.
11
- # 2. `always` ... Always uses the `it` block parameter.
12
- # 3. `disallow` ... Disallows the `it` block parameter.
10
+ # 1. `allow_single_line` (default) ... Always uses the `it` block parameter in a single line.
11
+ # 2. `only_numbered_parameters` ... Detects only numbered block parameters.
12
+ # 3. `always` ... Always uses the `it` block parameter.
13
+ # 4. `disallow` ... Disallows the `it` block parameter.
13
14
  #
14
- # A single numbered parameter is detected when `only_numbered_parameters` or `always`.
15
+ # A single numbered parameter is detected when `allow_single_line`,
16
+ # `only_numbered_parameters`, or `always`.
15
17
  #
16
- # @example EnforcedStyle: only_numbered_parameters (default)
18
+ # @example EnforcedStyle: allow_single_line (default)
19
+ # # bad
20
+ # block do
21
+ # do_something(it)
22
+ # end
23
+ # block { do_something(_1) }
24
+ #
25
+ # # good
26
+ # block { do_something(it) }
27
+ # block { |named_param| do_something(named_param) }
28
+ #
29
+ # @example EnforcedStyle: only_numbered_parameters
17
30
  # # bad
18
31
  # block { do_something(_1) }
19
32
  #
@@ -42,8 +55,9 @@ module RuboCop
42
55
  extend TargetRubyVersion
43
56
  extend AutoCorrector
44
57
 
45
- MSG_USE_IT_BLOCK_PARAMETER = 'Use `it` block parameter.'
46
- MSG_AVOID_IT_BLOCK_PARAMETER = 'Avoid using `it` block parameter.'
58
+ MSG_USE_IT_PARAMETER = 'Use `it` block parameter.'
59
+ MSG_AVOID_IT_PARAMETER = 'Avoid using `it` block parameter.'
60
+ MSG_AVOID_IT_PARAMETER_MULTI_LINE = 'Avoid using numbered parameters for multi-line blocks.'
47
61
 
48
62
  minimum_target_ruby_version 3.4
49
63
 
@@ -57,7 +71,7 @@ module RuboCop
57
71
  variables = find_block_variables(node, node.first_argument.source)
58
72
 
59
73
  variables.each do |variable|
60
- add_offense(variable, message: MSG_USE_IT_BLOCK_PARAMETER) do |corrector|
74
+ add_offense(variable, message: MSG_USE_IT_PARAMETER) do |corrector|
61
75
  corrector.remove(node.arguments)
62
76
  corrector.replace(variable, 'it')
63
77
  end
@@ -71,19 +85,24 @@ module RuboCop
71
85
  variables = find_block_variables(node, '_1')
72
86
 
73
87
  variables.each do |variable|
74
- add_offense(variable, message: MSG_USE_IT_BLOCK_PARAMETER) do |corrector|
88
+ add_offense(variable, message: MSG_USE_IT_PARAMETER) do |corrector|
75
89
  corrector.replace(variable, 'it')
76
90
  end
77
91
  end
78
92
  end
79
93
 
80
94
  def on_itblock(node)
81
- return unless style == :disallow
95
+ case style
96
+ when :allow_single_line
97
+ return if node.single_line?
82
98
 
83
- variables = find_block_variables(node, 'it')
99
+ add_offense(node, message: MSG_AVOID_IT_PARAMETER_MULTI_LINE)
100
+ when :disallow
101
+ variables = find_block_variables(node, 'it')
84
102
 
85
- variables.each do |variable|
86
- add_offense(variable, message: MSG_AVOID_IT_BLOCK_PARAMETER)
103
+ variables.each do |variable|
104
+ add_offense(variable, message: MSG_AVOID_IT_PARAMETER)
105
+ end
87
106
  end
88
107
  end
89
108
 
@@ -45,6 +45,11 @@ module RuboCop
45
45
  }
46
46
  PATTERN
47
47
 
48
+ # @!method destructuring_argument(node)
49
+ def_node_matcher :destructuring_argument, <<~PATTERN
50
+ (args $(mlhs (arg _)+))
51
+ PATTERN
52
+
48
53
  def self.autocorrect_incompatible_with
49
54
  [Layout::SingleLineBlockChain]
50
55
  end
@@ -73,6 +78,12 @@ module RuboCop
73
78
  corrector.replace(map_dot, to_h.loc.dot.source)
74
79
  end
75
80
  corrector.replace(map.loc.selector, 'to_h')
81
+
82
+ return unless map.parent.block_type?
83
+
84
+ if (argument = destructuring_argument(map.parent.arguments))
85
+ corrector.replace(argument, argument.source[1..-2])
86
+ end
76
87
  end
77
88
  # rubocop:enable Metrics/AbcSize
78
89
  end
@@ -167,7 +167,7 @@ module RuboCop
167
167
  def call_in_match_pattern?(node)
168
168
  return false unless (parent = node.parent)
169
169
 
170
- parent.type?(:match_pattern, :match_pattern_p)
170
+ parent.any_match_pattern_type?
171
171
  end
172
172
 
173
173
  def hash_literal_in_arguments?(node)
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ # Checks for redundant calls of `Array#flatten`.
7
+ #
8
+ # `Array#join` joins nested arrays recursively, so flattening an array
9
+ # beforehand is redundant.
10
+ #
11
+ # @safety
12
+ # Cop is unsafe because the receiver of `flatten` method might not
13
+ # be an `Array`, so it's possible it won't respond to `join` method,
14
+ # or the end result would be different.
15
+ #
16
+ # @example
17
+ # # bad
18
+ # x.flatten.join
19
+ # x.flatten(1).join
20
+ #
21
+ # # good
22
+ # x.join
23
+ #
24
+ class RedundantArrayFlatten < Base
25
+ extend AutoCorrector
26
+
27
+ MSG = 'Remove the redundant `flatten`.'
28
+
29
+ RESTRICT_ON_SEND = %i[flatten].freeze
30
+
31
+ # @!method flatten_join?(node)
32
+ def_node_matcher :flatten_join?, <<~PATTERN
33
+ (call (call !nil? :flatten _?) :join _?)
34
+ PATTERN
35
+
36
+ def on_send(node)
37
+ return unless flatten_join?(node.parent)
38
+
39
+ range = node.loc.dot.begin.join(node.source_range.end)
40
+ add_offense(range) do |corrector|
41
+ corrector.remove(range)
42
+ end
43
+ end
44
+ alias on_csend on_send
45
+ end
46
+ end
47
+ end
48
+ end
@@ -121,7 +121,12 @@ module RuboCop
121
121
  def register_all_fields_literal(node, string, arguments)
122
122
  return unless all_fields_literal?(string, arguments.dup)
123
123
 
124
- formatted_string = format(string, *argument_values(arguments))
124
+ format_arguments = argument_values(arguments)
125
+ begin
126
+ formatted_string = format(string, *format_arguments)
127
+ rescue ArgumentError
128
+ return
129
+ end
125
130
  replacement = quote(formatted_string, node)
126
131
 
127
132
  add_offense(node, message: message(node, replacement)) do |corrector|
@@ -49,6 +49,7 @@ module RuboCop
49
49
  empty_parentheses?(node) ||
50
50
  first_arg_begins_with_hash_literal?(node) ||
51
51
  rescue?(node) ||
52
+ in_pattern_matching_in_method_argument?(node) ||
52
53
  allowed_pin_operator?(node) ||
53
54
  allowed_expression?(node)
54
55
  end
@@ -122,6 +123,13 @@ module RuboCop
122
123
  hash_literal && first_argument?(node) && !parentheses?(hash_literal) && !parenthesized
123
124
  end
124
125
 
126
+ def in_pattern_matching_in_method_argument?(begin_node)
127
+ return false unless begin_node.parent&.call_type?
128
+ return false unless (node = begin_node.children.first)
129
+
130
+ target_ruby_version <= 2.7 ? node.match_pattern_type? : node.match_pattern_p_type?
131
+ end
132
+
125
133
  def method_chain_begins_with_hash_literal(node)
126
134
  return if node.nil?
127
135
  return node if node.hash_type?
@@ -134,7 +142,7 @@ module RuboCop
134
142
  node = begin_node.children.first
135
143
 
136
144
  if (message = find_offense_message(begin_node, node))
137
- if node.range_type? && !argument_of_parenthesized_method_call?(begin_node)
145
+ if node.range_type? && !argument_of_parenthesized_method_call?(begin_node, node)
138
146
  begin_node = begin_node.parent
139
147
  end
140
148
 
@@ -156,8 +164,10 @@ module RuboCop
156
164
  if node.lambda_or_proc? && (node.braces? || node.send_node.lambda_literal?)
157
165
  return 'an expression'
158
166
  end
167
+
168
+ return 'a one-line pattern matching' if node.any_match_pattern_type?
159
169
  return 'an interpolated expression' if interpolation?(begin_node)
160
- return 'a method argument' if argument_of_parenthesized_method_call?(begin_node)
170
+ return 'a method argument' if argument_of_parenthesized_method_call?(begin_node, node)
161
171
 
162
172
  return if begin_node.chained?
163
173
 
@@ -180,9 +190,10 @@ module RuboCop
180
190
  # @!method interpolation?(node)
181
191
  def_node_matcher :interpolation?, '[^begin ^^dstr]'
182
192
 
183
- def argument_of_parenthesized_method_call?(begin_node)
184
- node = begin_node.children.first
185
- return false if node.basic_conditional? || method_call_parentheses_required?(node)
193
+ def argument_of_parenthesized_method_call?(begin_node, node)
194
+ if node.basic_conditional? || node.rescue_type? || method_call_parentheses_required?(node)
195
+ return false
196
+ end
186
197
  return false unless (parent = begin_node.parent)
187
198
 
188
199
  parent.call_type? && parent.parenthesized? && parent.receiver != begin_node
@@ -155,7 +155,7 @@ module RuboCop
155
155
  end
156
156
 
157
157
  def preferred_delimiters
158
- config.for_cop('Style/PercentLiteralDelimiters') ['PreferredDelimiters']['%r'].chars
158
+ config.for_cop('Style/PercentLiteralDelimiters')['PreferredDelimiters']['%r'].chars
159
159
  end
160
160
 
161
161
  def allowed_omit_parentheses_with_percent_r_literal?(node)
@@ -235,7 +235,7 @@ module RuboCop
235
235
  return false if !matching_nodes?(lhs_receiver, rhs_receiver) || rhs_receiver.nil?
236
236
  return false if use_var_only_in_unless_modifier?(node, lhs_receiver)
237
237
  return false if chain_length(rhs, rhs_receiver) > max_chain_length
238
- return false if unsafe_method_used?(rhs, rhs_receiver.parent)
238
+ return false if unsafe_method_used?(node, rhs, rhs_receiver.parent)
239
239
  return false if rhs.send_type? && rhs.method?(:empty?)
240
240
 
241
241
  true
@@ -334,21 +334,24 @@ module RuboCop
334
334
  end
335
335
  end
336
336
 
337
- def unsafe_method_used?(method_chain, method)
338
- return true if unsafe_method?(method)
337
+ def unsafe_method_used?(node, method_chain, method)
338
+ return true if unsafe_method?(node, method)
339
339
 
340
340
  method.each_ancestor(:send).any? do |ancestor|
341
341
  break true unless config.cop_enabled?('Lint/SafeNavigationChain')
342
342
 
343
- break true if unsafe_method?(ancestor)
343
+ break true if unsafe_method?(node, ancestor)
344
344
  break true if nil_methods.include?(ancestor.method_name)
345
345
  break false if ancestor == method_chain
346
346
  end
347
347
  end
348
348
 
349
- def unsafe_method?(send_node)
350
- negated?(send_node) ||
351
- send_node.assignment? ||
349
+ def unsafe_method?(node, send_node)
350
+ return true if negated?(send_node)
351
+
352
+ return false if node.respond_to?(:ternary?) && node.ternary?
353
+
354
+ send_node.assignment? ||
352
355
  (!send_node.dot? && !send_node.safe_navigation?)
353
356
  end
354
357
 
@@ -279,7 +279,7 @@ module RuboCop
279
279
  @errors << message
280
280
  warn message
281
281
  if debug?
282
- puts error.message, error.backtrace
282
+ puts error.full_message
283
283
  else
284
284
  warn 'To see the complete backtrace run rubocop -d.'
285
285
  end
@@ -110,8 +110,13 @@ module RuboCop
110
110
  end
111
111
 
112
112
  def multiple_assignment_node
113
- return nil unless node.parent&.mlhs_type?
114
- return nil unless (grandparent_node = node.parent&.parent)
113
+ return nil unless (candidate_mlhs_node = node.parent)
114
+
115
+ # In `(foo, bar), *baz`, the splat node must be traversed as well.
116
+ candidate_mlhs_node = candidate_mlhs_node.parent if candidate_mlhs_node.splat_type?
117
+
118
+ return nil unless candidate_mlhs_node.mlhs_type?
119
+ return nil unless (grandparent_node = node.parent.parent)
115
120
  if (node = find_multiple_assignment_node(grandparent_node))
116
121
  return node
117
122
  end
@@ -139,7 +144,6 @@ module RuboCop
139
144
 
140
145
  def find_multiple_assignment_node(grandparent_node)
141
146
  return unless grandparent_node.type == MULTIPLE_LEFT_HAND_SIDE_TYPE
142
- return if grandparent_node.children.any?(&:splat_type?)
143
147
 
144
148
  parent = grandparent_node.parent
145
149
  return parent if parent.type == MULTIPLE_ASSIGNMENT_TYPE
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.75.6'
6
+ STRING = '1.76.0'
7
7
 
8
8
  MSG = '%<version>s (using %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
data/lib/rubocop.rb CHANGED
@@ -430,10 +430,12 @@ require_relative 'rubocop/cop/lint/uri_regexp'
430
430
  require_relative 'rubocop/cop/lint/useless_access_modifier'
431
431
  require_relative 'rubocop/cop/lint/useless_assignment'
432
432
  require_relative 'rubocop/cop/lint/useless_constant_scoping'
433
+ require_relative 'rubocop/cop/lint/useless_default_value_argument'
433
434
  require_relative 'rubocop/cop/lint/useless_defined'
434
435
  require_relative 'rubocop/cop/lint/useless_else_without_rescue'
435
436
  require_relative 'rubocop/cop/lint/useless_method_definition'
436
437
  require_relative 'rubocop/cop/lint/useless_numeric_operation'
438
+ require_relative 'rubocop/cop/lint/useless_or'
437
439
  require_relative 'rubocop/cop/lint/useless_rescue'
438
440
  require_relative 'rubocop/cop/lint/useless_ruby2_keywords'
439
441
  require_relative 'rubocop/cop/lint/useless_setter_call'
@@ -469,7 +471,8 @@ require_relative 'rubocop/cop/naming/memoized_instance_variable_name'
469
471
  require_relative 'rubocop/cop/naming/method_name'
470
472
  require_relative 'rubocop/cop/naming/method_parameter_name'
471
473
  require_relative 'rubocop/cop/naming/binary_operator_parameter_name'
472
- require_relative 'rubocop/cop/naming/predicate_name'
474
+ require_relative 'rubocop/cop/naming/predicate_method'
475
+ require_relative 'rubocop/cop/naming/predicate_prefix'
473
476
  require_relative 'rubocop/cop/naming/rescued_exceptions_variable_name'
474
477
  require_relative 'rubocop/cop/naming/variable_name'
475
478
  require_relative 'rubocop/cop/naming/variable_number'
@@ -538,6 +541,7 @@ require_relative 'rubocop/cop/style/empty_heredoc'
538
541
  require_relative 'rubocop/cop/style/empty_lambda_parameter'
539
542
  require_relative 'rubocop/cop/style/empty_literal'
540
543
  require_relative 'rubocop/cop/style/empty_method'
544
+ require_relative 'rubocop/cop/style/empty_string_inside_interpolation'
541
545
  require_relative 'rubocop/cop/style/endless_method'
542
546
  require_relative 'rubocop/cop/style/encoding'
543
547
  require_relative 'rubocop/cop/style/end_block'
@@ -604,6 +608,7 @@ require_relative 'rubocop/cop/style/numbered_parameters'
604
608
  require_relative 'rubocop/cop/style/open_struct_use'
605
609
  require_relative 'rubocop/cop/style/operator_method_call'
606
610
  require_relative 'rubocop/cop/style/redundant_array_constructor'
611
+ require_relative 'rubocop/cop/style/redundant_array_flatten'
607
612
  require_relative 'rubocop/cop/style/redundant_assignment'
608
613
  require_relative 'rubocop/cop/style/redundant_constant_base'
609
614
  require_relative 'rubocop/cop/style/redundant_current_directory_in_path'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.75.6
4
+ version: 1.76.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -9,7 +9,7 @@ authors:
9
9
  - Yuji Nakayama
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-05-15 00:00:00.000000000 Z
12
+ date: 2025-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -127,7 +127,7 @@ dependencies:
127
127
  requirements:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 1.44.0
130
+ version: 1.45.0
131
131
  - - "<"
132
132
  - !ruby/object:Gem::Version
133
133
  version: '2.0'
@@ -137,7 +137,7 @@ dependencies:
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 1.44.0
140
+ version: 1.45.0
141
141
  - - "<"
142
142
  - !ruby/object:Gem::Version
143
143
  version: '2.0'
@@ -561,10 +561,12 @@ files:
561
561
  - lib/rubocop/cop/lint/useless_access_modifier.rb
562
562
  - lib/rubocop/cop/lint/useless_assignment.rb
563
563
  - lib/rubocop/cop/lint/useless_constant_scoping.rb
564
+ - lib/rubocop/cop/lint/useless_default_value_argument.rb
564
565
  - lib/rubocop/cop/lint/useless_defined.rb
565
566
  - lib/rubocop/cop/lint/useless_else_without_rescue.rb
566
567
  - lib/rubocop/cop/lint/useless_method_definition.rb
567
568
  - lib/rubocop/cop/lint/useless_numeric_operation.rb
569
+ - lib/rubocop/cop/lint/useless_or.rb
568
570
  - lib/rubocop/cop/lint/useless_rescue.rb
569
571
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
570
572
  - lib/rubocop/cop/lint/useless_setter_call.rb
@@ -679,7 +681,8 @@ files:
679
681
  - lib/rubocop/cop/naming/memoized_instance_variable_name.rb
680
682
  - lib/rubocop/cop/naming/method_name.rb
681
683
  - lib/rubocop/cop/naming/method_parameter_name.rb
682
- - lib/rubocop/cop/naming/predicate_name.rb
684
+ - lib/rubocop/cop/naming/predicate_method.rb
685
+ - lib/rubocop/cop/naming/predicate_prefix.rb
683
686
  - lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb
684
687
  - lib/rubocop/cop/naming/variable_name.rb
685
688
  - lib/rubocop/cop/naming/variable_number.rb
@@ -758,6 +761,7 @@ files:
758
761
  - lib/rubocop/cop/style/empty_lambda_parameter.rb
759
762
  - lib/rubocop/cop/style/empty_literal.rb
760
763
  - lib/rubocop/cop/style/empty_method.rb
764
+ - lib/rubocop/cop/style/empty_string_inside_interpolation.rb
761
765
  - lib/rubocop/cop/style/encoding.rb
762
766
  - lib/rubocop/cop/style/end_block.rb
763
767
  - lib/rubocop/cop/style/endless_method.rb
@@ -878,6 +882,7 @@ files:
878
882
  - lib/rubocop/cop/style/random_with_offset.rb
879
883
  - lib/rubocop/cop/style/redundant_argument.rb
880
884
  - lib/rubocop/cop/style/redundant_array_constructor.rb
885
+ - lib/rubocop/cop/style/redundant_array_flatten.rb
881
886
  - lib/rubocop/cop/style/redundant_assignment.rb
882
887
  - lib/rubocop/cop/style/redundant_begin.rb
883
888
  - lib/rubocop/cop/style/redundant_capital_w.rb
@@ -1080,9 +1085,9 @@ licenses:
1080
1085
  - MIT
1081
1086
  metadata:
1082
1087
  homepage_uri: https://rubocop.org/
1083
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.75.6
1088
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.76.0
1084
1089
  source_code_uri: https://github.com/rubocop/rubocop/
1085
- documentation_uri: https://docs.rubocop.org/rubocop/1.75/
1090
+ documentation_uri: https://docs.rubocop.org/rubocop/1.76/
1086
1091
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1087
1092
  rubygems_mfa_required: 'true'
1088
1093
  rdoc_options: []