rubocop 1.36.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +1 -1
 - data/config/default.yml +31 -3
 - data/lib/rubocop/arguments_env.rb +17 -0
 - data/lib/rubocop/arguments_file.rb +17 -0
 - data/lib/rubocop/cli/command/execute_runner.rb +7 -7
 - data/lib/rubocop/cli/command/suggest_extensions.rb +8 -1
 - data/lib/rubocop/comment_config.rb +36 -1
 - data/lib/rubocop/cop/commissioner.rb +3 -1
 - data/lib/rubocop/cop/generator.rb +1 -2
 - data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
 - data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
 - data/lib/rubocop/cop/internal_affairs.rb +2 -0
 - data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -0
 - data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
 - data/lib/rubocop/cop/layout/indentation_width.rb +1 -1
 - data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +29 -8
 - data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
 - data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +13 -9
 - data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
 - data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +30 -3
 - data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
 - data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +6 -2
 - data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
 - data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
 - data/lib/rubocop/cop/lint/duplicate_methods.rb +28 -9
 - data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +25 -6
 - data/lib/rubocop/cop/lint/empty_class.rb +3 -1
 - data/lib/rubocop/cop/lint/empty_conditional_body.rb +20 -8
 - data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +18 -3
 - data/lib/rubocop/cop/lint/nested_method_definition.rb +50 -1
 - data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
 - data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -5
 - data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +1 -1
 - data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +23 -1
 - data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
 - data/lib/rubocop/cop/lint/redundant_require_statement.rb +38 -10
 - data/lib/rubocop/cop/lint/require_parentheses.rb +1 -1
 - data/lib/rubocop/cop/lint/safe_navigation_chain.rb +3 -2
 - data/lib/rubocop/cop/lint/shadowed_exception.rb +0 -10
 - data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +3 -0
 - data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
 - data/lib/rubocop/cop/lint/unreachable_loop.rb +1 -1
 - data/lib/rubocop/cop/lint/unused_method_argument.rb +4 -0
 - data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
 - data/lib/rubocop/cop/mixin/comments_help.rb +12 -0
 - data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
 - data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +6 -3
 - data/lib/rubocop/cop/mixin/range_help.rb +23 -0
 - data/lib/rubocop/cop/mixin/rescue_node.rb +3 -1
 - data/lib/rubocop/cop/mixin/surrounding_space.rb +10 -8
 - data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
 - data/lib/rubocop/cop/naming/inclusive_language.rb +1 -1
 - data/lib/rubocop/cop/registry.rb +10 -4
 - data/lib/rubocop/cop/style/access_modifier_declarations.rb +5 -7
 - data/lib/rubocop/cop/style/accessor_grouping.rb +7 -3
 - data/lib/rubocop/cop/style/block_delimiters.rb +2 -2
 - data/lib/rubocop/cop/style/character_literal.rb +1 -1
 - data/lib/rubocop/cop/style/class_equality_comparison.rb +8 -6
 - data/lib/rubocop/cop/style/collection_compact.rb +12 -3
 - data/lib/rubocop/cop/style/empty_method.rb +1 -1
 - data/lib/rubocop/cop/style/endless_method.rb +1 -1
 - data/lib/rubocop/cop/style/explicit_block_argument.rb +4 -0
 - data/lib/rubocop/cop/style/format_string_token.rb +1 -1
 - data/lib/rubocop/cop/style/guard_clause.rb +62 -21
 - data/lib/rubocop/cop/style/hash_as_last_array_item.rb +1 -0
 - data/lib/rubocop/cop/style/hash_each_methods.rb +32 -10
 - data/lib/rubocop/cop/style/hash_except.rb +4 -0
 - data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
 - data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +25 -2
 - data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +13 -2
 - data/lib/rubocop/cop/style/module_function.rb +28 -6
 - data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -1
 - data/lib/rubocop/cop/style/numeric_predicate.rb +1 -1
 - data/lib/rubocop/cop/style/object_then.rb +3 -0
 - data/lib/rubocop/cop/style/operator_method_call.rb +53 -0
 - data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
 - data/lib/rubocop/cop/style/redundant_begin.rb +1 -0
 - data/lib/rubocop/cop/style/redundant_condition.rb +5 -2
 - data/lib/rubocop/cop/style/redundant_each.rb +116 -0
 - data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
 - data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +8 -1
 - data/lib/rubocop/cop/style/redundant_regexp_escape.rb +12 -3
 - data/lib/rubocop/cop/style/redundant_string_escape.rb +181 -0
 - data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
 - data/lib/rubocop/cop/style/static_class.rb +32 -1
 - data/lib/rubocop/cop/style/symbol_array.rb +2 -0
 - data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
 - data/lib/rubocop/cop/style/word_array.rb +2 -0
 - data/lib/rubocop/cop/team.rb +3 -4
 - data/lib/rubocop/cop/util.rb +1 -1
 - data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
 - data/lib/rubocop/cops_documentation_generator.rb +2 -1
 - data/lib/rubocop/ext/processed_source.rb +2 -0
 - data/lib/rubocop/formatter/disabled_config_formatter.rb +8 -2
 - data/lib/rubocop/formatter/offense_count_formatter.rb +8 -5
 - data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -3
 - data/lib/rubocop/options.rb +19 -15
 - data/lib/rubocop/rspec/cop_helper.rb +21 -1
 - data/lib/rubocop/rspec/shared_contexts.rb +14 -1
 - data/lib/rubocop/runner.rb +15 -11
 - data/lib/rubocop/server/cache.rb +5 -1
 - data/lib/rubocop/server/cli.rb +9 -2
 - data/lib/rubocop/server/client_command/exec.rb +5 -0
 - data/lib/rubocop/server/core.rb +18 -1
 - data/lib/rubocop/server/socket_reader.rb +5 -1
 - data/lib/rubocop/server.rb +1 -1
 - data/lib/rubocop/version.rb +8 -3
 - data/lib/rubocop.rb +4 -0
 - metadata +13 -5
 
    
        data/lib/rubocop/runner.rb
    CHANGED
    
    | 
         @@ -423,17 +423,21 @@ module RuboCop 
     | 
