rubocop 1.50.2 → 1.54.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/config/default.yml +80 -6
  4. data/lib/rubocop/cli/command/lsp.rb +19 -0
  5. data/lib/rubocop/cli.rb +3 -0
  6. data/lib/rubocop/config.rb +4 -0
  7. data/lib/rubocop/config_loader_resolver.rb +4 -3
  8. data/lib/rubocop/config_obsoletion.rb +2 -2
  9. data/lib/rubocop/cop/base.rb +5 -1
  10. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  11. data/lib/rubocop/cop/bundler/gem_version.rb +2 -2
  12. data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
  13. data/lib/rubocop/cop/gemspec/dependency_version.rb +2 -2
  14. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  15. data/lib/rubocop/cop/internal_affairs/cop_description.rb +32 -8
  16. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
  17. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +5 -5
  18. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  19. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
  20. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +27 -4
  21. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
  22. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -2
  23. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  24. data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
  25. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
  26. data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
  27. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  28. data/lib/rubocop/cop/layout/space_around_operators.rb +3 -1
  29. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +2 -0
  30. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  31. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -1
  32. data/lib/rubocop/cop/lint/debugger.rb +9 -5
  33. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
  34. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
  35. data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -4
  36. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  37. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  38. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
  39. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  40. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  41. data/lib/rubocop/cop/lint/missing_super.rb +34 -5
  42. data/lib/rubocop/cop/lint/mixed_case_range.rb +111 -0
  43. data/lib/rubocop/cop/lint/number_conversion.rb +5 -0
  44. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
  45. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
  46. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -2
  47. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  48. data/lib/rubocop/cop/lint/redundant_require_statement.rb +8 -3
  49. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
  50. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
  51. data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
  52. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  53. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  54. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
  55. data/lib/rubocop/cop/lint/useless_assignment.rb +59 -1
  56. data/lib/rubocop/cop/lint/void.rb +57 -7
  57. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
  58. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +30 -2
  59. data/lib/rubocop/cop/migration/department_name.rb +2 -2
  60. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  61. data/lib/rubocop/cop/mixin/comments_help.rb +7 -3
  62. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  63. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  64. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  65. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  66. data/lib/rubocop/cop/naming/block_forwarding.rb +1 -1
  67. data/lib/rubocop/cop/naming/constant_name.rb +1 -1
  68. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +25 -10
  69. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +11 -3
  70. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  71. data/lib/rubocop/cop/style/accessor_grouping.rb +5 -1
  72. data/lib/rubocop/cop/style/attr.rb +11 -1
  73. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  74. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  75. data/lib/rubocop/cop/style/block_delimiters.rb +3 -3
  76. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  77. data/lib/rubocop/cop/style/class_equality_comparison.rb +17 -39
  78. data/lib/rubocop/cop/style/collection_compact.rb +16 -6
  79. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  80. data/lib/rubocop/cop/style/combinable_loops.rb +26 -6
  81. data/lib/rubocop/cop/style/conditional_assignment.rb +5 -3
  82. data/lib/rubocop/cop/style/copyright.rb +5 -2
  83. data/lib/rubocop/cop/style/dir.rb +1 -1
  84. data/lib/rubocop/cop/style/dir_empty.rb +8 -14
  85. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  86. data/lib/rubocop/cop/style/documentation.rb +1 -1
  87. data/lib/rubocop/cop/style/eval_with_location.rb +5 -5
  88. data/lib/rubocop/cop/style/exact_regexp_match.rb +68 -0
  89. data/lib/rubocop/cop/style/file_read.rb +2 -2
  90. data/lib/rubocop/cop/style/guard_clause.rb +2 -0
  91. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -22
  92. data/lib/rubocop/cop/style/hash_except.rb +19 -8
  93. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  94. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  95. data/lib/rubocop/cop/style/identical_conditional_branches.rb +6 -2
  96. data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
  97. data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -0
  98. data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -2
  99. data/lib/rubocop/cop/style/invertible_unless_condition.rb +10 -6
  100. data/lib/rubocop/cop/style/lambda.rb +3 -3
  101. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +3 -4
  102. data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
  103. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  104. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  105. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  106. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  107. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  108. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
  109. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +38 -0
  110. data/lib/rubocop/cop/style/redundant_filter_chain.rb +101 -0
  111. data/lib/rubocop/cop/style/redundant_line_continuation.rb +7 -3
  112. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  113. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  114. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  115. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -1
  116. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +3 -1
  117. data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
  118. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -0
  119. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  120. data/lib/rubocop/cop/style/require_order.rb +11 -5
  121. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -3
  122. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +81 -0
  123. data/lib/rubocop/cop/style/select_by_regexp.rb +15 -5
  124. data/lib/rubocop/cop/style/semicolon.rb +12 -1
  125. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  126. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  127. data/lib/rubocop/cop/style/sole_nested_conditional.rb +3 -1
  128. data/lib/rubocop/cop/style/special_global_vars.rb +3 -4
  129. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  130. data/lib/rubocop/cop/style/yoda_condition.rb +4 -2
  131. data/lib/rubocop/cop/team.rb +1 -1
  132. data/lib/rubocop/cop/util.rb +1 -1
  133. data/lib/rubocop/cop/utils/regexp_ranges.rb +100 -0
  134. data/lib/rubocop/cop/variable_force/assignment.rb +47 -4
  135. data/lib/rubocop/cop/variable_force/variable_table.rb +2 -2
  136. data/lib/rubocop/cop/variable_force.rb +1 -0
  137. data/lib/rubocop/cops_documentation_generator.rb +1 -1
  138. data/lib/rubocop/ext/regexp_parser.rb +4 -1
  139. data/lib/rubocop/lsp/logger.rb +22 -0
  140. data/lib/rubocop/lsp/routes.rb +231 -0
  141. data/lib/rubocop/lsp/runtime.rb +82 -0
  142. data/lib/rubocop/lsp/server.rb +66 -0
  143. data/lib/rubocop/lsp/severity.rb +27 -0
  144. data/lib/rubocop/options.rb +11 -1
  145. data/lib/rubocop/result_cache.rb +1 -1
  146. data/lib/rubocop/rspec/cop_helper.rb +1 -1
  147. data/lib/rubocop/server/client_command/exec.rb +2 -1
  148. data/lib/rubocop/target_ruby.rb +3 -2
  149. data/lib/rubocop/version.rb +10 -6
  150. data/lib/rubocop.rb +13 -0
  151. metadata +38 -6
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'language_server-protocol'
4
+ require_relative 'logger'
5
+ require_relative 'routes'
6
+ require_relative 'runtime'
7
+
8
+ #
9
+ # This code is based on https://github.com/standardrb/standard.
10
+ #
11
+ # Copyright (c) 2023 Test Double, Inc.
12
+ #
13
+ # The MIT License (MIT)
14
+ #
15
+ # https://github.com/standardrb/standard/blob/main/LICENSE.txt
16
+ #
17
+ module RuboCop
18
+ module Lsp
19
+ # Language Server Protocol of RuboCop.
20
+ # @api private
21
+ class Server
22
+ def initialize(config_store)
23
+ @reader = LanguageServer::Protocol::Transport::Io::Reader.new($stdin)
24
+ @writer = LanguageServer::Protocol::Transport::Io::Writer.new($stdout)
25
+ @runtime = RuboCop::Lsp::Runtime.new(config_store)
26
+ @routes = Routes.new(self)
27
+ end
28
+
29
+ def start
30
+ @reader.read do |request|
31
+ if !request.key?(:method)
32
+ @routes.handle_method_missing(request)
33
+ elsif (route = @routes.for(request[:method]))
34
+ route.call(request)
35
+ else
36
+ @routes.handle_unsupported_method(request)
37
+ end
38
+ rescue StandardError => e
39
+ Logger.log("Error #{e.class} #{e.message[0..100]}")
40
+ Logger.log(e.backtrace.inspect)
41
+ end
42
+ end
43
+
44
+ def write(response)
45
+ @writer.write(response)
46
+ end
47
+
48
+ def format(path, text)
49
+ @runtime.format(path, text)
50
+ end
51
+
52
+ def offenses(path, text)
53
+ @runtime.offenses(path, text)
54
+ end
55
+
56
+ def configure(safe_autocorrect: true)
57
+ @runtime.safe_autocorrect = safe_autocorrect
58
+ end
59
+
60
+ def stop(&block)
61
+ at_exit(&block) if block
62
+ exit
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Lsp
5
+ # Severity for Language Server Protocol of RuboCop.
6
+ # @api private
7
+ class Severity
8
+ SEVERITIES = {
9
+ fatal: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
10
+ error: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
11
+ warning: LanguageServer::Protocol::Constant::DiagnosticSeverity::WARNING,
12
+ convention: LanguageServer::Protocol::Constant::DiagnosticSeverity::INFORMATION,
13
+ refactor: LanguageServer::Protocol::Constant::DiagnosticSeverity::HINT,
14
+ info: LanguageServer::Protocol::Constant::DiagnosticSeverity::HINT
15
+ }.freeze
16
+
17
+ def self.find_by(rubocop_severity)
18
+ if (severity = SEVERITIES[rubocop_severity.to_sym])
19
+ return severity
20
+ end
21
+
22
+ Logger.log("Unknown severity: #{rubocop_severity}")
23
+ LanguageServer::Protocol::Constant::DiagnosticSeverity::HINT
24
+ end
25
+ end
26
+ end
27
+ end
@@ -16,7 +16,7 @@ module RuboCop
16
16
  'root of the project. RuboCop will use this path to determine which ' \
