rubocop 1.75.8 → 1.79.1

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -16
  3. data/config/default.yml +107 -26
  4. data/config/obsoletion.yml +6 -3
  5. data/lib/rubocop/cli.rb +12 -1
  6. data/lib/rubocop/config_loader.rb +1 -38
  7. data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
  8. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -2
  9. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  10. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +0 -22
  11. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  12. data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
  13. data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
  14. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +4 -4
  15. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +1 -0
  16. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +3 -2
  17. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  18. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  19. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +99 -0
  20. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -1
  21. data/lib/rubocop/cop/layout/line_length.rb +26 -5
  22. data/lib/rubocop/cop/layout/space_around_keyword.rb +6 -1
  23. data/lib/rubocop/cop/layout/space_around_operators.rb +8 -0
  24. data/lib/rubocop/cop/layout/space_before_brackets.rb +2 -9
  25. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -2
  26. data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
  27. data/lib/rubocop/cop/lint/duplicate_methods.rb +25 -4
  28. data/lib/rubocop/cop/lint/empty_interpolation.rb +3 -1
  29. data/lib/rubocop/cop/lint/float_comparison.rb +4 -4
  30. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  31. data/lib/rubocop/cop/lint/literal_as_condition.rb +34 -28
  32. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +1 -0
  33. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
  34. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +101 -2
  35. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +4 -4
  36. data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
  37. data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
  38. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +4 -4
  39. data/lib/rubocop/cop/lint/self_assignment.rb +25 -0
  40. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +5 -0
  41. data/lib/rubocop/cop/lint/useless_access_modifier.rb +29 -4
  42. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
  43. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +1 -0
  44. data/lib/rubocop/cop/lint/useless_or.rb +98 -0
  45. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +3 -3
  46. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
  47. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  48. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  49. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  50. data/lib/rubocop/cop/mixin/line_length_help.rb +24 -8
  51. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  52. data/lib/rubocop/cop/naming/file_name.rb +2 -2
  53. data/lib/rubocop/cop/naming/method_name.rb +127 -13
  54. data/lib/rubocop/cop/naming/predicate_method.rb +306 -0
  55. data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +4 -4
  56. data/lib/rubocop/cop/security/eval.rb +2 -1
  57. data/lib/rubocop/cop/security/open.rb +1 -0
  58. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -1
  59. data/lib/rubocop/cop/style/accessor_grouping.rb +13 -1
  60. data/lib/rubocop/cop/style/arguments_forwarding.rb +11 -17
  61. data/lib/rubocop/cop/style/array_intersect.rb +53 -23
  62. data/lib/rubocop/cop/style/block_delimiters.rb +1 -1
  63. data/lib/rubocop/cop/style/case_like_if.rb +1 -1
  64. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  65. data/lib/rubocop/cop/style/conditional_assignment.rb +4 -2
  66. data/lib/rubocop/cop/style/dig_chain.rb +1 -1
  67. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
  68. data/lib/rubocop/cop/style/exponential_notation.rb +3 -2
  69. data/lib/rubocop/cop/style/fetch_env_var.rb +32 -6
  70. data/lib/rubocop/cop/style/hash_conversion.rb +16 -8
  71. data/lib/rubocop/cop/style/if_unless_modifier.rb +13 -6
  72. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  73. data/lib/rubocop/cop/style/it_assignment.rb +69 -12
  74. data/lib/rubocop/cop/style/it_block_parameter.rb +36 -15
  75. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +4 -6
  76. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +16 -0
  77. data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
  78. data/lib/rubocop/cop/style/parallel_assignment.rb +32 -20
  79. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  80. data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -9
  81. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  82. data/lib/rubocop/cop/style/redundant_interpolation.rb +1 -1
  83. data/lib/rubocop/cop/style/redundant_line_continuation.rb +1 -1
  84. data/lib/rubocop/cop/style/redundant_parentheses.rb +35 -5
  85. data/lib/rubocop/cop/style/redundant_self.rb +8 -5
  86. data/lib/rubocop/cop/style/safe_navigation.rb +24 -11
  87. data/lib/rubocop/cop/style/single_line_methods.rb +7 -4
  88. data/lib/rubocop/cop/style/sole_nested_conditional.rb +32 -2
  89. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  90. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  91. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
  92. data/lib/rubocop/cop/variable_force.rb +18 -7
  93. data/lib/rubocop/cops_documentation_generator.rb +1 -0
  94. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  95. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  96. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  97. data/lib/rubocop/formatter/pacman_formatter.rb +1 -0
  98. data/lib/rubocop/lsp/diagnostic.rb +4 -4
  99. data/lib/rubocop/lsp/routes.rb +4 -4
  100. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  101. data/lib/rubocop/rspec/expect_offense.rb +9 -3
  102. data/lib/rubocop/server/cache.rb +4 -2
  103. data/lib/rubocop/server/client_command/base.rb +10 -0
  104. data/lib/rubocop/server/client_command/exec.rb +2 -1
  105. data/lib/rubocop/server/client_command/start.rb +11 -1
  106. data/lib/rubocop/version.rb +1 -1
  107. data/lib/rubocop.rb +11 -1
  108. data/lib/ruby_lsp/rubocop/addon.rb +2 -2
  109. metadata +21 -8