|
| 
       423 
423 
     | 
    
         
             
                end
         
     | 
| 
       424 
424 
     | 
    
         | 
| 
       425 
425 
     | 
    
         
             
                def get_processed_source(file)
         
     | 
| 
       426 
     | 
    
         
            -
                   
     | 
| 
       427 
     | 
    
         
            -
             
     | 
| 
       428 
     | 
    
         
            -
             
     | 
| 
       429 
     | 
    
         
            -
             
     | 
| 
       430 
     | 
    
         
            -
             
     | 
| 
       431 
     | 
    
         
            -
             
     | 
| 
       432 
     | 
    
         
            -
             
     | 
| 
       433 
     | 
    
         
            -
             
     | 
| 
       434 
     | 
    
         
            -
             
     | 
| 
       435 
     | 
    
         
            -
             
     | 
| 
       436 
     | 
    
         
            -
             
     | 
| 
      
 426 
     | 
    
         
            +
                  config = @config_store.for_file(file)
         
     | 
| 
      
 427 
     | 
    
         
            +
                  ruby_version = config.target_ruby_version
         
     | 
| 
      
 428 
     | 
    
         
            +
             
     | 
| 
      
 429 
     | 
    
         
            +
                  processed_source = if @options[:stdin]
         
     | 
| 
      
 430 
     | 
    
         
            +
                                       ProcessedSource.new(@options[:stdin], ruby_version, file)
         
     | 
| 
      
 431 
     | 
    
         
            +
                                     else
         
     | 
| 
      
 432 
     | 
    
         
            +
                                       begin
         
     | 
| 
      
 433 
     | 
    
         
            +
                                         ProcessedSource.from_file(file, ruby_version)
         
     | 
| 
      
 434 
     | 
    
         
            +
                                       rescue Errno::ENOENT
         
     | 
| 
      
 435 
     | 
    
         
            +
                                         raise RuboCop::Error, "No such file or directory: #{file}"
         
     | 
| 
      
 436 
     | 
    
         
            +
                                       end
         
     | 
| 
      
 437 
     | 
    
         
            +
                                     end
         
     | 
| 
      
 438 
     | 
    
         
            +
                  processed_source.config = config
         
     | 
| 
      
 439 
     | 
    
         
            +
                  processed_source.registry = mobilized_cop_classes(config)
         
     | 
| 
      
 440 
     | 
    
         
            +
                  processed_source
         
     | 
| 
       437 
441 
     | 
    
         
             
                end
         
     | 
| 
       438 
442 
     | 
    
         | 