17
17
  'cops are enabled (via eg. Include/Exclude), and so that certain cops ' \
18
18
  'like Naming/FileName can be checked.'
19
- EXITING_OPTIONS = %i[version verbose_version show_cops show_docs_url].freeze
19
+ EXITING_OPTIONS = %i[version verbose_version show_cops show_docs_url lsp].freeze
20
20
  DEFAULT_MAXIMUM_EXCLUSION_ITEMS = 15
21
21
 
22
22
  def initialize
@@ -49,12 +49,14 @@ module RuboCop
49
49
 
50
50
  private
51
51
 
52
+ # rubocop:disable Metrics/AbcSize
52
53
  def define_options
53
54
  OptionParser.new do |opts|
54
55
  opts.banner = rainbow.wrap('Usage: rubocop [options] [file1, file2, ...]').bright
55
56
 
56
57
  add_check_options(opts)
57
58
  add_cache_options(opts)
59
+ add_lsp_option(opts)
58
60
  add_server_options(opts)
59
61
  add_output_options(opts)
60
62
  add_autocorrection_options(opts)
@@ -66,6 +68,7 @@ module RuboCop
66
68
  add_profile_options(opts) if RUBY_ENGINE == 'ruby' && !Platform.windows?
67
69
  end
68
70
  end