@@ -115,8 +115,9 @@ module RuboCop
115
115
  end
116
116
 
117
117
  def correct_node(corrector, node)
118
- corrector.replace(node.loc.keyword, 'if') if node.unless?
118
+ corrector.replace(node.loc.keyword, 'if') if node.unless? && !part_of_ignored_node?(node)
119
119
  corrector.replace(node.condition, chainable_condition(node))
120
+ ignore_node(node)
120
121
  end
121
122
 
122
123
  def correct_for_guard_condition_style(corrector, node, if_branch)
@@ -174,6 +175,8 @@ module RuboCop
174
175
 
175
176
  if parenthesize_method?(condition)
176
177
  parenthesized_method_arguments(condition)
178
+ elsif condition.and_type?
179
+ parenthesized_and(condition)
177
180
  else
178
181
  "(#{condition.source})"
179
182
  end
@@ -185,12 +188,19 @@ module RuboCop
185
188
  end
186
189
 
187
190
  def add_parentheses?(node)
188
- return true if node.assignment? || (node.operator_keyword? && !node.and_type?)
191
+ return true if node.assignment? || node.or_type?
192
+ return true if assignment_in_and?(node)
189
193
  return false unless node.call_type?
190
194
 
191
195
  (node.arguments.any? && !node.parenthesized?) || node.prefix_not?
192
196
  end
193
197
 
198
+ def assignment_in_and?(node)
199
+ return false unless node.and_type?
200
+
201
+ node.each_descendant.any?(&:assignment?)
202
+ end
203
+
194
204
  def parenthesized_method_arguments(node)
195
205
  method_call = node.source_range.begin.join(node.loc.selector.end).source
196
206
  arguments = node.first_argument.source_range.begin.join(node.source_range.end).source
@@ -198,6 +208,26 @@ module RuboCop
198
208
  "#{method_call}(#{arguments})"
199
209
  end
200
210
 
211
+ def parenthesized_and(node)
212
+ # We only need to add parentheses around the last clause if it's an assignment,
213
+ # because other clauses will be unchanged by merging conditionals.
214
+ lhs = node.lhs.source
215
+ rhs = parenthesized_and_clause(node.rhs)
216
+ operator = range_with_surrounding_space(node.loc.operator, whitespace: true).source
217
+
218
+ "#{lhs}#{operator}#{rhs}"
219
+ end
220
+
221
+ def parenthesized_and_clause(node)
222
+ if node.and_type?
223
+ parenthesized_and(node)
224
+ elsif node.assignment?
225
+ "(#{node.source})"
226
+ else
227
+ node.source
228
+ end
229
+ end
230
+
201
231
  def allow_modifier?
202
232
  cop_config['AllowModifier']
203
233
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Style
6
- # Check for parentheses around stabby lambda arguments.
6
+ # Checks for parentheses around stabby lambda arguments.
7
7
  # There are two different styles. Defaults to `require_parentheses`.
8
8
  #
9
9
  # @example EnforcedStyle: require_parentheses (default)
@@ -270,7 +270,7 @@ module RuboCop
270
270
  end
271
271
 
272
272
  def allow_if_method_has_argument?(send_node)
273
- !!cop_config.fetch('AllowMethodsWithArguments', false) && !send_node.arguments.count.zero?
273
+ !!cop_config.fetch('AllowMethodsWithArguments', false) && send_node.arguments.any?
274
274
  end
275
275
 
276
276
  def allow_comments?
@@ -97,7 +97,7 @@ module RuboCop
97
97
  pipes = tokens.select { |token| token.type == :tPIPE }