| 
       439 
443 
     | 
    
         
             
                # A Cop::Team instance is stateful and may change when inspecting.
         
     | 
    
        data/lib/rubocop/server/cache.rb
    CHANGED
    
    | 
         @@ -103,9 +103,13 @@ module RuboCop 
     | 
|
| 
       103 
103 
     | 
    
         
             
                      dir.join('version')
         
     | 
| 
       104 
104 
     | 
    
         
             
                    end
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
      
 106 
     | 
    
         
            +
                    def stderr_path
         
     | 
| 
      
 107 
     | 
    
         
            +
                      dir.join('stderr')
         
     | 
| 
      
 108 
     | 
    
         
            +
                    end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
       106 
110 
     | 
    
         
             
                    def pid_running?
         
     | 
| 
       107 
111 
     | 
    
         
             
                      Process.kill(0, pid_path.read.to_i) == 1
         
     | 
| 
       108 
     | 
    
         
            -
                    rescue Errno::ESRCH
         
     | 
| 
      
 112 
     | 
    
         
            +
                    rescue Errno::ESRCH, Errno::ENOENT
         
     | 
| 
       109 
113 
     | 
    
         
             
                      false
         
     | 
| 
       110 
114 
     | 
    
         
             
                    end
         
     | 
| 
       111 
115 
     | 
    
         | 
    
        data/lib/rubocop/server/cli.rb
    CHANGED
    
    | 
         @@ -1,6 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'rainbow'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative '../arguments_env'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative '../arguments_file'
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            #
         
     | 
| 
       6 
8 
     | 
    
         
             
            # This code is based on https://github.com/fohte/rubocop-daemon.
         
     | 
| 
         @@ -29,7 +31,7 @@ module RuboCop 
     | 
|
| 
       29 
31 
     | 
    
         
             
                    @exit = false
         
     | 
| 
       30 
32 
     | 
    
         
             
                  end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                  # rubocop:disable Metrics/MethodLength
         
     | 
| 
      
 34 
     | 
    
         
            +
                  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
         
     | 
| 
       33 
35 
     | 
    
         
             
                  def run(argv = ARGV)
         
     | 
| 
       34 
36 
     | 
    
         
             
                    unless Server.support_server?
         
     | 
| 
       35 
37 
     | 
    
         
             
                      return error('RuboCop server is not supported by this Ruby.') if use_server_option?(argv)
         
     | 
| 
         @@ -50,11 +52,16 @@ module RuboCop 
     | 
|
| 
       50 
52 
     | 
    
         
             
                      return error("#{server_command} cannot be combined with other options.")
         
     | 
| 
       51 
53 
     | 
    
         
             
                    end
         
     | 
| 
       52 
54 
     | 
    
         | 
| 
      
 55 
     | 
    
         
            +
                    if server_command.nil?
         
     | 
| 
      
 56 
     | 
    
         
            +
                      server_command = ArgumentsEnv.read_as_arguments.delete('--server') ||
         
     | 
| 
      
 57 
     | 
    
         
            +
                                       ArgumentsFile.read_as_arguments.delete('--server')
         
     | 
| 
      
 58 
     | 
    
         
            +
                    end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       53 
60 
     | 
    
         
             
                    run_command(server_command)
         
     | 
| 
       54 
61 
     | 
    
         | 
| 
       55 
62 
     | 
    
         
             
                    STATUS_SUCCESS
         
     | 
| 
       56 
63 
     | 
    
         
             
                  end
         
     | 
| 
       57 
     | 
    
         
            -
                  # rubocop:enable Metrics/MethodLength
         
     | 
| 
      
 64 
     | 
    
         
            +
                  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
         
     | 
| 
       58 
65 
     | 
    
         | 
| 
       59 
66 
     | 
    
         
             
                  def exit?
         
     | 
| 
       60 
67 
     | 
    
         
             
                    @exit
         
     | 
| 
         @@ -23,6 +23,7 @@ module RuboCop 
     | 
|
| 
       23 
23 
     | 
    
         
             
                        args: ARGV.dup,
         
     | 
| 
       24 
24 
     | 
    
         
             
                        body: $stdin.tty? ? '' : $stdin.read
         
     | 
| 
       25 
25 
     | 
    
         
             
                      )
         
     | 
| 
      
 26 
     | 
    
         
            +
                      warn stderr unless stderr.empty?
         
     | 