71
+ # rubocop:enable Metrics/AbcSize
69
72
 
70
73
  def add_check_options(opts) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
71
74
  section(opts, 'Basic Options') do # rubocop:disable Metrics/BlockLength
@@ -205,6 +208,12 @@ module RuboCop
205
208
  end
206
209
  end
207
210
 
211
+ def add_lsp_option(opts)
212
+ section(opts, 'LSP Option') do
213
+ option(opts, '--lsp')
214
+ end
215
+ end
216
+
208
217
  def add_server_options(opts)
209
218
  section(opts, 'Server Options') do
210
219
  option(opts, '--[no-]server')
@@ -620,6 +629,7 @@ module RuboCop
620
629
  stop_server: 'Stop server process.',
621
630
  server_status: 'Show server status.',
622
631
  no_detach: 'Run the server process in the foreground.',
632
+ lsp: 'Start a language server listening on STDIN.',
623
633
  raise_cop_error: ['Raise cop-related errors with cause and location.',
624
634
  'This is used to prevent cops from failing silently.',
625
635
  'Default is false.'],
@@ -83,7 +83,7 @@ module RuboCop
83
83
  config_store.for_pwd.for_all_cops['AllowSymlinksInCacheRootDirectory']
84
84
  end
85
85
 
86
- attr :path
86
+ attr_reader :path
87
87
 
