rubocop 1.75.8 → 1.80.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 (131) 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/exe/rubocop +1 -8
  6. data/lib/rubocop/cli.rb +17 -1
  7. data/lib/rubocop/config_loader.rb +1 -38
  8. data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
  9. data/lib/rubocop/cop/correctors/alignment_corrector.rb +6 -3
  10. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +7 -2
  11. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -2
  12. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  13. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +0 -22
  14. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  15. data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
  16. data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
  17. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +4 -4
  18. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +1 -0
  19. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +3 -2
  20. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  21. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  22. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
  23. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -1
  24. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
  25. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
  26. data/lib/rubocop/cop/layout/line_length.rb +26 -5
  27. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -0
  28. data/lib/rubocop/cop/layout/space_around_keyword.rb +6 -1
  29. data/lib/rubocop/cop/layout/space_around_operators.rb +8 -0
  30. data/lib/rubocop/cop/layout/space_before_brackets.rb +2 -9
  31. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -2
  32. data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
  33. data/lib/rubocop/cop/lint/duplicate_methods.rb +25 -4
  34. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +5 -42
  35. data/lib/rubocop/cop/lint/empty_interpolation.rb +3 -1
  36. data/lib/rubocop/cop/lint/float_comparison.rb +4 -4
  37. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  38. data/lib/rubocop/cop/lint/literal_as_condition.rb +34 -28
  39. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -2
  40. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +1 -0
  41. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
  42. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +101 -2
  43. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +4 -4
  44. data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
  45. data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
  46. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +4 -4
  47. data/lib/rubocop/cop/lint/self_assignment.rb +30 -4
  48. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +5 -0
  49. data/lib/rubocop/cop/lint/useless_access_modifier.rb +29 -4
  50. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
  51. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +1 -0
  52. data/lib/rubocop/cop/lint/useless_or.rb +98 -0
  53. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +3 -3
  54. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
  55. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  56. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
  57. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  58. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  59. data/lib/rubocop/cop/mixin/line_length_help.rb +24 -8
  60. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  61. data/lib/rubocop/cop/naming/file_name.rb +2 -2
  62. data/lib/rubocop/cop/naming/method_name.rb +127 -13
  63. data/lib/rubocop/cop/naming/predicate_method.rb +306 -0
  64. data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +4 -4
  65. data/lib/rubocop/cop/security/eval.rb +2 -1
  66. data/lib/rubocop/cop/security/open.rb +1 -0
  67. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -1
  68. data/lib/rubocop/cop/style/accessor_grouping.rb +13 -1
  69. data/lib/rubocop/cop/style/arguments_forwarding.rb +11 -17
  70. data/lib/rubocop/cop/style/array_intersect.rb +98 -34
  71. data/lib/rubocop/cop/style/bitwise_predicate.rb +8 -1
  72. data/lib/rubocop/cop/style/block_delimiters.rb +1 -1
  73. data/lib/rubocop/cop/style/case_like_if.rb +1 -1
  74. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  75. data/lib/rubocop/cop/style/conditional_assignment.rb +4 -2
  76. data/lib/rubocop/cop/style/dig_chain.rb +1 -1
  77. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
  78. data/lib/rubocop/cop/style/exponential_notation.rb +3 -2
  79. data/lib/rubocop/cop/style/fetch_env_var.rb +32 -6
  80. data/lib/rubocop/cop/style/hash_conversion.rb +16 -8
  81. data/lib/rubocop/cop/style/if_unless_modifier.rb +13 -6
  82. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  83. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  84. data/lib/rubocop/cop/style/it_assignment.rb +69 -12
  85. data/lib/rubocop/cop/style/it_block_parameter.rb +36 -15
  86. data/lib/rubocop/cop/style/map_to_hash.rb +1 -3
  87. data/lib/rubocop/cop/style/map_to_set.rb +1 -3
  88. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +4 -6
  89. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +16 -0
  90. data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
  91. data/lib/rubocop/cop/style/parallel_assignment.rb +32 -20
  92. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  93. data/lib/rubocop/cop/style/redundant_begin.rb +34 -0
  94. data/lib/rubocop/cop/style/redundant_condition.rb +1 -1
  95. data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -9
  96. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  97. data/lib/rubocop/cop/style/redundant_interpolation.rb +1 -1
  98. data/lib/rubocop/cop/style/redundant_line_continuation.rb +1 -1
  99. data/lib/rubocop/cop/style/redundant_parentheses.rb +42 -6
  100. data/lib/rubocop/cop/style/redundant_self.rb +8 -5
  101. data/lib/rubocop/cop/style/safe_navigation.rb +38 -12
  102. data/lib/rubocop/cop/style/single_line_methods.rb +7 -4
  103. data/lib/rubocop/cop/style/sole_nested_conditional.rb +32 -2
  104. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  105. data/lib/rubocop/cop/style/string_concatenation.rb +1 -1
  106. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  107. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  108. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
  109. data/lib/rubocop/cop/variable_force/variable.rb +1 -1
  110. data/lib/rubocop/cop/variable_force.rb +25 -8
  111. data/lib/rubocop/cops_documentation_generator.rb +1 -0
  112. data/lib/rubocop/formatter/disabled_config_formatter.rb +18 -5
  113. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  114. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  115. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  116. data/lib/rubocop/formatter/pacman_formatter.rb +1 -0
  117. data/lib/rubocop/lsp/diagnostic.rb +4 -4
  118. data/lib/rubocop/lsp/routes.rb +35 -6
  119. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  120. data/lib/rubocop/result_cache.rb +14 -12
  121. data/lib/rubocop/rspec/expect_offense.rb +9 -3
  122. data/lib/rubocop/runner.rb +6 -4
  123. data/lib/rubocop/server/cache.rb +4 -2
  124. data/lib/rubocop/server/client_command/base.rb +10 -0
  125. data/lib/rubocop/server/client_command/exec.rb +2 -1
  126. data/lib/rubocop/server/client_command/start.rb +11 -1
  127. data/lib/rubocop/target_finder.rb +9 -9
  128. data/lib/rubocop/version.rb +1 -1
  129. data/lib/rubocop.rb +11 -1
  130. data/lib/ruby_lsp/rubocop/addon.rb +2 -2
  131. metadata +17 -7