| 
       26 
27 
     | 
    
         
             
                      status
         
     | 
| 
       27 
28 
     | 
    
         
             
                    end
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
         @@ -43,6 +44,10 @@ module RuboCop 
     | 
|
| 
       43 
44 
     | 
    
         
             
                      RuboCop::Version::STRING != Cache.version_path.read
         
     | 
| 
       44 
45 
     | 
    
         
             
                    end
         
     | 
| 
       45 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
                    def stderr
         
     | 
| 
      
 48 
     | 
    
         
            +
                      Cache.stderr_path.read
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       46 
51 
     | 
    
         
             
                    def status
         
     | 
| 
       47 
52 
     | 
    
         
             
                      unless Cache.status_path.file?
         
     | 
| 
       48 
53 
     | 
    
         
             
                        raise "RuboCop server: Could not find status file at: #{Cache.status_path}"
         
     | 
    
        data/lib/rubocop/server/core.rb
    CHANGED
    
    | 
         @@ -17,6 +17,8 @@ module RuboCop 
     | 
|
| 
       17 
17 
     | 
    
         
             
                # The core of server process. It starts TCP server and perform socket communication.
         
     | 
| 
       18 
18 
     | 
    
         
             
                # @api private
         
     | 
| 
       19 
19 
     | 
    
         
             
                class Core
         
     | 
| 
      
 20 
     | 
    
         
            +
                  JSON_FORMATS = %w[json j].freeze
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       20 
22 
     | 
    
         
             
                  def self.token
         
     | 
| 
       21 
23 
     | 
    
         
             
                    @token ||= SecureRandom.hex(4)
         
     | 
| 
       22 
24 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -41,6 +43,7 @@ module RuboCop 
     | 
|
| 
       41 
43 
     | 
    
         | 
| 
       42 
44 
     | 
    
         
             
                    pid = fork do
         
     | 
| 
       43 
45 
     | 
    
         
             
                      Process.daemon(true)
         
     | 
| 
      
 46 
     | 
    
         
            +
                      $stderr.reopen(Cache.stderr_path, 'w')
         
     | 
| 
       44 
47 
     | 
    
         
             
                      Cache.write_pid_file do
         
     | 
| 
       45 
48 
     | 
    
         
             
                        read_socket(@server.accept) until @server.closed?
         
     | 
| 
       46 
49 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -56,7 +59,12 @@ module RuboCop 
     | 
|
| 
       56 
59 
     | 
    
         
             
                  def start_server(host, port)
         
     | 
| 
       57 
60 
     | 
    
         
             
                    @server = TCPServer.open(host, port)
         
     | 
| 
       58 
61 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                     
     | 
| 
      
 62 
     | 
    
         
            +
                    # JSON format does not expected output message when IDE integration with server mode.
         
     | 
| 
      
 63 
     | 
    
         
            +
                    # See: https://github.com/rubocop/rubocop/issues/11164
         
     | 
| 
      
 64 
     | 
    
         
            +
                    return if use_json_format?
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                    output_stream = ARGV.include?('--stderr') ? $stderr : $stdout
         
     | 
| 
      
 67 
     | 
    
         
            +
                    output_stream.puts "RuboCop server starting on #{@server.addr[3]}:#{@server.addr[1]}."
         
     | 
| 
       60 
68 
     | 
    
         
             
                  end
         
     | 
| 
       61 
69 
     | 
    
         | 
| 
       62 
70 
     | 
    
         
             
                  def read_socket(socket)
         
     | 
| 
         @@ -74,6 +82,15 @@ module RuboCop 
     | 
|
| 
       74 
82 
     | 
    
         
             
                  ensure
         
     | 
| 
       75 
83 
     | 
    
         
             
                    socket.close
         
     | 
| 
       76 
84 
     | 
    
         
             
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  def use_json_format?
         
     | 
| 
      
 87 
     | 
    
         
            +
                    return true if ARGV.include?('--format=json') || ARGV.include?('--format=j')
         
     | 
| 
      
 88 
     | 
    
         
            +
                    return false unless (index = ARGV.index('--format'))
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    format = ARGV[index + 1]
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                    JSON_FORMATS.include?(format)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
       77 
94 
     | 
    
         
             
                end
         
     | 
| 
       78 
95 
     | 
    
         
             
              end
         
     | 
| 
       79 