88
88
  def initialize(file, team, options, config_store, cache_root = nil)
89
89
  cache_root ||= File.join(options[:cache_root], 'rubocop_cache') if options[:cache_root]
@@ -6,7 +6,7 @@ require 'tempfile'
6
6
  module CopHelper
7
7
  extend RSpec::SharedContext
8
8
 
9
- let(:ruby_version) { 2.6 }
9
+ let(:ruby_version) { RuboCop::TargetRuby::DEFAULT_VERSION }
10
10
  let(:rails_version) { false }
11
11
 
12
12
  def inspect_source(source, file = nil)
@@ -18,10 +18,11 @@ module RuboCop
18
18
  def run
19
19
  ensure_server!
20
20
  Cache.status_path.delete if Cache.status_path.file?
21
+ read_stdin = ARGV.include?('-s') || ARGV.include?('--stdin')
21
22
  send_request(
22
23
  command: 'exec',
23
24
  args: ARGV.dup,
24
- body: $stdin.tty? ? '' : $stdin.read
25
+ body: read_stdin ? $stdin.read : ''
25
26
  )
26
27
  warn stderr unless stderr.empty?
27
28
  status
@@ -5,7 +5,7 @@ module RuboCop
5
5
  # @api private
6
6
  class TargetRuby
7
7
  KNOWN_RUBIES = [2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3].freeze
8
- DEFAULT_VERSION = 2.6
8
+ DEFAULT_VERSION = 2.7
9
9
 
10
10
  OBSOLETE_RUBIES = {
11
11
  1.9 => '0.41',
@@ -14,7 +14,8 @@ module RuboCop
14
14
  2.2 => '0.68',
15
15
  2.3 => '0.81',
16
16
  2.4 => '1.12',
17
- 2.5 => '1.28'
17
+ 2.5 => '1.28',
18
+ 2.6 => '1.50'
18
19
  }.freeze
19
20
  private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES
20
21
 
@@ -3,15 +3,19 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.50.2'
6
+ STRING = '1.54.1'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
10
10
  'running on %<ruby_engine>s %<ruby_version>s)%<server_mode>s [%<ruby_platform>s]'
11
11
 
12
- CANONICAL_FEATURE_NAMES = { 'Rspec' => 'RSpec', 'Graphql' => 'GraphQL', 'Md' => 'Markdown',
13
- 'Thread_safety' => 'ThreadSafety' }.freeze
14
- EXTENSION_PATH_NAMES = { 'rubocop-md' => 'markdown' }.freeze
12
+ CANONICAL_FEATURE_NAMES = {
13
+ 'Rspec' => 'RSpec', 'Graphql' => 'GraphQL', 'Md' => 'Markdown', 'Factory_bot' => 'FactoryBot',
14
+ 'Thread_safety' => 'ThreadSafety'
15
+ }.freeze
16
+ EXTENSION_PATH_NAMES = {
17
+ 'rubocop-md' => 'markdown', 'rubocop-factory_bot' => 'factory_bot'
18
+ }.freeze
15
19
 
16
20
  # @api private
17
21
  def self.version(debug: false, env: nil)
@@ -43,7 +47,7 @@ module RuboCop
43
47
  env.config_store.unvalidated.for_pwd.loaded_features.sort
44
48
  end
45
49
 
46
- features.map do |loaded_feature|
50
+ features.filter_map do |loaded_feature|
47
51
  next unless (match = loaded_feature.match(/rubocop-(?<feature>.*)/))