@@ -51,7 +51,7 @@ module RuboCop
51
51
  capabilities: LanguageServer::Protocol::Interface::ServerCapabilities.new(
52
52
  document_formatting_provider: true,
53
53
  text_document_sync: LanguageServer::Protocol::Interface::TextDocumentSyncOptions.new(
54
- change: LanguageServer::Protocol::Constant::TextDocumentSyncKind::FULL,
54
+ change: LanguageServer::Protocol::Constant::TextDocumentSyncKind::INCREMENTAL,
55
55
  open_close: true
56
56
  )
57
57
  )
@@ -76,7 +76,12 @@ module RuboCop
76
76
 
77
77
  handle 'textDocument/didChange' do |request|
78
78
  params = request[:params]
79
- result = diagnostic(params[:textDocument][:uri], params[:contentChanges][0][:text])
79
+ file_uri = params[:textDocument][:uri]
80
+ text = @text_cache[file_uri]
81
+ params[:contentChanges].each do |content|
82
+ text = change_text(text, content[:text], content[:range])
83
+ end
84
+ result = diagnostic(file_uri, text)
80
85
  @server.write(result)
81
86
  end
82
87
 
@@ -194,7 +199,7 @@ module RuboCop
194
199
  return []
195
200
  end
196
201
 
197
- new_text = @server.format(remove_file_protocol_from(file_uri), text, command: command)
202
+ new_text = @server.format(convert_file_uri_to_path(file_uri), text, command: command)
198
203
 
199
204
  return [] if new_text == text
200
205
 
@@ -214,13 +219,37 @@ module RuboCop
214
219
  method: 'textDocument/publishDiagnostics',
215
220
  params: {
216
221
  uri: file_uri,
217
- diagnostics: @server.offenses(remove_file_protocol_from(file_uri), text)
222
+ diagnostics: @server.offenses(convert_file_uri_to_path(file_uri), text)
218
223
  }
219
224
  }
220
225
  end
221
226
 