96 
     | 
    
         
             
            end
         
     | 
| 
         @@ -24,13 +24,17 @@ module RuboCop 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  def read!
         
     | 
| 
       25 
25 
     | 
    
         
             
                    request = parse_request(@socket.read)
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
      
 27 
     | 
    
         
            +
                    stderr = StringIO.new
         
     | 
| 
       27 
28 
     | 
    
         
             
                    Helper.redirect(
         
     | 
| 
       28 
29 
     | 
    
         
             
                      stdin: StringIO.new(request.body),
         
     | 
| 
       29 
30 
     | 
    
         
             
                      stdout: @socket,
         
     | 
| 
       30 
     | 
    
         
            -
                      stderr:  
     | 
| 
      
 31 
     | 
    
         
            +
                      stderr: stderr
         
     | 
| 
       31 
32 
     | 
    
         
             
                    ) do
         
     | 
| 
       32 
33 
     | 
    
         
             
                      create_command_instance(request).run
         
     | 
| 
       33 
34 
     | 
    
         
             
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 36 
     | 
    
         
            +
                    Cache.stderr_path.write(stderr.string)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @socket.close
         
     | 
| 
       34 
38 
     | 
    
         
             
                  end
         
     | 
| 
       35 
39 
     | 
    
         | 
| 
       36 
40 
     | 
    
         
             
                  private
         
     | 
    
        data/lib/rubocop/server.rb
    CHANGED
    
    
    
        data/lib/rubocop/version.rb
    CHANGED
    
    | 
         @@ -3,11 +3,11 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module RuboCop
         
     | 
| 
       4 
4 
     | 
    
         
             
              # This module holds the RuboCop version information.
         
     | 
| 
       5 
5 
     | 
    
         
             
              module Version
         
     | 
| 
       6 
     | 
    
         
            -
                STRING = '1. 
     | 
| 
      
 6 
     | 
    
         
            +
                STRING = '1.39.0'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                MSG = '%<version>s (using Parser %<parser_version>s, ' \
         
     | 
| 
       9 
9 
     | 
    
         
             
                      'rubocop-ast %<rubocop_ast_version>s, ' \
         
     | 
| 
       10 
     | 
    
         
            -
                      'running on %<ruby_engine>s %<ruby_version>s)%< 
     | 
| 
      
 10 
     | 
    
         
            +
                      'running on %<ruby_engine>s %<ruby_version>s)%<server_mode>s [%<ruby_platform>s]'
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                CANONICAL_FEATURE_NAMES = { 'Rspec' => 'RSpec', 'Graphql' => 'GraphQL', 'Md' => 'Markdown',
         
     | 
| 
       13 
13 
     | 
    
         
             
                                            'Thread_safety' => 'ThreadSafety' }.freeze
         
     | 
| 
         @@ -19,7 +19,7 @@ module RuboCop 
     | 
|
| 
       19 
19 
     | 
    
         
             
                    verbose_version = format(MSG, version: STRING, parser_version: Parser::VERSION,
         
     | 
| 
       20 
20 
     | 
    
         
             
                                                  rubocop_ast_version: RuboCop::AST::Version::STRING,
         
     | 
| 
       21 
21 
     | 
    
         
             
                                                  ruby_engine: RUBY_ENGINE, ruby_version: RUBY_VERSION,
         
     | 
| 
       22 
     | 
    
         
            -
                                                   
     | 
| 
      
 22 
     | 
    
         
            +
                                                  server_mode: server_mode,
         
     | 
| 
       23 
23 
     | 
    
         
             
                                                  ruby_platform: RUBY_PLATFORM)
         
     | 
| 
       24 
24 
     | 
    
         
             
                    return verbose_version unless env
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
         @@ -89,5 +89,10 @@ module RuboCop 
     | 
|
| 
       89 
89 
     | 
    
         
             
                def self.document_version
         
     | 
| 
       90 
90 
     | 
    
         
             
                  STRING.match('\d+\.\d+').to_s
         
     | 
| 
       91 
91 
     | 
    
         
             
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                # @api private
         
     | 
| 
      
 94 
     | 
    
         
            +
                def self.server_mode
         
     | 
| 
      
 95 
     | 
    
         
            +
                  RuboCop.const_defined?(:Server) && Server.running? ? ' +server' : ''
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
       92 
97 
     | 
    
         
             
              end
         
     | 
| 
       93 