48
52
 
49
53
  # Get the expected name of the folder containing the extension code.
@@ -61,7 +65,7 @@ module RuboCop
61
65
  next unless (feature_version = feature_version(feature))
62
66
 
63
67
  " - #{loaded_feature} #{feature_version}"
64
- end.compact
68
+ end
65
69
  end
66
70
 
67
71
  # Returns feature version in one of two ways:
data/lib/rubocop.rb CHANGED
@@ -69,6 +69,7 @@ require_relative 'rubocop/cop/mixin/alignment'
69
69
  require_relative 'rubocop/cop/mixin/allowed_identifiers'
70
70
  require_relative 'rubocop/cop/mixin/allowed_methods'
71
71
  require_relative 'rubocop/cop/mixin/allowed_pattern'
72
+ require_relative 'rubocop/cop/mixin/allowed_receivers'
72
73
  require_relative 'rubocop/cop/mixin/auto_corrector' # rubocop:todo Naming/InclusiveLanguage
73
74
  require_relative 'rubocop/cop/mixin/check_assignment'
74
75
  require_relative 'rubocop/cop/mixin/check_line_breakable'
@@ -138,6 +139,7 @@ require_relative 'rubocop/cop/mixin/comments_help' # relies on visibility_help
138
139
  require_relative 'rubocop/cop/mixin/def_node' # relies on visibility_help
139
140
 
140
141
  require_relative 'rubocop/cop/utils/format_string'
142
+ require_relative 'rubocop/cop/utils/regexp_ranges'
141
143
 
142
144
  require_relative 'rubocop/cop/migration/department_name'
143
145
 
@@ -335,6 +337,7 @@ require_relative 'rubocop/cop/lint/literal_in_interpolation'
335
337
  require_relative 'rubocop/cop/lint/loop'
336
338
  require_relative 'rubocop/cop/lint/missing_cop_enable_directive'
337
339
  require_relative 'rubocop/cop/lint/missing_super'
340
+ require_relative 'rubocop/cop/lint/mixed_case_range'
338
341
  require_relative 'rubocop/cop/lint/mixed_regexp_capture_types'
339
342
  require_relative 'rubocop/cop/lint/multiple_comparison'
340
343
  require_relative 'rubocop/cop/lint/nested_method_definition'
@@ -357,6 +360,7 @@ require_relative 'rubocop/cop/lint/rand_one'
357
360
  require_relative 'rubocop/cop/lint/redundant_cop_disable_directive'
358
361
  require_relative 'rubocop/cop/lint/redundant_cop_enable_directive'
359
362
  require_relative 'rubocop/cop/lint/redundant_dir_glob_sort'
363
+ require_relative 'rubocop/cop/lint/redundant_regexp_quantifiers'
360
364
  require_relative 'rubocop/cop/lint/redundant_require_statement'
361
365
  require_relative 'rubocop/cop/lint/redundant_safe_navigation'
362
366
  require_relative 'rubocop/cop/lint/redundant_splat_expansion'
@@ -507,6 +511,7 @@ require_relative 'rubocop/cop/style/end_block'
507
511
  require_relative 'rubocop/cop/style/env_home'
508
512
  require_relative 'rubocop/cop/style/eval_with_location'
509
513
  require_relative 'rubocop/cop/style/even_odd'
514
+ require_relative 'rubocop/cop/style/exact_regexp_match'
510
515
  require_relative 'rubocop/cop/style/expand_path_arguments'
511
516
  require_relative 'rubocop/cop/style/explicit_block_argument'
512
517
  require_relative 'rubocop/cop/style/exponential_notation'
@@ -557,15 +562,20 @@ require_relative 'rubocop/cop/style/multiline_in_pattern_then'
557
562
  require_relative 'rubocop/cop/style/numbered_parameters'
558
563
  require_relative 'rubocop/cop/style/open_struct_use'
559
564
  require_relative 'rubocop/cop/style/operator_method_call'