222
- def remove_file_protocol_from(uri)
223
- uri.delete_prefix('file://')
227
+ def change_text(orig_text, text, range)
228
+ return text unless range
229
+
230
+ start_pos = text_pos(orig_text, range[:start])
231
+ end_pos = text_pos(orig_text, range[:end])
232
+ text_bin = orig_text.b
233
+ text_bin[start_pos...end_pos] = text.b
234
+ text_bin.force_encoding(orig_text.encoding)
235
+ end
236
+
237
+ def text_pos(text, range)
238
+ line = range[:line]
239
+ char = range[:character]
240
+ pos = 0
241
+ text.each_line.with_index do |l, i|
242
+ if i == line
243
+ pos += l.encode('utf-16be').b[0, char * 2].encode('utf-8', 'utf-16be').bytesize
244
+ return pos
245
+ end
246
+ pos += l.bytesize
247
+ end
248
+ pos
249
+ end
250
+
251
+ def convert_file_uri_to_path(uri)
252
+ URI.decode_www_form_component(uri.delete_prefix('file://'))
224
253
  end
225
254
  end
226
255
  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
@@ -9,7 +9,7 @@ module RuboCop
9
9
  # Provides functionality for caching RuboCop runs.
10
10
  # @api private
11
11
  class ResultCache
12
- NON_CHANGING = %i[color format formatters out debug fail_level
12
+ NON_CHANGING = %i[color format formatters out debug display_time fail_level
13
13
  fix_layout autocorrect safe_autocorrect autocorrect_all
14
14
  cache fail_fast stdin parallel].freeze
15
15
 
@@ -198,20 +198,22 @@ module RuboCop
198
198
  end
199
199
 
200
200
  def rubocop_extra_features
201
- lib_root = File.join(File.dirname(__FILE__), '..')
202
- exe_root = File.join(lib_root, '..', 'exe')
201
+ @rubocop_extra_features ||= begin
202
+ lib_root = File.join(File.dirname(__FILE__), '..')
203
+ exe_root = File.join(lib_root, '..', 'exe')
203
204
 
204
- # Make sure to use an absolute path to prevent errors on Windows
205
- # when traversing the relative paths with symlinks.
206
- exe_root = File.absolute_path(exe_root)
205
+ # Make sure to use an absolute path to prevent errors on Windows
206
+ # when traversing the relative paths with symlinks.
207
+ exe_root = File.absolute_path(exe_root)
207
208
 
208
- # These are all the files we have `require`d plus everything in the
209
- # exe directory. A change to any of them could affect the cop output
210
- # so we include them in the cache hash.
211
- source_files = $LOADED_FEATURES + Find.find(exe_root).to_a
212
- source_files -= ResultCache.rubocop_required_features # Rely on gem versions
209
+ # These are all the files we have `require`d plus everything in the
210
+ # exe directory. A change to any of them could affect the cop output
211
+ # so we include them in the cache hash.
212
+ source_files = $LOADED_FEATURES + Find.find(exe_root).to_a
213
+ source_files -= ResultCache.rubocop_required_features # Rely on gem versions
213
214
 
214
- source_files
215
+ source_files
216
+ end
215
217
  end
216
218
 
217
219
  # Return a hash of the options given at invocation, minus the ones that have
@@ -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)
@@ -273,7 +273,8 @@ module RuboCop
273
273
  end
274
274
 
275
275
  def do_inspection_loop(file)
276
- processed_source = get_processed_source(file)
276
+ # We can reuse the prism result since the source did not change yet.
277
+ processed_source = get_processed_source(file, @prism_result)
277
278
  # This variable is 2d array used to track corrected offenses after each
278
279
  # inspection iteration. This is used to output meaningful infinite loop
279
280
  # error message.
@@ -295,7 +296,8 @@ module RuboCop
295
296
  # loop if we find any.
296
297
  break unless updated_source_file
297
298
 
298
- processed_source = get_processed_source(file)
299
+ # Autocorrect has happened, don't use the prism result since it is stale.
300
+ processed_source = get_processed_source(file, nil)
299
301
  end
300
302
 
301
303
  # Return summary of corrected offenses after all iterations
@@ -482,7 +484,7 @@ module RuboCop
482
484
  end
483
485
 
484
486
  # rubocop:disable Metrics/MethodLength
485
- def get_processed_source(file)
487
+ def get_processed_source(file, prism_result)
486
488
  config = @config_store.for_file(file)