98
98
  begin_pos, end_pos = pipes.map { |pipe| tokens.index(pipe) }
99
99
 
100
- tokens[begin_pos + 1..end_pos - 1]
100
+ tokens[(begin_pos + 1)..(end_pos - 1)]
101
101
  end
102
102
  end
103
103
  end
@@ -296,7 +296,7 @@ module RuboCop
296
296
  variable_table.accessible_variables.each { |variable| variable.reference!(node) }
297
297
  end
298
298
 
299
- # Mark all assignments which are referenced in the same loop
299
+ # Mark last assignments which are referenced in the same loop
300
300
  # as referenced by ignoring AST order since they would be referenced
301
301
  # in next iteration.
302
302
  def mark_assignments_as_referenced_in_loop(node)
@@ -308,13 +308,12 @@ module RuboCop
308
308
  # would be skipped here.
309
309
  next unless variable
310
310
 
311
- variable.assignments.each do |assignment|
312
- next if assignment_nodes_in_loop.none? do |assignment_node|
313
- assignment_node.equal?(assignment.node)
314
- end
315
-
316
- assignment.reference!(node)
311
+ loop_assignments = variable.assignments.select do |assignment|
312
+ assignment_nodes_in_loop.include?(assignment.node)
317
313
  end
314
+ next unless loop_assignments.any?
315
+
316
+ reference_assignments(loop_assignments, node)
318
317
  end
319
318
  end
320
319
 
@@ -354,6 +353,18 @@ module RuboCop
354
353
  end
355
354
  end
356
355
 
356
+ def reference_assignments(loop_assignments, node)
357
+ # If inside a branching statement, mark all as referenced.
358
+ # Otherwise, mark only the last assignment as referenced.
359
+ # Note that `rescue` must be considered as branching because of
360
+ # the `retry` keyword.
361
+ if loop_assignments.first.node.each_ancestor(:if, :rescue, :case, :case_match).any?
362
+ loop_assignments.each { |assignment| assignment.reference!(node) }
363
+ else
364
+ loop_assignments.last&.reference!(node)
365
+ end
366
+ end
367
+
357
368
  def scanned_node?(node)
358
369
  scanned_nodes.include?(node)
359
370
  end
@@ -7,6 +7,7 @@ require 'yard'
7
7
  # @api private
8
8
  class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
9
9
  include ::RuboCop::Cop::Documentation
10
+
10
11
  CopData = Struct.new(
11
12
  :cop, :description, :example_objects, :safety_objects, :see_objects, :config, keyword_init: true
12
13
  )
@@ -22,7 +22,7 @@ module RuboCop
22
22
 
23
23
  @severest_offense = nil
24
24
 
25
- file_phrase = target_files.count == 1 ? 'file' : 'files'
25
+ file_phrase = target_files.one? ? 'file' : 'files'
26
26
 
27
27
  # 185/407 files |====== 45 ======> | ETA: 00:00:04
28
28
  # %c / %C | %w > %i | %e
@@ -6,6 +6,7 @@ module RuboCop
6
6
  class MarkdownFormatter < BaseFormatter
7
7
  include TextUtil
8
8
  include PathUtil
9
+
9
10
  attr_reader :files, :summary
10
11
 
11
12
  def initialize(output, options = {})
@@ -24,7 +24,7 @@ module RuboCop
24
24
 
25
25
  return unless output.tty?
26
26
 
27
- file_phrase = target_files.count == 1 ? 'file' : 'files'
27
+ file_phrase = target_files.one? ? 'file' : 'files'
28
28
 
29
29
  # 185/407 files |====== 45 ======> | ETA: 00:00:04
30
30
  # %c / %C | %w > %i | %e
@@ -9,6 +9,7 @@ module RuboCop
9
9
  # https://github.com/go-labs/rspec_pacman_formatter
10
10
  class PacmanFormatter < ClangStyleFormatter
11
11
  include TextUtil
12
+
12
13
  attr_accessor :progress_line
13
14
 
14
15
  FALLBACK_TERMINAL_WIDTH = 80
@@ -79,7 +79,7 @@ module RuboCop
79
79
  LanguageServer::Protocol::Interface::CodeDescription.new(href: doc_url)
80
80
  end
81
81
 
82
- # rubocop:disable Layout/LineLength, Metrics/MethodLength
82
+ # rubocop:disable Metrics/MethodLength
83
83
  def autocorrect_action