565
+ require_relative 'rubocop/cop/style/redundant_array_constructor'
560
566
  require_relative 'rubocop/cop/style/redundant_assignment'
561
567
  require_relative 'rubocop/cop/style/redundant_constant_base'
568
+ require_relative 'rubocop/cop/style/redundant_current_directory_in_path'
562
569
  require_relative 'rubocop/cop/style/redundant_double_splat_hash_braces'
563
570
  require_relative 'rubocop/cop/style/redundant_each'
564
571
  require_relative 'rubocop/cop/style/redundant_fetch_block'
565
572
  require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
573
+ require_relative 'rubocop/cop/style/redundant_filter_chain'
566
574
  require_relative 'rubocop/cop/style/redundant_heredoc_delimiter_quotes'
567
575
  require_relative 'rubocop/cop/style/redundant_initialize'
568
576
  require_relative 'rubocop/cop/style/redundant_line_continuation'
577
+ require_relative 'rubocop/cop/style/redundant_regexp_argument'
578
+ require_relative 'rubocop/cop/style/redundant_regexp_constructor'
569
579
  require_relative 'rubocop/cop/style/redundant_self_assignment'
570
580
  require_relative 'rubocop/cop/style/redundant_self_assignment_branch'
571
581
  require_relative 'rubocop/cop/style/require_order'
@@ -643,6 +653,7 @@ require_relative 'rubocop/cop/style/regexp_literal'
643
653
  require_relative 'rubocop/cop/style/rescue_modifier'
644
654
  require_relative 'rubocop/cop/style/rescue_standard_error'
645
655
  require_relative 'rubocop/cop/style/return_nil'
656
+ require_relative 'rubocop/cop/style/return_nil_in_predicate_method_definition'
646
657
  require_relative 'rubocop/cop/style/safe_navigation'
647
658
  require_relative 'rubocop/cop/style/sample'
648
659
  require_relative 'rubocop/cop/style/select_by_regexp'
@@ -689,6 +700,7 @@ require_relative 'rubocop/cop/style/when_then'
689
700
  require_relative 'rubocop/cop/style/while_until_do'
690
701
  require_relative 'rubocop/cop/style/while_until_modifier'
691
702
  require_relative 'rubocop/cop/style/word_array'
703
+ require_relative 'rubocop/cop/style/yaml_file_read'
692
704
  require_relative 'rubocop/cop/style/yoda_condition'
693
705
  require_relative 'rubocop/cop/style/yoda_expression'
694
706
  require_relative 'rubocop/cop/style/zero_length_predicate'
@@ -734,6 +746,7 @@ require_relative 'rubocop/cli/command/base'
734
746
  require_relative 'rubocop/cli/command/auto_generate_config'
735
747
  require_relative 'rubocop/cli/command/execute_runner'
736
748
  require_relative 'rubocop/cli/command/init_dotfile'
749
+ require_relative 'rubocop/cli/command/lsp'
737
750
  require_relative 'rubocop/cli/command/show_cops'
738
751
  require_relative 'rubocop/cli/command/show_docs_url'
739
752
  require_relative 'rubocop/cli/command/suggest_extensions'
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.50.2
4
+ version: 1.54.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-04-17 00:00:00.000000000 Z
13
+ date: 2023-07-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: language_server-protocol
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 3.17.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.17.0
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: parallel
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +60,14 @@ dependencies:
46
60
  requirements:
47
61
  - - ">="
48
62
  - !ruby/object:Gem::Version
49
- version: 3.2.0.0
63
+ version: 3.2.2.3
50
64
  type: :runtime
51
65
  prerelease: false
52
66
  version_requirements: !ruby/object:Gem::Requirement
53
67
  requirements:
54
68
  - - ">="
55
69
  - !ruby/object:Gem::Version
56
- version: 3.2.0.0
70
+ version: 3.2.2.3
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: rainbow
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +212,7 @@ files:
198
212
  - lib/rubocop/cli/command/base.rb