98 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rubocop.rb
    CHANGED
    
    | 
         @@ -292,6 +292,7 @@ require_relative 'rubocop/cop/lint/duplicate_branch' 
     | 
|
| 
       292 
292 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_case_condition'
         
     | 
| 
       293 
293 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
         
     | 
| 
       294 
294 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_hash_key'
         
     | 
| 
      
 295 
     | 
    
         
            +
            require_relative 'rubocop/cop/lint/duplicate_magic_comment'
         
     | 
| 
       295 
296 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_methods'
         
     | 
| 
       296 
297 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_regexp_character_class_element'
         
     | 
| 
       297 
298 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_require'
         
     | 
| 
         @@ -537,7 +538,9 @@ require_relative 'rubocop/cop/style/method_call_with_args_parentheses' 
     | 
|
| 
       537 
538 
     | 
    
         
             
            require_relative 'rubocop/cop/style/multiline_in_pattern_then'
         
     | 
| 
       538 
539 
     | 
    
         
             
            require_relative 'rubocop/cop/style/numbered_parameters'
         
     | 
| 
       539 
540 
     | 
    
         
             
            require_relative 'rubocop/cop/style/open_struct_use'
         
     | 
| 
      
 541 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/operator_method_call'
         
     | 
| 
       540 
542 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_assignment'
         
     | 
| 
      
 543 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/redundant_each'
         
     | 
| 
       541 
544 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_fetch_block'
         
     | 
| 
       542 
545 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
         
     | 
| 
       543 
546 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_initialize'
         
     | 
| 
         @@ -612,6 +615,7 @@ require_relative 'rubocop/cop/style/redundant_return' 
     | 
|
| 
       612 
615 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_self'
         
     | 
| 
       613 
616 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_sort'
         
     | 
| 
       614 
617 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_sort_by'
         
     | 
| 
      
 618 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/redundant_string_escape'
         
     | 
| 
       615 
619 
     | 
    
         
             
            require_relative 'rubocop/cop/style/regexp_literal'
         
     | 
| 
       616 
620 
     | 
    
         
             
            require_relative 'rubocop/cop/style/rescue_modifier'
         
     | 
| 
       617 
621 
     | 
    
         
             
            require_relative 'rubocop/cop/style/rescue_standard_error'
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.39.0
         
     | 
| 
       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: 2022- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2022-11-14 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -120,7 +120,7 @@ dependencies: 
     | 
|
| 
       120 
120 
     | 
    
         
             
                requirements:
         
     | 
| 
       121 
121 
     | 
    
         
             
                - - ">="
         
     | 
| 
       122 
122 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       123 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 123 
     | 
    
         
            +
                    version: 1.23.0
         
     | 
| 
       124 
124 
     | 
    
         
             
                - - "<"
         
     | 
| 
       125 
125 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       126 
126 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
         @@ -130,7 +130,7 @@ dependencies: 
     | 
|
| 
       130 
130 
     | 
    
         
             
                requirements:
         
     | 
| 
       131 
131 
     | 
    
         
             
                - - ">="
         
     | 
| 
       132 
132 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       133 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 133 
     | 
    
         
            +
                    version: 1.23.0
         
     | 
| 
       134 
134 
     | 
    
         
             
                - - "<"
         
     | 
| 
       135 
135 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       136 
136 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
         @@ -207,6 +207,8 @@ files: 
     | 
|
| 
       207 
207 
     | 
    
         
             
            - config/obsoletion.yml
         
     | 
| 
       208 
208 
     | 
    
         
             
            - exe/rubocop
         
     | 
| 
       209 
209 
     | 
    
         
             
            - lib/rubocop.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - lib/rubocop/arguments_env.rb
         
     | 
| 
      
 211 
     | 
    
         
            +
            - lib/rubocop/arguments_file.rb
         
     | 
| 
       210 
212 
     | 
    
         
             
            - lib/rubocop/ast_aliases.rb
         
     | 
| 
       211 
213 
     | 
    
         
             
            - lib/rubocop/cache_config.rb
         
     | 
| 
       212 
214 
     | 
    
         
             
            - lib/rubocop/cached_data.rb
         
     | 
| 
         @@ -284,8 +286,10 @@ files: 
     | 
|
| 
       284 
286 
     | 
    
         
             
            - lib/rubocop/cop/ignored_node.rb
         
     | 