487
489
  ruby_version = config.target_ruby_version
488
490
  parser_engine = config.parser_engine
@@ -493,7 +495,7 @@ module RuboCop
493
495
  ruby_version,
494
496
  file,
495
497
  parser_engine: parser_engine,
496
- prism_result: @prism_result
498
+ prism_result: prism_result
497
499
  )
498
500
  else
499
501
  begin
@@ -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
@@ -42,14 +42,12 @@ module RuboCop
42
42
  # Support Windows: Backslashes from command-line -> forward slashes
43
43
  base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
44
44
  all_files = find_files(base_dir, File::FNM_DOTMATCH)
45
- # use file.include? for performance optimization
46
- hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }.sort
47
45
  base_dir_config = @config_store.for(base_dir)
48
46
 
49
- target_files = if base_dir.include?(HIDDEN_PATH_SUBSTRING)
47
+ target_files = if hidden_path?(base_dir)
50
48
  all_files.select { |file| ruby_file?(file) }
51
49
  else
52
- all_files.select { |file| to_inspect?(file, hidden_files, base_dir_config) }
50
+ all_files.select { |file| to_inspect?(file, base_dir_config) }
53
51
  end
54
52
 
55
53
  target_files.sort_by!(&order)
@@ -74,18 +72,20 @@ module RuboCop
74
72
 
75
73
  private
76
74
 
77
- def to_inspect?(file, hidden_files, base_dir_config)
75
+ def to_inspect?(file, base_dir_config)
78
76
  return false if base_dir_config.file_to_exclude?(file)
79
- return true if !hidden_files.bsearch do |hidden_file|
80
- file <=> hidden_file
81
- end && ruby_file?(file)
77
+ return true if !hidden_path?(file) && ruby_file?(file)
82
78
 
83
79
  base_dir_config.file_to_include?(file)
84
80
  end
85
81
 
82
+ def hidden_path?(path)
83
+ path.include?(HIDDEN_PATH_SUBSTRING)
84
+ end
85
+
86
86
  def wanted_dir_patterns(base_dir, exclude_pattern, flags)
87
87
  # Escape glob characters in base_dir to avoid unwanted behavior.
88
- base_dir = base_dir.gsub(/[\\\{\}\[\]\*\?]/) do |reserved_glob_character|
88
+ base_dir = base_dir.gsub(/[\\{}\[\]*?]/) do |reserved_glob_character|
89
89
  "\\#{reserved_glob_character}"
90
90
  end
91
91
 
@@ -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.80.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,7 +1,7 @@
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.80.1
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-28 00:00:00.000000000 Z
12
+ date: 2025-08-27 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.46.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.46.0
141
141
  - - "<"
142
142
  - !ruby/object:Gem::Version
143
143
  version: '2.0'
@@ -265,6 +265,7 @@ files:
265
265
  - lib/rubocop/cop/exclude_limit.rb
266
266
  - lib/rubocop/cop/force.rb
267
267
  - lib/rubocop/cop/gemspec/add_runtime_dependency.rb
268
+ - lib/rubocop/cop/gemspec/attribute_assignment.rb
268
269
  - lib/rubocop/cop/gemspec/dependency_version.rb
269
270
  - lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
270
271
  - lib/rubocop/cop/gemspec/development_dependencies.rb
@@ -341,6 +342,7 @@ files:
341
342
  - lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb
342
343
  - lib/rubocop/cop/layout/empty_line_between_defs.rb
343
344
  - lib/rubocop/cop/layout/empty_lines.rb
345
+ - lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb
344
346
  - lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb
345
347
  - lib/rubocop/cop/layout/empty_lines_around_arguments.rb
346
348
  - lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
@@ -561,14 +563,17 @@ files:
561
563
  - lib/rubocop/cop/lint/useless_access_modifier.rb
562
564
  - lib/rubocop/cop/lint/useless_assignment.rb
563
565
  - lib/rubocop/cop/lint/useless_constant_scoping.rb
566
+ - lib/rubocop/cop/lint/useless_default_value_argument.rb
564
567
  - lib/rubocop/cop/lint/useless_defined.rb
565
568
  - lib/rubocop/cop/lint/useless_else_without_rescue.rb