84
84
  LanguageServer::Protocol::Interface::CodeAction.new(
85
85
  title: "Autocorrect #{@offense.cop_name}",
@@ -98,7 +98,7 @@ module RuboCop
98
98
  is_preferred: true
99
99
  )
100
100
  end
101
- # rubocop:enable Layout/LineLength, Metrics/MethodLength
101
+ # rubocop:enable Metrics/MethodLength
102
102
 
103
103
  # rubocop:disable Metrics/MethodLength
104
104
  def offense_replacements
@@ -120,7 +120,7 @@ module RuboCop
120
120
  end
121
121
  # rubocop:enable Metrics/MethodLength
122
122
 
123
- # rubocop:disable Layout/LineLength, Metrics/MethodLength
123
+ # rubocop:disable Metrics/MethodLength
124
124
  def disable_line_action
125
125
  LanguageServer::Protocol::Interface::CodeAction.new(
126
126
  title: "Disable #{@offense.cop_name} for this line",
@@ -138,7 +138,7 @@ module RuboCop
138
138
  )
139
139
  )
140
140
  end
141
- # rubocop:enable Layout/LineLength, Metrics/MethodLength
141
+ # rubocop:enable Metrics/MethodLength
142
142
 
143
143
  def line_disable_comment
144
144
  new_text = if @offense.source_line.include?(' # rubocop:disable ')
@@ -194,7 +194,7 @@ module RuboCop
194
194
  return []
195
195
  end
196
196
 
197
- new_text = @server.format(remove_file_protocol_from(file_uri), text, command: command)
197
+ new_text = @server.format(convert_file_uri_to_path(file_uri), text, command: command)
198
198
 
199
199
  return [] if new_text == text
200
200
 
@@ -214,13 +214,13 @@ module RuboCop
214
214
  method: 'textDocument/publishDiagnostics',
215
215
  params: {
216
216
  uri: file_uri,
217
- diagnostics: @server.offenses(remove_file_protocol_from(file_uri), text)
217
+ diagnostics: @server.offenses(convert_file_uri_to_path(file_uri), text)
218
218
  }
219
219
  }
220
220
  end
221
221
 
222
- def remove_file_protocol_from(uri)
223
- uri.delete_prefix('file://')
222
+ def convert_file_uri_to_path(uri)
223
+ URI.decode_www_form_component(uri.delete_prefix('file://'))
224
224
  end
225
225
  end
226
226
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ # Reports information about pending cops that are not explicitly configured.
5
+ #
6
+ # This class is responsible for displaying warnings when new cops have been added to RuboCop
7
+ # but have not yet been enabled or disabled in the user's configuration.
8
+ # It provides a centralized way to determine whether such warnings should be shown,
9
+ # based on global flags or configuration settings.
10
+ class PendingCopsReporter
11
+ class << self
12
+ PENDING_BANNER = <<~BANNER
13
+ The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
14
+
15
+ Please also note that you can opt-in to new cops by default by adding this to your config:
16
+ AllCops:
17
+ NewCops: enable
18
+ BANNER
19
+
20
+ attr_accessor :disable_pending_cops, :enable_pending_cops
21
+
22
+ def warn_if_needed(config)
23
+ return if possible_new_cops?(config)
24
+
25
+ pending_cops = pending_cops_only_qualified(config.pending_cops)
26
+ warn_on_pending_cops(pending_cops) unless pending_cops.empty?
27
+ end
28
+
29
+ private
30
+
31
+ def pending_cops_only_qualified(pending_cops)
32
+ pending_cops.select { |cop| Cop::Registry.qualified_cop?(cop.name) }
33
+ end
34
+
35
+ def possible_new_cops?(config)
36
+ disable_pending_cops || enable_pending_cops ||
37
+ config.disabled_new_cops? || config.enabled_new_cops?
38
+ end
39
+
40
+ def warn_on_pending_cops(pending_cops)
41
+ warn Rainbow(PENDING_BANNER).yellow
42
+
43
+ pending_cops.each { |cop| warn_pending_cop cop }
44
+
45
+ warn Rainbow('For more information: https://docs.rubocop.org/rubocop/versioning.html').yellow
46
+ end
47
+
48
+ def warn_pending_cop(cop)
49
+ version = cop.metadata['VersionAdded'] || 'N/A'
50
+
51
+ warn Rainbow("#{cop.name}: # new in #{version}").yellow
52
+ warn Rainbow(' Enabled: true').yellow
53
+ end
54
+ end
55
+ end
56
+ end
@@ -72,9 +72,15 @@ module RuboCop
72
72
  #