| 
       285 
287 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs.rb
         
     | 
| 
       286 
288 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/cop_description.rb
         
     | 
| 
      
 289 
     | 
    
         
            +
            - lib/rubocop/cop/internal_affairs/create_empty_file.rb
         
     | 
| 
       287 
290 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
         
     | 
| 
       288 
291 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/example_description.rb
         
     | 
| 
      
 292 
     | 
    
         
            +
            - lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
         
     | 
| 
       289 
293 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
         
     | 
| 
       290 
294 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
         
     | 
| 
       291 
295 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/method_name_end_with.rb
         
     | 
| 
         @@ -430,6 +434,7 @@ files: 
     | 
|
| 
       430 
434 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_case_condition.rb
         
     | 
| 
       431 
435 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_elsif_condition.rb
         
     | 
| 
       432 
436 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_hash_key.rb
         
     | 
| 
      
 437 
     | 
    
         
            +
            - lib/rubocop/cop/lint/duplicate_magic_comment.rb
         
     | 
| 
       433 
438 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_methods.rb
         
     | 
| 
       434 
439 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb
         
     | 
| 
       435 
440 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_require.rb
         
     | 
| 
         @@ -795,6 +800,7 @@ files: 
     | 
|
| 
       795 
800 
     | 
    
         
             
            - lib/rubocop/cop/style/object_then.rb
         
     | 
| 
       796 
801 
     | 
    
         
             
            - lib/rubocop/cop/style/one_line_conditional.rb
         
     | 
| 
       797 
802 
     | 
    
         
             
            - lib/rubocop/cop/style/open_struct_use.rb
         
     | 
| 
      
 803 
     | 
    
         
            +
            - lib/rubocop/cop/style/operator_method_call.rb
         
     | 
| 
       798 
804 
     | 
    
         
             
            - lib/rubocop/cop/style/option_hash.rb
         
     | 
| 
       799 
805 
     | 
    
         
             
            - lib/rubocop/cop/style/optional_arguments.rb
         
     | 
| 
       800 
806 
     | 
    
         
             
            - lib/rubocop/cop/style/optional_boolean_parameter.rb
         
     | 
| 
         @@ -815,6 +821,7 @@ files: 
     | 
|
| 
       815 
821 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_capital_w.rb
         
     | 
| 
       816 
822 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_condition.rb
         
     | 
| 
       817 
823 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_conditional.rb
         
     | 
| 
      
 824 
     | 
    
         
            +
            - lib/rubocop/cop/style/redundant_each.rb
         
     | 
| 
       818 
825 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_exception.rb
         
     | 
| 
       819 
826 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_fetch_block.rb
         
     | 
| 
       820 
827 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_file_extension_in_require.rb
         
     | 
| 
         @@ -831,6 +838,7 @@ files: 
     | 
|
| 
       831 
838 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_self_assignment_branch.rb
         
     | 
| 
       832 
839 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_sort.rb
         
     | 
| 
       833 
840 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_sort_by.rb
         
     | 
| 
      
 841 
     | 
    
         
            +
            - lib/rubocop/cop/style/redundant_string_escape.rb
         
     | 
| 
       834 
842 
     | 
    
         
             
            - lib/rubocop/cop/style/regexp_literal.rb
         
     | 
| 
       835 
843 
     | 
    
         
             
            - lib/rubocop/cop/style/rescue_modifier.rb
         
     | 
| 
       836 
844 
     | 
    
         
             
            - lib/rubocop/cop/style/rescue_standard_error.rb
         
     | 
| 
         @@ -977,7 +985,7 @@ metadata: 
     | 
|
| 
       977 
985 
     | 
    
         
             
              homepage_uri: https://rubocop.org/
         
     | 
| 
       978 
986 
     | 
    
         
             
              changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
         
     | 
| 
       979 
987 
     | 
    
         
             
              source_code_uri: https://github.com/rubocop/rubocop/
         
     | 
| 
       980 
     | 
    
         
            -
              documentation_uri: https://docs.rubocop.org/rubocop/1. 
     | 
| 
      
 988 
     | 
    
         
            +
              documentation_uri: https://docs.rubocop.org/rubocop/1.39/
         
     | 
| 
       981 
989 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rubocop/rubocop/issues
         
     | 
| 
       982 
990 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       983 
991 
     | 
    
         
             
            post_install_message: 
         
     |