566
569
  - lib/rubocop/cop/lint/useless_method_definition.rb
567
570
  - lib/rubocop/cop/lint/useless_numeric_operation.rb
571
+ - lib/rubocop/cop/lint/useless_or.rb
568
572
  - lib/rubocop/cop/lint/useless_rescue.rb
569
573
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
570
574
  - lib/rubocop/cop/lint/useless_setter_call.rb
571
575
  - lib/rubocop/cop/lint/useless_times.rb
576
+ - lib/rubocop/cop/lint/utils/nil_receiver_checker.rb
572
577
  - lib/rubocop/cop/lint/void.rb
573
578
  - lib/rubocop/cop/message_annotator.rb
574
579
  - lib/rubocop/cop/metrics/abc_size.rb
@@ -679,7 +684,8 @@ files:
679
684
  - lib/rubocop/cop/naming/memoized_instance_variable_name.rb
680
685
  - lib/rubocop/cop/naming/method_name.rb
681
686
  - lib/rubocop/cop/naming/method_parameter_name.rb
682
- - lib/rubocop/cop/naming/predicate_name.rb
687
+ - lib/rubocop/cop/naming/predicate_method.rb
688
+ - lib/rubocop/cop/naming/predicate_prefix.rb
683
689
  - lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb
684
690
  - lib/rubocop/cop/naming/variable_name.rb
685
691
  - lib/rubocop/cop/naming/variable_number.rb
@@ -724,6 +730,7 @@ files:
724
730
  - lib/rubocop/cop/style/class_vars.rb
725
731
  - lib/rubocop/cop/style/collection_compact.rb
726
732
  - lib/rubocop/cop/style/collection_methods.rb
733
+ - lib/rubocop/cop/style/collection_querying.rb
727
734
  - lib/rubocop/cop/style/colon_method_call.rb
728
735
  - lib/rubocop/cop/style/colon_method_definition.rb
729
736
  - lib/rubocop/cop/style/combinable_defined.rb
@@ -758,6 +765,7 @@ files:
758
765
  - lib/rubocop/cop/style/empty_lambda_parameter.rb
759
766
  - lib/rubocop/cop/style/empty_literal.rb
760
767
  - lib/rubocop/cop/style/empty_method.rb
768
+ - lib/rubocop/cop/style/empty_string_inside_interpolation.rb
761
769
  - lib/rubocop/cop/style/encoding.rb
762
770
  - lib/rubocop/cop/style/end_block.rb
763
771
  - lib/rubocop/cop/style/endless_method.rb
@@ -878,6 +886,7 @@ files:
878
886
  - lib/rubocop/cop/style/random_with_offset.rb
879
887
  - lib/rubocop/cop/style/redundant_argument.rb
880
888
  - lib/rubocop/cop/style/redundant_array_constructor.rb
889
+ - lib/rubocop/cop/style/redundant_array_flatten.rb
881
890
  - lib/rubocop/cop/style/redundant_assignment.rb
882
891
  - lib/rubocop/cop/style/redundant_begin.rb
883
892
  - lib/rubocop/cop/style/redundant_capital_w.rb
@@ -1033,6 +1042,7 @@ files:
1033
1042
  - lib/rubocop/name_similarity.rb
1034
1043
  - lib/rubocop/options.rb
1035
1044
  - lib/rubocop/path_util.rb
1045
+ - lib/rubocop/pending_cops_reporter.rb
1036
1046
  - lib/rubocop/platform.rb
1037
1047
  - lib/rubocop/plugin.rb
1038
1048
  - lib/rubocop/plugin/configuration_integrator.rb
@@ -1080,9 +1090,9 @@ licenses:
1080
1090
  - MIT
1081
1091
  metadata:
1082
1092
  homepage_uri: https://rubocop.org/
1083
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.75.8
1093
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.80.1
1084
1094
  source_code_uri: https://github.com/rubocop/rubocop/
1085
- documentation_uri: https://docs.rubocop.org/rubocop/1.75/
1095
+ documentation_uri: https://docs.rubocop.org/rubocop/1.80/
1086
1096
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1087
1097
  rubygems_mfa_required: 'true'
1088
1098
  rdoc_options: []