73
73
  # expect_no_corrections
74
74
  #
75
- # If your code has variables of different lengths, you can use `%{foo}`,
76
- # `^{foo}`, and `_{foo}` to format your template; you can also abbreviate
77
- # offense messages with `[...]`:
75
+ # If your code has variables of different lengths, you can use the
76
+ # following markers to format your template by passing the variables as a
77
+ # keyword arguments:
78
+ #
79
+ # - `%{foo}`: Interpolates `foo`
80
+ # - `^{foo}`: Inserts `'^' * foo.size` for dynamic offense range length
81
+ # - `_{foo}`: Inserts `' ' * foo.size` for dynamic offense range indentation
82
+ #
83
+ # You can also abbreviate offense messages with `[...]`.
78
84
  #
79
85
  # %w[raise fail].each do |keyword|
80
86
  # expect_offense(<<~RUBY, keyword: keyword)
@@ -46,12 +46,14 @@ module RuboCop
46
46
  end
47
47
 
48
48
  # rubocop:disable Metrics/AbcSize
49
- def restart_key
49
+ def restart_key(args_config_file_path: nil)
50
50
  lockfile_path = LOCKFILE_NAMES.map do |lockfile_name|
51
51
  Pathname(project_dir).join(lockfile_name)
52
52
  end.find(&:exist?)
53
53
  version_data = lockfile_path&.read || RuboCop::Version::STRING
54
- config_data = Pathname(ConfigFinder.find_config_path(Dir.pwd)).read
54
+ config_data = Pathname(
55
+ args_config_file_path || ConfigFinder.find_config_path(Dir.pwd)
56
+ ).read
55
57
  yaml = load_erb_templated_yaml(config_data)
56
58
 
57
59
  inherit_from_data = inherit_from_data(yaml)
@@ -38,6 +38,16 @@ module RuboCop
38
38
  warn 'RuboCop server is not running.' unless running
39
39
  end
40
40
  end
41
+
42
+ class << self
43
+ def args_config_file_path
44
+ first_args_config_key_index = ARGV.index { |value| ['-c', '--config'].include?(value) }
45
+
46
+ return if first_args_config_key_index.nil?
47
+
48
+ ARGV[first_args_config_key_index + 1]
49
+ end
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -41,7 +41,8 @@ module RuboCop
41
41
  end
42
42
 
43
43
  def incompatible_version?
44
- Cache.version_path.read != Cache.restart_key
44
+ Cache.version_path.read !=
45
+ Cache.restart_key(args_config_file_path: self.class.args_config_file_path)
45
46
  end
46
47
 
47
48
  def stderr
@@ -34,7 +34,7 @@ module RuboCop
34
34
  exit 0
35
35
  end
36
36
 
37
- Cache.write_version_file(Cache.restart_key)
37
+ write_version_file
38
38
 
39
39
  host = ENV.fetch('RUBOCOP_SERVER_HOST', '127.0.0.1')
40
40
  port = ENV.fetch('RUBOCOP_SERVER_PORT', 0)
@@ -42,6 +42,16 @@ module RuboCop
42
42
  Server::Core.new.start(host, port, detach: @detach)
43
43
  end
44
44
  end
45
+
46
+ private
47
+
48
+ def write_version_file
49
+ Cache.write_version_file(
50
+ Cache.restart_key(
51
+ args_config_file_path: self.class.args_config_file_path
52
+ )
53
+ )
54
+ end
45
55
  end
46
56
  end
47
57
  end
@@ -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.8'
6
+ STRING = '1.79.1'
7
7
 
8
8
  MSG = '%<version>s (using %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
data/lib/rubocop.rb CHANGED
@@ -180,6 +180,7 @@ require_relative 'rubocop/cop/bundler/insecure_protocol_source'
180
180
  require_relative 'rubocop/cop/bundler/ordered_gems'
181
181
 
182
182
  require_relative 'rubocop/cop/gemspec/add_runtime_dependency'
183
+ require_relative 'rubocop/cop/gemspec/attribute_assignment'
183
184
  require_relative 'rubocop/cop/gemspec/dependency_version'
184
185
  require_relative 'rubocop/cop/gemspec/deprecated_attribute_assignment'
185
186
  require_relative 'rubocop/cop/gemspec/development_dependencies'