199
213
  - lib/rubocop/cli/command/execute_runner.rb
200
214
  - lib/rubocop/cli/command/init_dotfile.rb
215
+ - lib/rubocop/cli/command/lsp.rb
201
216
  - lib/rubocop/cli/command/show_cops.rb
202
217
  - lib/rubocop/cli/command/show_docs_url.rb
203
218
  - lib/rubocop/cli/command/suggest_extensions.rb
@@ -456,6 +471,7 @@ files:
456
471
  - lib/rubocop/cop/lint/loop.rb
457
472
  - lib/rubocop/cop/lint/missing_cop_enable_directive.rb
458
473
  - lib/rubocop/cop/lint/missing_super.rb
474
+ - lib/rubocop/cop/lint/mixed_case_range.rb
459
475
  - lib/rubocop/cop/lint/mixed_regexp_capture_types.rb
460
476
  - lib/rubocop/cop/lint/multiple_comparison.rb
461
477
  - lib/rubocop/cop/lint/nested_method_definition.rb
@@ -478,6 +494,7 @@ files:
478
494
  - lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
479
495
  - lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
480
496
  - lib/rubocop/cop/lint/redundant_dir_glob_sort.rb
497
+ - lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb
481
498
  - lib/rubocop/cop/lint/redundant_require_statement.rb
482
499
  - lib/rubocop/cop/lint/redundant_safe_navigation.rb
483
500
  - lib/rubocop/cop/lint/redundant_splat_expansion.rb
@@ -550,6 +567,7 @@ files:
550
567
  - lib/rubocop/cop/mixin/allowed_identifiers.rb
551
568
  - lib/rubocop/cop/mixin/allowed_methods.rb
552
569
  - lib/rubocop/cop/mixin/allowed_pattern.rb
570
+ - lib/rubocop/cop/mixin/allowed_receivers.rb
553
571
  - lib/rubocop/cop/mixin/annotation_comment.rb
554
572
  - lib/rubocop/cop/mixin/array_min_size.rb
555
573
  - lib/rubocop/cop/mixin/array_syntax.rb
@@ -710,6 +728,7 @@ files:
710
728
  - lib/rubocop/cop/style/env_home.rb
711
729
  - lib/rubocop/cop/style/eval_with_location.rb
712
730
  - lib/rubocop/cop/style/even_odd.rb
731
+ - lib/rubocop/cop/style/exact_regexp_match.rb
713
732
  - lib/rubocop/cop/style/expand_path_arguments.rb
714
733
  - lib/rubocop/cop/style/explicit_block_argument.rb
715
734
  - lib/rubocop/cop/style/exponential_notation.rb
@@ -814,17 +833,20 @@ files:
814
833
  - lib/rubocop/cop/style/raise_args.rb
815
834
  - lib/rubocop/cop/style/random_with_offset.rb
816
835
  - lib/rubocop/cop/style/redundant_argument.rb
836
+ - lib/rubocop/cop/style/redundant_array_constructor.rb
817
837
  - lib/rubocop/cop/style/redundant_assignment.rb
818
838
  - lib/rubocop/cop/style/redundant_begin.rb
819
839
  - lib/rubocop/cop/style/redundant_capital_w.rb
820
840
  - lib/rubocop/cop/style/redundant_condition.rb
821
841
  - lib/rubocop/cop/style/redundant_conditional.rb
822
842
  - lib/rubocop/cop/style/redundant_constant_base.rb
843
+ - lib/rubocop/cop/style/redundant_current_directory_in_path.rb
823
844
  - lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb
824
845
  - lib/rubocop/cop/style/redundant_each.rb
825
846
  - lib/rubocop/cop/style/redundant_exception.rb
826
847
  - lib/rubocop/cop/style/redundant_fetch_block.rb
827
848
  - lib/rubocop/cop/style/redundant_file_extension_in_require.rb
849
+ - lib/rubocop/cop/style/redundant_filter_chain.rb
828
850
  - lib/rubocop/cop/style/redundant_freeze.rb