@@ -210,6 +211,7 @@ require_relative 'rubocop/cop/layout/empty_line_after_guard_clause'
210
211
  require_relative 'rubocop/cop/layout/empty_line_after_magic_comment'
211
212
  require_relative 'rubocop/cop/layout/empty_line_after_multiline_condition'
212
213
  require_relative 'rubocop/cop/layout/empty_line_between_defs'
214
+ require_relative 'rubocop/cop/layout/empty_lines_after_module_inclusion'
213
215
  require_relative 'rubocop/cop/layout/empty_lines_around_access_modifier'
214
216
  require_relative 'rubocop/cop/layout/empty_lines_around_arguments'
215
217
  require_relative 'rubocop/cop/layout/empty_lines_around_attribute_accessor'
@@ -289,6 +291,7 @@ require_relative 'rubocop/cop/layout/space_inside_string_interpolation'
289
291
  require_relative 'rubocop/cop/layout/trailing_empty_lines'
290
292
  require_relative 'rubocop/cop/layout/trailing_whitespace'
291
293
 
294
+ require_relative 'rubocop/cop/lint/utils/nil_receiver_checker'
292
295
  require_relative 'rubocop/cop/lint/ambiguous_assignment'
293
296
  require_relative 'rubocop/cop/lint/ambiguous_block_association'
294
297
  require_relative 'rubocop/cop/lint/ambiguous_operator'
@@ -430,10 +433,12 @@ require_relative 'rubocop/cop/lint/uri_regexp'
430
433
  require_relative 'rubocop/cop/lint/useless_access_modifier'
431
434
  require_relative 'rubocop/cop/lint/useless_assignment'
432
435
  require_relative 'rubocop/cop/lint/useless_constant_scoping'
436
+ require_relative 'rubocop/cop/lint/useless_default_value_argument'
433
437
  require_relative 'rubocop/cop/lint/useless_defined'
434
438
  require_relative 'rubocop/cop/lint/useless_else_without_rescue'
435
439
  require_relative 'rubocop/cop/lint/useless_method_definition'
436
440
  require_relative 'rubocop/cop/lint/useless_numeric_operation'
441
+ require_relative 'rubocop/cop/lint/useless_or'
437
442
  require_relative 'rubocop/cop/lint/useless_rescue'
438
443
  require_relative 'rubocop/cop/lint/useless_ruby2_keywords'
439
444
  require_relative 'rubocop/cop/lint/useless_setter_call'
@@ -469,7 +474,8 @@ require_relative 'rubocop/cop/naming/memoized_instance_variable_name'
469
474
  require_relative 'rubocop/cop/naming/method_name'
470
475
  require_relative 'rubocop/cop/naming/method_parameter_name'
471
476
  require_relative 'rubocop/cop/naming/binary_operator_parameter_name'
472
- require_relative 'rubocop/cop/naming/predicate_name'
477
+ require_relative 'rubocop/cop/naming/predicate_method'
478
+ require_relative 'rubocop/cop/naming/predicate_prefix'
473
479
  require_relative 'rubocop/cop/naming/rescued_exceptions_variable_name'
474
480
  require_relative 'rubocop/cop/naming/variable_name'
475
481
  require_relative 'rubocop/cop/naming/variable_number'
@@ -504,6 +510,7 @@ require_relative 'rubocop/cop/style/class_methods_definitions'
504
510
  require_relative 'rubocop/cop/style/class_vars'
505
511
  require_relative 'rubocop/cop/style/collection_compact'
506
512
  require_relative 'rubocop/cop/style/collection_methods'
513
+ require_relative 'rubocop/cop/style/collection_querying'
507
514
  require_relative 'rubocop/cop/style/colon_method_call'
508
515
  require_relative 'rubocop/cop/style/colon_method_definition'
509
516
  require_relative 'rubocop/cop/style/combinable_defined'
@@ -538,6 +545,7 @@ require_relative 'rubocop/cop/style/empty_heredoc'
538
545
  require_relative 'rubocop/cop/style/empty_lambda_parameter'
539
546
  require_relative 'rubocop/cop/style/empty_literal'
540
547
  require_relative 'rubocop/cop/style/empty_method'
548
+ require_relative 'rubocop/cop/style/empty_string_inside_interpolation'
541
549
  require_relative 'rubocop/cop/style/endless_method'
542
550
  require_relative 'rubocop/cop/style/encoding'
543
551
  require_relative 'rubocop/cop/style/end_block'
@@ -604,6 +612,7 @@ require_relative 'rubocop/cop/style/numbered_parameters'
604
612
  require_relative 'rubocop/cop/style/open_struct_use'
605
613
  require_relative 'rubocop/cop/style/operator_method_call'
606
614
  require_relative 'rubocop/cop/style/redundant_array_constructor'
615
+ require_relative 'rubocop/cop/style/redundant_array_flatten'
607
616
  require_relative 'rubocop/cop/style/redundant_assignment'
608
617
  require_relative 'rubocop/cop/style/redundant_constant_base'
609
618
  require_relative 'rubocop/cop/style/redundant_current_directory_in_path'
@@ -805,6 +814,7 @@ require_relative 'rubocop/options'
805
814
  require_relative 'rubocop/remote_config'
806
815
  require_relative 'rubocop/target_ruby'
807
816
  require_relative 'rubocop/yaml_duplication_checker'
817
+ require_relative 'rubocop/pending_cops_reporter'
808
818
 
809
819
  # rubocop:enable Style/RequireOrder
810
820
 
@@ -34,7 +34,7 @@ module RubyLsp
34
34
  @runtime_adapter = nil
35
35
  end
36
36
 
37
- # rubocop:disable Layout/LineLength, Metrics/MethodLength
37
+ # rubocop:disable Metrics/MethodLength
38
38
  def register_additional_file_watchers(global_state, message_queue)
39
39
  return unless global_state.supports_watching_files
40
40
 
@@ -59,7 +59,7 @@ module RubyLsp
59
59
  )
60
60
  )
61
61
  end
62
- # rubocop:enable Layout/LineLength, Metrics/MethodLength
62
+ # rubocop:enable Metrics/MethodLength
63
63
 
64
64
  def workspace_did_change_watched_files(changes)
65
65
  return unless changes.any? { |change| change[:uri].end_with?('.rubocop.yml') }
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.75.8
4
+ version: 1.79.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
+ autorequire:
10
11
  bindir: exe
11
12
  cert_chain: []
12
- date: 2025-05-28 00:00:00.000000000 Z
13
+ date: 2025-07-31 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: json
@@ -127,7 +128,7 @@ dependencies:
127
128
  requirements:
128
129
  - - ">="
129
130
  - !ruby/object:Gem::Version
130
- version: 1.44.0
131
+ version: 1.46.0
131
132
  - - "<"
132
133
  - !ruby/object:Gem::Version
133
134
  version: '2.0'
@@ -137,7 +138,7 @@ dependencies:
137
138
  requirements:
138
139
  - - ">="
139
140
  - !ruby/object:Gem::Version
140
- version: 1.44.0
141
+ version: 1.46.0
141
142
  - - "<"
142
143
  - !ruby/object:Gem::Version
143
144
  version: '2.0'
@@ -265,6 +266,7 @@ files:
265
266
  - lib/rubocop/cop/exclude_limit.rb
266
267
  - lib/rubocop/cop/force.rb
267
268
  - lib/rubocop/cop/gemspec/add_runtime_dependency.rb
269
+ - lib/rubocop/cop/gemspec/attribute_assignment.rb
268
270
  - lib/rubocop/cop/gemspec/dependency_version.rb
269
271
  - lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
270
272
  - lib/rubocop/cop/gemspec/development_dependencies.rb
@@ -341,6 +343,7 @@ files:
341
343
  - lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb
342
344
  - lib/rubocop/cop/layout/empty_line_between_defs.rb
343
345
  - lib/rubocop/cop/layout/empty_lines.rb
346
+ - lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb
344
347
  - lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb
345
348
  - lib/rubocop/cop/layout/empty_lines_around_arguments.rb
346
349
  - lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
@@ -561,14 +564,17 @@ files:
561
564
  - lib/rubocop/cop/lint/useless_access_modifier.rb
562
565
  - lib/rubocop/cop/lint/useless_assignment.rb
563
566
  - lib/rubocop/cop/lint/useless_constant_scoping.rb
567
+ - lib/rubocop/cop/lint/useless_default_value_argument.rb
564
568
  - lib/rubocop/cop/lint/useless_defined.rb
565
569
  - lib/rubocop/cop/lint/useless_else_without_rescue.rb
566
570
  - lib/rubocop/cop/lint/useless_method_definition.rb
567
571
  - lib/rubocop/cop/lint/useless_numeric_operation.rb
572
+ - lib/rubocop/cop/lint/useless_or.rb
568
573
  - lib/rubocop/cop/lint/useless_rescue.rb