829
851
  - lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
830
852
  - lib/rubocop/cop/style/redundant_initialize.rb
@@ -832,7 +854,9 @@ files:
832
854
  - lib/rubocop/cop/style/redundant_line_continuation.rb
833
855
  - lib/rubocop/cop/style/redundant_parentheses.rb
834
856
  - lib/rubocop/cop/style/redundant_percent_q.rb
857
+ - lib/rubocop/cop/style/redundant_regexp_argument.rb
835
858
  - lib/rubocop/cop/style/redundant_regexp_character_class.rb
859
+ - lib/rubocop/cop/style/redundant_regexp_constructor.rb
836
860
  - lib/rubocop/cop/style/redundant_regexp_escape.rb
837
861
  - lib/rubocop/cop/style/redundant_return.rb
838
862
  - lib/rubocop/cop/style/redundant_self.rb
@@ -846,6 +870,7 @@ files:
846
870
  - lib/rubocop/cop/style/rescue_modifier.rb
847
871
  - lib/rubocop/cop/style/rescue_standard_error.rb
848
872
  - lib/rubocop/cop/style/return_nil.rb
873
+ - lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb
849
874
  - lib/rubocop/cop/style/safe_navigation.rb
850
875
  - lib/rubocop/cop/style/sample.rb
851
876
  - lib/rubocop/cop/style/select_by_regexp.rb
@@ -894,12 +919,14 @@ files:
894
919
  - lib/rubocop/cop/style/while_until_do.rb
895
920
  - lib/rubocop/cop/style/while_until_modifier.rb
896
921
  - lib/rubocop/cop/style/word_array.rb
922
+ - lib/rubocop/cop/style/yaml_file_read.rb
897
923
  - lib/rubocop/cop/style/yoda_condition.rb
898
924
  - lib/rubocop/cop/style/yoda_expression.rb
899
925
  - lib/rubocop/cop/style/zero_length_predicate.rb
900
926
  - lib/rubocop/cop/team.rb
901
927
  - lib/rubocop/cop/util.rb
902
928
  - lib/rubocop/cop/utils/format_string.rb
929
+ - lib/rubocop/cop/utils/regexp_ranges.rb
903
930
  - lib/rubocop/cop/variable_force.rb
904
931
  - lib/rubocop/cop/variable_force/assignment.rb
905
932
  - lib/rubocop/cop/variable_force/branch.rb
@@ -944,6 +971,11 @@ files:
944
971
  - lib/rubocop/formatter/text_util.rb
945
972
  - lib/rubocop/formatter/worst_offenders_formatter.rb
946
973
  - lib/rubocop/lockfile.rb
974
+ - lib/rubocop/lsp/logger.rb
975
+ - lib/rubocop/lsp/routes.rb
976
+ - lib/rubocop/lsp/runtime.rb
977
+ - lib/rubocop/lsp/server.rb
978
+ - lib/rubocop/lsp/severity.rb
947
979
  - lib/rubocop/magic_comment.rb
948
980
  - lib/rubocop/name_similarity.rb
949
981
  - lib/rubocop/options.rb
@@ -991,7 +1023,7 @@ metadata:
991
1023
  homepage_uri: https://rubocop.org/
992
1024
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
993
1025
  source_code_uri: https://github.com/rubocop/rubocop/
994
- documentation_uri: https://docs.rubocop.org/rubocop/1.50/
1026
+ documentation_uri: https://docs.rubocop.org/rubocop/1.54/
995
1027
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
996
1028
  rubygems_mfa_required: 'true'
997
1029
  post_install_message:
@@ -1002,7 +1034,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1002
1034
  requirements:
1003
1035
  - - ">="
1004
1036
  - !ruby/object:Gem::Version
1005
- version: 2.6.0
1037
+ version: 2.7.0
1006
1038
  required_rubygems_version: !ruby/object:Gem::Requirement
1007
1039
  requirements:
1008
1040
  - - ">="