569
574
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
570
575
  - lib/rubocop/cop/lint/useless_setter_call.rb
571
576
  - lib/rubocop/cop/lint/useless_times.rb
577
+ - lib/rubocop/cop/lint/utils/nil_receiver_checker.rb
572
578
  - lib/rubocop/cop/lint/void.rb
573
579
  - lib/rubocop/cop/message_annotator.rb
574
580
  - lib/rubocop/cop/metrics/abc_size.rb
@@ -679,7 +685,8 @@ files:
679
685
  - lib/rubocop/cop/naming/memoized_instance_variable_name.rb
680
686
  - lib/rubocop/cop/naming/method_name.rb
681
687
  - lib/rubocop/cop/naming/method_parameter_name.rb
682
- - lib/rubocop/cop/naming/predicate_name.rb
688
+ - lib/rubocop/cop/naming/predicate_method.rb
689
+ - lib/rubocop/cop/naming/predicate_prefix.rb
683
690
  - lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb
684
691
  - lib/rubocop/cop/naming/variable_name.rb
685
692
  - lib/rubocop/cop/naming/variable_number.rb
@@ -724,6 +731,7 @@ files:
724
731
  - lib/rubocop/cop/style/class_vars.rb
725
732
  - lib/rubocop/cop/style/collection_compact.rb
726
733
  - lib/rubocop/cop/style/collection_methods.rb
734
+ - lib/rubocop/cop/style/collection_querying.rb
727
735
  - lib/rubocop/cop/style/colon_method_call.rb
728
736
  - lib/rubocop/cop/style/colon_method_definition.rb
729
737
  - lib/rubocop/cop/style/combinable_defined.rb
@@ -758,6 +766,7 @@ files:
758
766
  - lib/rubocop/cop/style/empty_lambda_parameter.rb
759
767
  - lib/rubocop/cop/style/empty_literal.rb
760
768
  - lib/rubocop/cop/style/empty_method.rb
769
+ - lib/rubocop/cop/style/empty_string_inside_interpolation.rb
761
770
  - lib/rubocop/cop/style/encoding.rb
762
771
  - lib/rubocop/cop/style/end_block.rb
763
772
  - lib/rubocop/cop/style/endless_method.rb
@@ -878,6 +887,7 @@ files:
878
887
  - lib/rubocop/cop/style/random_with_offset.rb
879
888
  - lib/rubocop/cop/style/redundant_argument.rb
880
889
  - lib/rubocop/cop/style/redundant_array_constructor.rb
890
+ - lib/rubocop/cop/style/redundant_array_flatten.rb
881
891
  - lib/rubocop/cop/style/redundant_assignment.rb
882
892
  - lib/rubocop/cop/style/redundant_begin.rb
883
893
  - lib/rubocop/cop/style/redundant_capital_w.rb
@@ -1033,6 +1043,7 @@ files:
1033
1043
  - lib/rubocop/name_similarity.rb
1034
1044
  - lib/rubocop/options.rb
1035
1045
  - lib/rubocop/path_util.rb
1046
+ - lib/rubocop/pending_cops_reporter.rb
1036
1047
  - lib/rubocop/platform.rb
1037
1048
  - lib/rubocop/plugin.rb
1038
1049
  - lib/rubocop/plugin/configuration_integrator.rb
@@ -1080,11 +1091,12 @@ licenses:
1080
1091
  - MIT
1081
1092
  metadata:
1082
1093
  homepage_uri: https://rubocop.org/
1083
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.75.8
1094
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.79.1
1084
1095
  source_code_uri: https://github.com/rubocop/rubocop/
1085
- documentation_uri: https://docs.rubocop.org/rubocop/1.75/
1096
+ documentation_uri: https://docs.rubocop.org/rubocop/1.79/
1086
1097
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1087
1098
  rubygems_mfa_required: 'true'
1099
+ post_install_message:
1088
1100
  rdoc_options: []
1089
1101
  require_paths:
1090
1102
  - lib
@@ -1099,7 +1111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1099
1111
  - !ruby/object:Gem::Version
1100
1112
  version: '0'
1101
1113
  requirements: []
1102
- rubygems_version: 3.6.2
1114
+ rubygems_version: 3.3.7
1115
+ signing_key:
1103
1116
  specification_version: 4
1104
1117
  summary: Automatic Ruby code style checking tool.
1105
1118
  test_files: []