rubocop 1.32.0 → 1.37.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 +2 -2
 - data/config/default.yml +104 -16
 - data/config/obsoletion.yml +23 -1
 - data/lib/rubocop/arguments_env.rb +17 -0
 - data/lib/rubocop/arguments_file.rb +17 -0
 - data/lib/rubocop/cache_config.rb +29 -0
 - data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +2 -2
 - data/lib/rubocop/cli/command/execute_runner.rb +7 -7
 - data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
 - data/lib/rubocop/cli/command/suggest_extensions.rb +53 -15
 - data/lib/rubocop/config.rb +1 -1
 - data/lib/rubocop/config_finder.rb +68 -0
 - data/lib/rubocop/config_loader.rb +12 -40
 - data/lib/rubocop/config_loader_resolver.rb +1 -5
 - data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
 - data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
 - data/lib/rubocop/config_obsoletion.rb +7 -2
 - data/lib/rubocop/cop/cop.rb +1 -1
 - data/lib/rubocop/cop/correctors/parentheses_corrector.rb +58 -0
 - data/lib/rubocop/cop/gemspec/require_mfa.rb +1 -1
 - data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
 - data/lib/rubocop/cop/generator.rb +1 -2
 - data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
 - data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
 - data/lib/rubocop/cop/internal_affairs.rb +2 -0
 - data/lib/rubocop/cop/layout/block_alignment.rb +16 -12
 - data/lib/rubocop/cop/layout/block_end_newline.rb +35 -5
 - data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +5 -2
 - data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -0
 - data/lib/rubocop/cop/layout/end_of_line.rb +4 -4
 - data/lib/rubocop/cop/layout/first_argument_indentation.rb +7 -1
 - data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
 - data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -2
 - data/lib/rubocop/cop/layout/indentation_width.rb +6 -2
 - data/lib/rubocop/cop/layout/line_length.rb +4 -1
 - data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
 - data/lib/rubocop/cop/layout/multiline_block_layout.rb +2 -0
 - data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
 - data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
 - data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
 - data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
 - data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +13 -9
 - data/lib/rubocop/cop/layout/space_inside_block_braces.rb +25 -9
 - data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +28 -3
 - data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
 - data/lib/rubocop/cop/legacy/corrector.rb +1 -1
 - data/lib/rubocop/cop/lint/ambiguous_block_association.rb +21 -8
 - data/lib/rubocop/cop/lint/debugger.rb +26 -16
 - data/lib/rubocop/cop/lint/deprecated_class_methods.rb +4 -4
 - data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
 - data/lib/rubocop/cop/lint/duplicate_methods.rb +11 -1
 - data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +25 -6
 - data/lib/rubocop/cop/lint/duplicate_require.rb +1 -1
 - data/lib/rubocop/cop/lint/empty_block.rb +1 -1
 - data/lib/rubocop/cop/lint/empty_class.rb +3 -1
 - data/lib/rubocop/cop/lint/empty_conditional_body.rb +107 -1
 - data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -9
 - data/lib/rubocop/cop/lint/literal_in_interpolation.rb +4 -0
 - data/lib/rubocop/cop/lint/nested_method_definition.rb +50 -1
 - data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
 - data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +6 -6
 - data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +12 -0
 - data/lib/rubocop/cop/lint/number_conversion.rb +24 -8
 - 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 +12 -1
 - data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
 - data/lib/rubocop/cop/lint/redundant_require_statement.rb +29 -9
 - data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +9 -3
 - data/lib/rubocop/cop/lint/redundant_with_index.rb +13 -10
 - data/lib/rubocop/cop/lint/redundant_with_object.rb +12 -11
 - 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 +15 -10
 - data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +27 -3
 - data/lib/rubocop/cop/lint/unreachable_loop.rb +9 -3
 - data/lib/rubocop/cop/lint/unused_method_argument.rb +4 -0
 - data/lib/rubocop/cop/lint/useless_access_modifier.rb +8 -6
 - data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +1 -1
 - data/lib/rubocop/cop/lint/void.rb +2 -0
 - data/lib/rubocop/cop/metrics/abc_size.rb +3 -1
 - data/lib/rubocop/cop/metrics/block_length.rb +6 -7
 - data/lib/rubocop/cop/metrics/method_length.rb +8 -8
 - data/lib/rubocop/cop/mixin/allowed_methods.rb +20 -1
 - data/lib/rubocop/cop/mixin/allowed_pattern.rb +17 -1
 - data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
 - data/lib/rubocop/cop/mixin/comments_help.rb +17 -1
 - data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
 - data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
 - data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +82 -4
 - data/lib/rubocop/cop/mixin/hash_transform_method.rb +10 -6
 - data/lib/rubocop/cop/mixin/method_complexity.rb +8 -13
 - data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +1 -1
 - data/lib/rubocop/cop/mixin/range_help.rb +4 -5
 - data/lib/rubocop/cop/mixin/rescue_node.rb +3 -1
 - data/lib/rubocop/cop/mixin/surrounding_space.rb +6 -5
 - data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
 - data/lib/rubocop/cop/naming/constant_name.rb +2 -2
 - data/lib/rubocop/cop/naming/inclusive_language.rb +1 -1
 - data/lib/rubocop/cop/naming/predicate_name.rb +24 -3
 - data/lib/rubocop/cop/style/access_modifier_declarations.rb +97 -1
 - data/lib/rubocop/cop/style/accessor_grouping.rb +7 -3
 - data/lib/rubocop/cop/style/arguments_forwarding.rb +2 -2
 - data/lib/rubocop/cop/style/block_delimiters.rb +26 -7
 - data/lib/rubocop/cop/style/case_equality.rb +40 -10
 - data/lib/rubocop/cop/style/class_and_module_children.rb +4 -4
 - data/lib/rubocop/cop/style/class_equality_comparison.rb +32 -7
 - data/lib/rubocop/cop/style/class_methods_definitions.rb +2 -1
 - data/lib/rubocop/cop/style/collection_compact.rb +6 -1
 - data/lib/rubocop/cop/style/collection_methods.rb +2 -0
 - data/lib/rubocop/cop/style/combinable_loops.rb +3 -1
 - data/lib/rubocop/cop/style/double_negation.rb +2 -0
 - data/lib/rubocop/cop/style/each_for_simple_loop.rb +41 -6
 - data/lib/rubocop/cop/style/each_with_object.rb +39 -8
 - data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
 - data/lib/rubocop/cop/style/empty_heredoc.rb +15 -1
 - data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
 - 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/for.rb +2 -0
 - data/lib/rubocop/cop/style/format_string_token.rb +21 -8
 - data/lib/rubocop/cop/style/guard_clause.rb +27 -16
 - data/lib/rubocop/cop/style/hash_each_methods.rb +3 -1
 - data/lib/rubocop/cop/style/hash_except.rb +0 -4
 - data/lib/rubocop/cop/style/hash_syntax.rb +17 -0
 - data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
 - data/lib/rubocop/cop/style/inverse_methods.rb +8 -6
 - data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
 - data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +15 -4
 - data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
 - data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -7
 - data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -6
 - data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +4 -1
 - data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -1
 - data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +1 -1
 - data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -1
 - data/lib/rubocop/cop/style/next.rb +3 -5
 - data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
 - data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
 - data/lib/rubocop/cop/style/numeric_predicate.rb +28 -8
 - data/lib/rubocop/cop/style/object_then.rb +2 -0
 - data/lib/rubocop/cop/style/operator_method_call.rb +39 -0
 - data/lib/rubocop/cop/style/perl_backrefs.rb +22 -1
 - data/lib/rubocop/cop/style/proc.rb +4 -1
 - data/lib/rubocop/cop/style/redundant_begin.rb +3 -0
 - data/lib/rubocop/cop/style/redundant_condition.rb +24 -6
 - data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -1
 - data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
 - data/lib/rubocop/cop/style/redundant_parentheses.rb +19 -22
 - data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +8 -1
 - data/lib/rubocop/cop/style/redundant_self.rb +2 -0
 - data/lib/rubocop/cop/style/redundant_sort.rb +21 -6
 - data/lib/rubocop/cop/style/redundant_sort_by.rb +24 -8
 - data/lib/rubocop/cop/style/redundant_string_escape.rb +173 -0
 - data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
 - data/lib/rubocop/cop/style/safe_navigation.rb +4 -2
 - data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
 - data/lib/rubocop/cop/style/sole_nested_conditional.rb +14 -5
 - data/lib/rubocop/cop/style/static_class.rb +32 -1
 - data/lib/rubocop/cop/style/symbol_array.rb +3 -1
 - data/lib/rubocop/cop/style/symbol_proc.rb +38 -12
 - data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -13
 - data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
 - data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
 - data/lib/rubocop/cop/style/word_array.rb +3 -1
 - data/lib/rubocop/cop/util.rb +1 -1
 - data/lib/rubocop/ext/range.rb +15 -0
 - data/lib/rubocop/feature_loader.rb +94 -0
 - data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
 - data/lib/rubocop/formatter/disabled_config_formatter.rb +9 -3
 - data/lib/rubocop/formatter/html_formatter.rb +3 -3
 - data/lib/rubocop/formatter/markdown_formatter.rb +1 -1
 - data/lib/rubocop/formatter/tap_formatter.rb +1 -1
 - data/lib/rubocop/options.rb +13 -13
 - data/lib/rubocop/result_cache.rb +22 -20
 - data/lib/rubocop/rspec/shared_contexts.rb +13 -1
 - data/lib/rubocop/runner.rb +4 -0
 - data/lib/rubocop/server/cache.rb +41 -2
 - data/lib/rubocop/server/cli.rb +26 -2
 - data/lib/rubocop/server/client_command/exec.rb +5 -0
 - data/lib/rubocop/server/core.rb +2 -1
 - data/lib/rubocop/server/socket_reader.rb +5 -1
 - data/lib/rubocop/server.rb +1 -1
 - data/lib/rubocop/version.rb +8 -2
 - data/lib/rubocop.rb +8 -3
 - metadata +20 -9
 - data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
 
    
        data/lib/rubocop/result_cache.rb
    CHANGED
    
    | 
         @@ -4,6 +4,7 @@ require 'digest/sha1' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'find'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'etc'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'zlib'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative 'cache_config'
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            module RuboCop
         
     | 
| 
       9 
10 
     | 
    
         
             
              # Provides functionality for caching RuboCop runs.
         
     | 
| 
         @@ -13,6 +14,12 @@ module RuboCop 
     | 
|
| 
       13 
14 
     | 
    
         
             
                                  fix_layout autocorrect safe_autocorrect autocorrect_all
         
     | 
| 
       14 
15 
     | 
    
         
             
                                  cache fail_fast stdin parallel].freeze
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                DL_EXTENSIONS = ::RbConfig::CONFIG
         
     | 
| 
      
 18 
     | 
    
         
            +
                                .values_at('DLEXT', 'DLEXT2')
         
     | 
| 
      
 19 
     | 
    
         
            +
                                .reject { |ext| !ext || ext.empty? }
         
     | 
| 
      
 20 
     | 
    
         
            +
                                .map    { |ext| ".#{ext}" }
         
     | 
| 
      
 21 
     | 
    
         
            +
                                .freeze
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       16 
23 
     | 
    
         
             
                # Remove old files so that the cache doesn't grow too big. When the
         
     | 
| 
       17 
24 
     | 
    
         
             
                # threshold MaxFilesInCache has been exceeded, the oldest 50% of all the
         
     | 
| 
       18 
25 
     | 
    
         
             
                # files in the cache are removed. The reason for removing so much is that
         
     | 
| 
         @@ -67,24 +74,9 @@ module RuboCop 
     | 
|
| 
       67 
74 
     | 
    
         
             
                end
         
     | 
| 
       68 
75 
     | 
    
         | 
| 
       69 
76 
     | 
    
         
             
                def self.cache_root(config_store)
         
     | 
| 
       70 
     | 
    
         
            -
                   
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
       73 
     | 
    
         
            -
                             # Include user ID in the path to make sure the user has write
         
     | 
| 
       74 
     | 
    
         
            -
                             # access.
         
     | 
| 
       75 
     | 
    
         
            -
                             File.join(ENV.fetch('XDG_CACHE_HOME'), Process.uid.to_s)
         
     | 
| 
       76 
     | 
    
         
            -
                           else
         
     | 
| 
       77 
     | 
    
         
            -
                             # On FreeBSD, the /home path is a symbolic link to /usr/home
         
     | 
| 
       78 
     | 
    
         
            -
                             # and the $HOME environment variable returns the /home path.
         
     | 
| 
       79 
     | 
    
         
            -
                             #
         
     | 
| 
       80 
     | 
    
         
            -
                             # As $HOME is a built-in environment variable, FreeBSD users
         
     | 
| 
       81 
     | 
    
         
            -
                             # always get a warning message.
         
     | 
| 
       82 
     | 
    
         
            -
                             #
         
     | 
| 
       83 
     | 
    
         
            -
                             # To avoid raising warn log messages on FreeBSD, we retrieve
         
     | 
| 
       84 
     | 
    
         
            -
                             # the real path of the home folder.
         
     | 
| 
       85 
     | 
    
         
            -
                             File.join(File.realpath(Dir.home), '.cache')
         
     | 
| 
       86 
     | 
    
         
            -
                           end
         
     | 
| 
       87 
     | 
    
         
            -
                  File.join(root, 'rubocop_cache')
         
     | 
| 
      
 77 
     | 
    
         
            +
                  CacheConfig.root_dir do
         
     | 
| 
      
 78 
     | 
    
         
            +
                    config_store.for_pwd.for_all_cops['CacheRootDirectory']
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
       88 
80 
     | 
    
         
             
                end
         
     | 
| 
       89 
81 
     | 
    
         | 
| 
       90 
82 
     | 
    
         
             
                def self.allow_symlinks_in_cache_location?(config_store)
         
     | 
| 
         @@ -188,14 +180,24 @@ module RuboCop 
     | 
|
| 
       188 
180 
     | 
    
         
             
                        .select { |path| File.file?(path) }
         
     | 
| 
       189 
181 
     | 
    
         
             
                        .sort!
         
     | 
| 
       190 
182 
     | 
    
         
             
                        .each do |path|
         
     | 
| 
       191 
     | 
    
         
            -
                           
     | 
| 
       192 
     | 
    
         
            -
                          digest << Zlib.crc32(content).to_s # mtime not reliable
         
     | 
| 
      
 183 
     | 
    
         
            +
                          digest << digest(path)
         
     | 
| 
       193 
184 
     | 
    
         
             
                        end
         
     | 
| 
       194 
185 
     | 
    
         
             
                      digest << RuboCop::Version::STRING << RuboCop::AST::Version::STRING
         
     | 
| 
       195 
186 
     | 
    
         
             
                      digest.hexdigest
         
     | 
| 
       196 
187 
     | 
    
         
             
                    end
         
     | 
| 
       197 
188 
     | 
    
         
             
                end
         
     | 
| 
       198 
189 
     | 
    
         | 
| 
      
 190 
     | 
    
         
            +
                def digest(path)
         
     | 
| 
      
 191 
     | 
    
         
            +
                  content = if path.end_with?(*DL_EXTENSIONS)
         
     | 
| 
      
 192 
     | 
    
         
            +
                              # Shared libraries often contain timestamps of when
         
     | 
| 
      
 193 
     | 
    
         
            +
                              # they were compiled and other non-stable data.
         
     | 
| 
      
 194 
     | 
    
         
            +
                              File.basename(path)
         
     | 
| 
      
 195 
     | 
    
         
            +
                            else
         
     | 
| 
      
 196 
     | 
    
         
            +
                              File.binread(path) # mtime not reliable
         
     | 
| 
      
 197 
     | 
    
         
            +
                            end
         
     | 
| 
      
 198 
     | 
    
         
            +
                  Zlib.crc32(content).to_s
         
     | 
| 
      
 199 
     | 
    
         
            +
                end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
       199 
201 
     | 
    
         
             
                def rubocop_extra_features
         
     | 
| 
       200 
202 
     | 
    
         
             
                  lib_root = File.join(File.dirname(__FILE__), '..')
         
     | 
| 
       201 
203 
     | 
    
         
             
                  exe_root = File.join(lib_root, '..', 'exe')
         
     | 
| 
         @@ -2,7 +2,15 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'tmpdir'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            RSpec.shared_context 'isolated environment' do
         
     | 
| 
      
 5 
     | 
    
         
            +
            RSpec.shared_context 'isolated environment' do # rubocop:disable Metrics/BlockLength
         
     | 
| 
      
 6 
     | 
    
         
            +
              before do
         
     | 
| 
      
 7 
     | 
    
         
            +
                if RuboCop.const_defined?(:Server)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # Bust server cache to behave as an isolated environment
         
     | 
| 
      
 9 
     | 
    
         
            +
                  RuboCop::Server::Cache.cache_root_path = nil
         
     | 
| 
      
 10 
     | 
    
         
            +
                  RuboCop::Server::Cache.instance_variable_set(:@project_dir_cache_key, nil)
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       6 
14 
     | 
    
         
             
              around do |example|
         
     | 
| 
       7 
15 
     | 
    
         
             
                Dir.mktmpdir do |tmpdir|
         
     | 
| 
       8 
16 
     | 
    
         
             
                  original_home = Dir.home
         
     | 
| 
         @@ -32,6 +40,10 @@ RSpec.shared_context 'isolated environment' do 
     | 
|
| 
       32 
40 
     | 
    
         
             
                    ENV['HOME'] = original_home
         
     | 
| 
       33 
41 
     | 
    
         
             
                    ENV['XDG_CONFIG_HOME'] = original_xdg_config_home
         
     | 
| 
       34 
42 
     | 
    
         | 
| 
      
 43 
     | 
    
         
            +
                    if RuboCop.const_defined?(:Server)
         
     | 
| 
      
 44 
     | 
    
         
            +
                      RuboCop::Server::Cache.cache_root_path = nil
         
     | 
| 
      
 45 
     | 
    
         
            +
                      RuboCop::Server::Cache.instance_variable_set(:@project_dir_cache_key, nil)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
       35 
47 
     | 
    
         
             
                    RuboCop::FileFinder.root_level = nil
         
     | 
| 
       36 
48 
     | 
    
         
             
                  end
         
     | 
| 
       37 
49 
     | 
    
         
             
                end
         
     | 
    
        data/lib/rubocop/runner.rb
    CHANGED
    
    | 
         @@ -64,6 +64,10 @@ module RuboCop 
     | 
|
| 
       64 
64 
     | 
    
         
             
                # instances that each inspects its allotted group of files.
         
     | 
| 
       65 
65 
     | 
    
         
             
                def warm_cache(target_files)
         
     | 
| 
       66 
66 
     | 
    
         
             
                  saved_options = @options.dup
         
     | 
| 
      
 67 
     | 
    
         
            +
                  if target_files.length <= 1
         
     | 
| 
      
 68 
     | 
    
         
            +
                    puts 'Skipping parallel inspection: only a single file needs inspection' if @options[:debug]
         
     | 
| 
      
 69 
     | 
    
         
            +
                    return
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
       67 
71 
     | 
    
         
             
                  puts 'Running parallel inspection' if @options[:debug]
         
     | 
| 
       68 
72 
     | 
    
         
             
                  %i[autocorrect safe_autocorrect].each { |opt| @options[opt] = false }
         
     | 
| 
       69 
73 
     | 
    
         
             
                  Parallel.each(target_files) { |target_file| file_offenses(target_file) }
         
     | 
    
        data/lib/rubocop/server/cache.rb
    CHANGED
    
    | 
         @@ -1,6 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'pathname'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative '../cache_config'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative '../config_finder'
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            #
         
     | 
| 
       6 
8 
     | 
    
         
             
            # This code is based on https://github.com/fohte/rubocop-daemon.
         
     | 
| 
         @@ -19,6 +21,8 @@ module RuboCop 
     | 
|
| 
       19 
21 
     | 
    
         
             
                  GEMFILE_NAMES = %w[Gemfile gems.rb].freeze
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
23 
     | 
    
         
             
                  class << self
         
     | 
| 
      
 24 
     | 
    
         
            +
                    attr_accessor :cache_root_path
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       22 
26 
     | 
    
         
             
                    # Searches for Gemfile or gems.rb in the current dir or any parent dirs
         
     | 
| 
       23 
27 
     | 
    
         
             
                    def project_dir
         
     | 
| 
       24 
28 
     | 
    
         
             
                      current_dir = Dir.pwd
         
     | 
| 
         @@ -38,12 +42,43 @@ module RuboCop 
     | 
|
| 
       38 
42 
     | 
    
         
             
                    end
         
     | 
| 
       39 
43 
     | 
    
         | 
| 
       40 
44 
     | 
    
         
             
                    def dir
         
     | 
| 
       41 
     | 
    
         
            -
                      cache_path = File.expand_path('~/.cache/rubocop_cache/server')
         
     | 
| 
       42 
45 
     | 
    
         
             
                      Pathname.new(File.join(cache_path, project_dir_cache_key)).tap do |d|
         
     | 
| 
       43 
46 
     | 
    
         
             
                        d.mkpath unless d.exist?
         
     | 
| 
       44 
47 
     | 
    
         
             
                      end
         
     | 
| 
       45 
48 
     | 
    
         
             
                    end
         
     | 
| 
       46 
49 
     | 
    
         | 
| 
      
 50 
     | 
    
         
            +
                    def cache_path
         
     | 
| 
      
 51 
     | 
    
         
            +
                      cache_root_dir = if cache_root_path
         
     | 
| 
      
 52 
     | 
    
         
            +
                                         File.join(cache_root_path, 'rubocop_cache')
         
     | 
| 
      
 53 
     | 
    
         
            +
                                       else
         
     | 
| 
      
 54 
     | 
    
         
            +
                                         cache_root_dir_from_config
         
     | 
| 
      
 55 
     | 
    
         
            +
                                       end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                      File.expand_path(File.join(cache_root_dir, 'server'))
         
     | 
| 
      
 58 
     | 
    
         
            +
                    end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                    def cache_root_dir_from_config
         
     | 
| 
      
 61 
     | 
    
         
            +
                      CacheConfig.root_dir do
         
     | 
| 
      
 62 
     | 
    
         
            +
                        # `RuboCop::ConfigStore` has heavy dependencies, this is a lightweight implementation
         
     | 
| 
      
 63 
     | 
    
         
            +
                        # so that only the necessary `CacheRootDirectory` can be obtained.
         
     | 
| 
      
 64 
     | 
    
         
            +
                        require 'yaml'
         
     | 
| 
      
 65 
     | 
    
         
            +
                        config_path = ConfigFinder.find_config_path(Dir.pwd)
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                        require 'erb'
         
     | 
| 
      
 68 
     | 
    
         
            +
                        file_contents = File.read(config_path)
         
     | 
| 
      
 69 
     | 
    
         
            +
                        yaml_code = ERB.new(file_contents).result
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                        config_yaml = YAML.safe_load(yaml_code, permitted_classes: [Regexp, Symbol])
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                        # For compatibility with Ruby 3.0 or lower.
         
     | 
| 
      
 74 
     | 
    
         
            +
                        if Gem::Version.new(Psych::VERSION) < Gem::Version.new('4.0.0')
         
     | 
| 
      
 75 
     | 
    
         
            +
                          config_yaml == false ? nil : config_yaml
         
     | 
| 
      
 76 
     | 
    
         
            +
                        end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                        config_yaml&.dig('AllCops', 'CacheRootDirectory')
         
     | 
| 
      
 79 
     | 
    
         
            +
                      end
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       47 
82 
     | 
    
         
             
                    def port_path
         
     | 
| 
       48 
83 
     | 
    
         
             
                      dir.join('port')
         
     | 
| 
       49 
84 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -68,9 +103,13 @@ module RuboCop 
     | 
|
| 
       68 
103 
     | 
    
         
             
                      dir.join('version')
         
     | 
| 
       69 
104 
     | 
    
         
             
                    end
         
     | 
| 
       70 
105 
     | 
    
         | 
| 
      
 106 
     | 
    
         
            +
                    def stderr_path
         
     | 
| 
      
 107 
     | 
    
         
            +
                      dir.join('stderr')
         
     | 
| 
      
 108 
     | 
    
         
            +
                    end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
       71 
110 
     | 
    
         
             
                    def pid_running?
         
     | 
| 
       72 
111 
     | 
    
         
             
                      Process.kill(0, pid_path.read.to_i) == 1
         
     | 
| 
       73 
     | 
    
         
            -
                    rescue Errno::ESRCH
         
     | 
| 
      
 112 
     | 
    
         
            +
                    rescue Errno::ESRCH, Errno::ENOENT
         
     | 
| 
       74 
113 
     | 
    
         
             
                      false
         
     | 
| 
       75 
114 
     | 
    
         
             
                    end
         
     | 
| 
       76 
115 
     | 
    
         | 
    
        data/lib/rubocop/server/cli.rb
    CHANGED
    
    | 
         @@ -1,7 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require 'optparse'
         
     | 
| 
       4 
3 
     | 
    
         
             
            require 'rainbow'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative '../arguments_env'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative '../arguments_file'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            #
         
     | 
| 
       7 
8 
     | 
    
         
             
            # This code is based on https://github.com/fohte/rubocop-daemon.
         
     | 
| 
         @@ -30,6 +31,7 @@ module RuboCop 
     | 
|
| 
       30 
31 
     | 
    
         
             
                    @exit = false
         
     | 
| 
       31 
32 
     | 
    
         
             
                  end
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
      
 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)
         
     | 
| 
         @@ -37,6 +39,7 @@ module RuboCop 
     | 
|
| 
       37 
39 
     | 
    
         
             
                      return STATUS_SUCCESS
         
     | 
| 
       38 
40 
     | 
    
         
             
                    end
         
     | 
| 
       39 
41 
     | 
    
         | 
| 
      
 42 
     | 
    
         
            +
                    Cache.cache_root_path = fetch_cache_root_path_from(argv)
         
     | 
| 
       40 
43 
     | 
    
         
             
                    deleted_server_arguments = delete_server_argument_from(argv)
         
     | 
| 
       41 
44 
     | 
    
         | 
| 
       42 
45 
     | 
    
         
             
                    if deleted_server_arguments.size >= 2
         
     | 
| 
         @@ -45,14 +48,20 @@ module RuboCop 
     | 
|
| 
       45 
48 
     | 
    
         | 
| 
       46 
49 
     | 
    
         
             
                    server_command = deleted_server_arguments.first
         
     | 
| 
       47 
50 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                    if EXCLUSIVE_OPTIONS.include?(server_command) && argv.count  
     | 
| 
      
 51 
     | 
    
         
            +
                    if EXCLUSIVE_OPTIONS.include?(server_command) && argv.count > allowed_option_count
         
     | 
| 
       49 
52 
     | 
    
         
             
                      return error("#{server_command} cannot be combined with other options.")
         
     | 
| 
       50 
53 
     | 
    
         
             
                    end
         
     | 
| 
       51 
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 
     | 
    
         
            +
             
     | 
| 
       52 
60 
     | 
    
         
             
                    run_command(server_command)
         
     | 
| 
       53 
61 
     | 
    
         | 
| 
       54 
62 
     | 
    
         
             
                    STATUS_SUCCESS
         
     | 
| 
       55 
63 
     | 
    
         
             
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
         
     | 
| 
       56 
65 
     | 
    
         | 
| 
       57 
66 
     | 
    
         
             
                  def exit?
         
     | 
| 
       58 
67 
     | 
    
         
             
                    @exit
         
     | 
| 
         @@ -83,6 +92,17 @@ module RuboCop 
     | 
|
| 
       83 
92 
     | 
    
         
             
                  end
         
     | 
| 
       84 
93 
     | 
    
         
             
                  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength:
         
     | 
| 
       85 
94 
     | 
    
         | 
| 
      
 95 
     | 
    
         
            +
                  def fetch_cache_root_path_from(arguments)
         
     | 
| 
      
 96 
     | 
    
         
            +
                    cache_root = arguments.detect { |argument| argument.start_with?('--cache-root') }
         
     | 
| 
      
 97 
     | 
    
         
            +
                    return unless cache_root
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                    if cache_root.start_with?('--cache-root=')
         
     | 
| 
      
 100 
     | 
    
         
            +
                      cache_root.split('=')[1]
         
     | 
| 
      
 101 
     | 
    
         
            +
                    else
         
     | 
| 
      
 102 
     | 
    
         
            +
                      arguments[arguments.index(cache_root) + 1]
         
     | 
| 
      
 103 
     | 
    
         
            +
                    end
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
       86 
106 
     | 
    
         
             
                  def delete_server_argument_from(all_arguments)
         
     | 
| 
       87 
107 
     | 
    
         
             
                    SERVER_OPTIONS.each_with_object([]) do |server_option, server_arguments|
         
     | 
| 
       88 
108 
     | 
    
         
             
                      server_arguments << all_arguments.delete(server_option)
         
     | 
| 
         @@ -93,6 +113,10 @@ module RuboCop 
     | 
|
| 
       93 
113 
     | 
    
         
             
                    (argv & SERVER_OPTIONS).any?
         
     | 
| 
       94 
114 
     | 
    
         
             
                  end
         
     | 
| 
       95 
115 
     | 
    
         | 
| 
      
 116 
     | 
    
         
            +
                  def allowed_option_count
         
     | 
| 
      
 117 
     | 
    
         
            +
                    Cache.cache_root_path ? 2 : 1
         
     | 
| 
      
 118 
     | 
    
         
            +
                  end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
       96 
120 
     | 
    
         
             
                  def error(message)
         
     | 
| 
       97 
121 
     | 
    
         
             
                    @exit = true
         
     | 
| 
       98 
122 
     | 
    
         
             
                    warn Rainbow(message).red
         
     | 
| 
         @@ -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
    
    | 
         @@ -56,7 +56,8 @@ module RuboCop 
     | 
|
| 
       56 
56 
     | 
    
         
             
                  def start_server(host, port)
         
     | 
| 
       57 
57 
     | 
    
         
             
                    @server = TCPServer.open(host, port)
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                     
     | 
| 
      
 59 
     | 
    
         
            +
                    output_stream = ARGV.include?('--stderr') ? $stderr : $stdout
         
     | 
| 
      
 60 
     | 
    
         
            +
                    output_stream.puts "RuboCop server starting on #{@server.addr[3]}:#{@server.addr[1]}."
         
     | 
| 
       60 
61 
     | 
    
         
             
                  end
         
     | 
| 
       61 
62 
     | 
    
         | 
| 
       62 
63 
     | 
    
         
             
                  def read_socket(socket)
         
     | 
| 
         @@ -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.37.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 %<ruby_platform>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,6 +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 
     | 
    
         
            +
                                                  server_mode: server_mode,
         
     | 
| 
       22 
23 
     | 
    
         
             
                                                  ruby_platform: RUBY_PLATFORM)
         
     | 
| 
       23 
24 
     | 
    
         
             
                    return verbose_version unless env
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
         @@ -88,5 +89,10 @@ module RuboCop 
     | 
|
| 
       88 
89 
     | 
    
         
             
                def self.document_version
         
     | 
| 
       89 
90 
     | 
    
         
             
                  STRING.match('\d+\.\d+').to_s
         
     | 
| 
       90 
91 
     | 
    
         
             
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                # @api private
         
     | 
| 
      
 94 
     | 
    
         
            +
                def self.server_mode
         
     | 
| 
      
 95 
     | 
    
         
            +
                  RuboCop.const_defined?(:Server) && Server.running? ? ' +server' : ''
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
       91 
97 
     | 
    
         
             
              end
         
     | 
| 
       92 
98 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rubocop.rb
    CHANGED
    
    | 
         @@ -16,6 +16,7 @@ require 'rubocop-ast' 
     | 
|
| 
       16 
16 
     | 
    
         
             
            require_relative 'rubocop/ast_aliases'
         
     | 
| 
       17 
17 
     | 
    
         
             
            require_relative 'rubocop/ext/regexp_node'
         
     | 
| 
       18 
18 
     | 
    
         
             
            require_relative 'rubocop/ext/regexp_parser'
         
     | 
| 
      
 19 
     | 
    
         
            +
            require_relative 'rubocop/ext/range'
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
            require_relative 'rubocop/core_ext/string'
         
     | 
| 
       21 
22 
     | 
    
         
             
            require_relative 'rubocop/ext/processed_source'
         
     | 
| 
         @@ -47,6 +48,7 @@ require_relative 'rubocop/cop/severity' 
     | 
|
| 
       47 
48 
     | 
    
         
             
            require_relative 'rubocop/cop/generator'
         
     | 
| 
       48 
49 
     | 
    
         
             
            require_relative 'rubocop/cop/generator/configuration_injector'
         
     | 
| 
       49 
50 
     | 
    
         
             
            require_relative 'rubocop/cop/generator/require_file_injector'
         
     | 
| 
      
 51 
     | 
    
         
            +
            require_relative 'rubocop/magic_comment'
         
     | 
| 
       50 
52 
     | 
    
         | 
| 
       51 
53 
     | 
    
         
             
            require_relative 'rubocop/cop/variable_force'
         
     | 
| 
       52 
54 
     | 
    
         
             
            require_relative 'rubocop/cop/variable_force/branch'
         
     | 
| 
         @@ -86,7 +88,6 @@ require_relative 'rubocop/cop/mixin/gem_declaration' 
     | 
|
| 
       86 
88 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/gemspec_help'
         
     | 
| 
       87 
89 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/hash_alignment_styles'
         
     | 
| 
       88 
90 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/hash_transform_method'
         
     | 
| 
       89 
     | 
    
         
            -
            require_relative 'rubocop/cop/mixin/ignored_methods'
         
     | 
| 
       90 
91 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/integer_node'
         
     | 
| 
       91 
92 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/interpolation'
         
     | 
| 
       92 
93 
     | 
    
         
             
            require_relative 'rubocop/cop/mixin/line_length_help'
         
     | 
| 
         @@ -291,6 +292,7 @@ require_relative 'rubocop/cop/lint/duplicate_branch' 
     | 
|
| 
       291 
292 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_case_condition'
         
     | 
| 
       292 
293 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
         
     | 
| 
       293 
294 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_hash_key'
         
     | 
| 
      
 295 
     | 
    
         
            +
            require_relative 'rubocop/cop/lint/duplicate_magic_comment'
         
     | 
| 
       294 
296 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_methods'
         
     | 
| 
       295 
297 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_regexp_character_class_element'
         
     | 
| 
       296 
298 
     | 
    
         
             
            require_relative 'rubocop/cop/lint/duplicate_require'
         
     | 
| 
         @@ -529,12 +531,14 @@ require_relative 'rubocop/cop/style/keyword_parameters_order' 
     | 
|
| 
       529 
531 
     | 
    
         
             
            require_relative 'rubocop/cop/style/lambda'
         
     | 
| 
       530 
532 
     | 
    
         
             
            require_relative 'rubocop/cop/style/lambda_call'
         
     | 
| 
       531 
533 
     | 
    
         
             
            require_relative 'rubocop/cop/style/line_end_concatenation'
         
     | 
| 
      
 534 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/magic_comment_format'
         
     | 
| 
       532 
535 
     | 
    
         
             
            require_relative 'rubocop/cop/style/map_to_hash'
         
     | 
| 
       533 
536 
     | 
    
         
             
            require_relative 'rubocop/cop/style/method_call_without_args_parentheses'
         
     | 
| 
       534 
537 
     | 
    
         
             
            require_relative 'rubocop/cop/style/method_call_with_args_parentheses'
         
     | 
| 
       535 
538 
     | 
    
         
             
            require_relative 'rubocop/cop/style/multiline_in_pattern_then'
         
     | 
| 
       536 
539 
     | 
    
         
             
            require_relative 'rubocop/cop/style/numbered_parameters'
         
     | 
| 
       537 
540 
     | 
    
         
             
            require_relative 'rubocop/cop/style/open_struct_use'
         
     | 
| 
      
 541 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/operator_method_call'
         
     | 
| 
       538 
542 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_assignment'
         
     | 
| 
       539 
543 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_fetch_block'
         
     | 
| 
       540 
544 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
         
     | 
| 
         @@ -610,6 +614,7 @@ require_relative 'rubocop/cop/style/redundant_return' 
     | 
|
| 
       610 
614 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_self'
         
     | 
| 
       611 
615 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_sort'
         
     | 
| 
       612 
616 
     | 
    
         
             
            require_relative 'rubocop/cop/style/redundant_sort_by'
         
     | 
| 
      
 617 
     | 
    
         
            +
            require_relative 'rubocop/cop/style/redundant_string_escape'
         
     | 
| 
       613 
618 
     | 
    
         
             
            require_relative 'rubocop/cop/style/regexp_literal'
         
     | 
| 
       614 
619 
     | 
    
         
             
            require_relative 'rubocop/cop/style/rescue_modifier'
         
     | 
| 
       615 
620 
     | 
    
         
             
            require_relative 'rubocop/cop/style/rescue_standard_error'
         
     | 
| 
         @@ -690,18 +695,18 @@ require_relative 'rubocop/config_obsoletion/split_cop' 
     | 
|
| 
       690 
695 
     | 
    
         
             
            require_relative 'rubocop/config_obsoletion'
         
     | 
| 
       691 
696 
     | 
    
         
             
            require_relative 'rubocop/config_store'
         
     | 
| 
       692 
697 
     | 
    
         
             
            require_relative 'rubocop/config_validator'
         
     | 
| 
      
 698 
     | 
    
         
            +
            require_relative 'rubocop/feature_loader'
         
     | 
| 
       693 
699 
     | 
    
         
             
            require_relative 'rubocop/lockfile'
         
     | 
| 
       694 
700 
     | 
    
         
             
            require_relative 'rubocop/target_finder'
         
     | 
| 
       695 
701 
     | 
    
         
             
            require_relative 'rubocop/directive_comment'
         
     | 
| 
       696 
702 
     | 
    
         
             
            require_relative 'rubocop/comment_config'
         
     | 
| 
       697 
     | 
    
         
            -
            require_relative 'rubocop/magic_comment'
         
     | 
| 
       698 
703 
     | 
    
         
             
            require_relative 'rubocop/result_cache'
         
     | 
| 
       699 
704 
     | 
    
         
             
            require_relative 'rubocop/runner'
         
     | 
| 
       700 
705 
     | 
    
         
             
            require_relative 'rubocop/cli'
         
     | 
| 
       701 
706 
     | 
    
         
             
            require_relative 'rubocop/cli/command'
         
     | 
| 
       702 
707 
     | 
    
         
             
            require_relative 'rubocop/cli/environment'
         
     | 
| 
       703 
708 
     | 
    
         
             
            require_relative 'rubocop/cli/command/base'
         
     | 
| 
       704 
     | 
    
         
            -
            require_relative 'rubocop/cli/command/ 
     | 
| 
      
 709 
     | 
    
         
            +
            require_relative 'rubocop/cli/command/auto_generate_config'
         
     | 
| 
       705 
710 
     | 
    
         
             
            require_relative 'rubocop/cli/command/execute_runner'
         
     | 
| 
       706 
711 
     | 
    
         
             
            require_relative 'rubocop/cli/command/init_dotfile'
         
     | 
| 
       707 
712 
     | 
    
         
             
            require_relative 'rubocop/cli/command/show_cops'
         
     | 
    
        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.37.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-10-20 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -46,14 +46,14 @@ dependencies: 
     | 
|
| 
       46 
46 
     | 
    
         
             
                requirements:
         
     | 
| 
       47 
47 
     | 
    
         
             
                - - ">="
         
     | 
| 
       48 
48 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       49 
     | 
    
         
            -
                    version: 3.1. 
     | 
| 
      
 49 
     | 
    
         
            +
                    version: 3.1.2.1
         
     | 
| 
       50 
50 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       51 
51 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       52 
52 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       53 
53 
     | 
    
         
             
                requirements:
         
     | 
| 
       54 
54 
     | 
    
         
             
                - - ">="
         
     | 
| 
       55 
55 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       56 
     | 
    
         
            -
                    version: 3.1. 
     | 
| 
      
 56 
     | 
    
         
            +
                    version: 3.1.2.1
         
     | 
| 
       57 
57 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       58 
58 
     | 
    
         
             
              name: rainbow
         
     | 
| 
       59 
59 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -120,7 +120,7 @@ dependencies: 
     | 
|
| 
       120 
120 
     | 
    
         
             
                requirements:
         
     | 
| 
       121 
121 
     | 
    
         
             
                - - ">="
         
     | 
| 
       122 
122 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       123 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 123 
     | 
    
         
            +
                    version: 1.22.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.22.0
         
     | 
| 
       134 
134 
     | 
    
         
             
                - - "<"
         
     | 
| 
       135 
135 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       136 
136 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
         @@ -207,11 +207,14 @@ 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
         
     | 
| 
      
 213 
     | 
    
         
            +
            - lib/rubocop/cache_config.rb
         
     | 
| 
       211 
214 
     | 
    
         
             
            - lib/rubocop/cached_data.rb
         
     | 
| 
       212 
215 
     | 
    
         
             
            - lib/rubocop/cli.rb
         
     | 
| 
       213 
216 
     | 
    
         
             
            - lib/rubocop/cli/command.rb
         
     | 
| 
       214 
     | 
    
         
            -
            - lib/rubocop/cli/command/ 
     | 
| 
      
 217 
     | 
    
         
            +
            - lib/rubocop/cli/command/auto_generate_config.rb
         
     | 
| 
       215 
218 
     | 
    
         
             
            - lib/rubocop/cli/command/base.rb
         
     | 
| 
       216 
219 
     | 
    
         
             
            - lib/rubocop/cli/command/execute_runner.rb
         
     | 
| 
       217 
220 
     | 
    
         
             
            - lib/rubocop/cli/command/init_dotfile.rb
         
     | 
| 
         @@ -222,6 +225,7 @@ files: 
     | 
|
| 
       222 
225 
     | 
    
         
             
            - lib/rubocop/cli/environment.rb
         
     | 
| 
       223 
226 
     | 
    
         
             
            - lib/rubocop/comment_config.rb
         
     | 
| 
       224 
227 
     | 
    
         
             
            - lib/rubocop/config.rb
         
     | 
| 
      
 228 
     | 
    
         
            +
            - lib/rubocop/config_finder.rb
         
     | 
| 
       225 
229 
     | 
    
         
             
            - lib/rubocop/config_loader.rb
         
     | 
| 
       226 
230 
     | 
    
         
             
            - lib/rubocop/config_loader_resolver.rb
         
     | 
| 
       227 
231 
     | 
    
         
             
            - lib/rubocop/config_obsoletion.rb
         
     | 
| 
         @@ -291,6 +295,7 @@ files: 
     | 
|
| 
       291 
295 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/node_destructuring.rb
         
     | 
| 
       292 
296 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
         
     | 
| 
       293 
297 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/node_type_predicate.rb
         
     | 
| 
      
 298 
     | 
    
         
            +
            - lib/rubocop/cop/internal_affairs/numblock_handler.rb
         
     | 
| 
       294 
299 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
         
     | 
| 
       295 
300 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
         
     | 
| 
       296 
301 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
         
     | 
| 
         @@ -298,6 +303,7 @@ files: 
     | 
|
| 
       298 
303 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
         
     | 
| 
       299 
304 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
         
     | 
| 
       300 
305 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
         
     | 
| 
      
 306 
     | 
    
         
            +
            - lib/rubocop/cop/internal_affairs/single_line_comparison.rb
         
     | 
| 
       301 
307 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
         
     | 
| 
       302 
308 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/undefined_config.rb
         
     | 
| 
       303 
309 
     | 
    
         
             
            - lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
         
     | 
| 
         @@ -426,6 +432,7 @@ files: 
     | 
|
| 
       426 
432 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_case_condition.rb
         
     | 
| 
       427 
433 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_elsif_condition.rb
         
     | 
| 
       428 
434 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_hash_key.rb
         
     | 
| 
      
 435 
     | 
    
         
            +
            - lib/rubocop/cop/lint/duplicate_magic_comment.rb
         
     | 
| 
       429 
436 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_methods.rb
         
     | 
| 
       430 
437 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb
         
     | 
| 
       431 
438 
     | 
    
         
             
            - lib/rubocop/cop/lint/duplicate_require.rb
         
     | 
| 
         @@ -581,7 +588,6 @@ files: 
     | 
|
| 
       581 
588 
     | 
    
         
             
            - lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
         
     | 
| 
       582 
589 
     | 
    
         
             
            - lib/rubocop/cop/mixin/hash_transform_method.rb
         
     | 
| 
       583 
590 
     | 
    
         
             
            - lib/rubocop/cop/mixin/heredoc.rb
         
     | 
| 
       584 
     | 
    
         
            -
            - lib/rubocop/cop/mixin/ignored_methods.rb
         
     | 
| 
       585 
591 
     | 
    
         
             
            - lib/rubocop/cop/mixin/integer_node.rb
         
     | 
| 
       586 
592 
     | 
    
         
             
            - lib/rubocop/cop/mixin/interpolation.rb
         
     | 
| 
       587 
593 
     | 
    
         
             
            - lib/rubocop/cop/mixin/line_length_help.rb
         
     | 
| 
         @@ -746,6 +752,7 @@ files: 
     | 
|
| 
       746 
752 
     | 
    
         
             
            - lib/rubocop/cop/style/lambda.rb
         
     | 
| 
       747 
753 
     | 
    
         
             
            - lib/rubocop/cop/style/lambda_call.rb
         
     | 
| 
       748 
754 
     | 
    
         
             
            - lib/rubocop/cop/style/line_end_concatenation.rb
         
     | 
| 
      
 755 
     | 
    
         
            +
            - lib/rubocop/cop/style/magic_comment_format.rb
         
     | 
| 
       749 
756 
     | 
    
         
             
            - lib/rubocop/cop/style/map_compact_with_conditional_block.rb
         
     | 
| 
       750 
757 
     | 
    
         
             
            - lib/rubocop/cop/style/map_to_hash.rb
         
     | 
| 
       751 
758 
     | 
    
         
             
            - lib/rubocop/cop/style/method_call_with_args_parentheses.rb
         
     | 
| 
         @@ -791,6 +798,7 @@ files: 
     | 
|
| 
       791 
798 
     | 
    
         
             
            - lib/rubocop/cop/style/object_then.rb
         
     | 
| 
       792 
799 
     | 
    
         
             
            - lib/rubocop/cop/style/one_line_conditional.rb
         
     | 
| 
       793 
800 
     | 
    
         
             
            - lib/rubocop/cop/style/open_struct_use.rb
         
     | 
| 
      
 801 
     | 
    
         
            +
            - lib/rubocop/cop/style/operator_method_call.rb
         
     | 
| 
       794 
802 
     | 
    
         
             
            - lib/rubocop/cop/style/option_hash.rb
         
     | 
| 
       795 
803 
     | 
    
         
             
            - lib/rubocop/cop/style/optional_arguments.rb
         
     | 
| 
       796 
804 
     | 
    
         
             
            - lib/rubocop/cop/style/optional_boolean_parameter.rb
         
     | 
| 
         @@ -827,6 +835,7 @@ files: 
     | 
|
| 
       827 
835 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_self_assignment_branch.rb
         
     | 
| 
       828 
836 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_sort.rb
         
     | 
| 
       829 
837 
     | 
    
         
             
            - lib/rubocop/cop/style/redundant_sort_by.rb
         
     | 
| 
      
 838 
     | 
    
         
            +
            - lib/rubocop/cop/style/redundant_string_escape.rb
         
     | 
| 
       830 
839 
     | 
    
         
             
            - lib/rubocop/cop/style/regexp_literal.rb
         
     | 
| 
       831 
840 
     | 
    
         
             
            - lib/rubocop/cop/style/rescue_modifier.rb
         
     | 
| 
       832 
841 
     | 
    
         
             
            - lib/rubocop/cop/style/rescue_standard_error.rb
         
     | 
| 
         @@ -897,8 +906,10 @@ files: 
     | 
|
| 
       897 
906 
     | 
    
         
             
            - lib/rubocop/directive_comment.rb
         
     | 
| 
       898 
907 
     | 
    
         
             
            - lib/rubocop/error.rb
         
     | 
| 
       899 
908 
     | 
    
         
             
            - lib/rubocop/ext/processed_source.rb
         
     | 
| 
      
 909 
     | 
    
         
            +
            - lib/rubocop/ext/range.rb
         
     | 
| 
       900 
910 
     | 
    
         
             
            - lib/rubocop/ext/regexp_node.rb
         
     | 
| 
       901 
911 
     | 
    
         
             
            - lib/rubocop/ext/regexp_parser.rb
         
     | 
| 
      
 912 
     | 
    
         
            +
            - lib/rubocop/feature_loader.rb
         
     | 
| 
       902 
913 
     | 
    
         
             
            - lib/rubocop/file_finder.rb
         
     | 
| 
       903 
914 
     | 
    
         
             
            - lib/rubocop/formatter.rb
         
     | 
| 
       904 
915 
     | 
    
         
             
            - lib/rubocop/formatter/auto_gen_config_formatter.rb
         
     | 
| 
         @@ -971,7 +982,7 @@ metadata: 
     | 
|
| 
       971 
982 
     | 
    
         
             
              homepage_uri: https://rubocop.org/
         
     | 
| 
       972 
983 
     | 
    
         
             
              changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
         
     | 
| 
       973 
984 
     | 
    
         
             
              source_code_uri: https://github.com/rubocop/rubocop/
         
     | 
| 
       974 
     | 
    
         
            -
              documentation_uri: https://docs.rubocop.org/rubocop/1. 
     | 
| 
      
 985 
     | 
    
         
            +
              documentation_uri: https://docs.rubocop.org/rubocop/1.37/
         
     | 
| 
       975 
986 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rubocop/rubocop/issues
         
     | 
| 
       976 
987 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       977 
988 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
         @@ -1,52 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module RuboCop
         
     | 
| 
       4 
     | 
    
         
            -
              module Cop
         
     | 
| 
       5 
     | 
    
         
            -
                # This module encapsulates the ability to ignore certain methods when
         
     | 
| 
       6 
     | 
    
         
            -
                # parsing.
         
     | 
| 
       7 
     | 
    
         
            -
                # Cops that use `IgnoredMethods` can accept either strings or regexes to match
         
     | 
| 
       8 
     | 
    
         
            -
                # against.
         
     | 
| 
       9 
     | 
    
         
            -
                module IgnoredMethods
         
     | 
| 
       10 
     | 
    
         
            -
                  # Configuration for IgnoredMethods. It is added to classes that include
         
     | 
| 
       11 
     | 
    
         
            -
                  # the module so that configuration can be set using the `ignored_methods`
         
     | 
| 
       12 
     | 
    
         
            -
                  # class macro.
         
     | 
| 
       13 
     | 
    
         
            -
                  module Config
         
     | 
| 
       14 
     | 
    
         
            -
                    attr_accessor :deprecated_key
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                    def ignored_methods(**config)
         
     | 
| 
       17 
     | 
    
         
            -
                      self.deprecated_key = config[:deprecated_key]
         
     | 
| 
       18 
     | 
    
         
            -
                    end
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  def self.included(base)
         
     | 
| 
       22 
     | 
    
         
            -
                    base.extend(Config)
         
     | 
| 
       23 
     | 
    
         
            -
                  end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                  def ignored_method?(name)
         
     | 
| 
       26 
     | 
    
         
            -
                    ignored_methods.any? do |value|
         
     | 
| 
       27 
     | 
    
         
            -
                      case value
         
     | 
| 
       28 
     | 
    
         
            -
                      when Regexp
         
     | 
| 
       29 
     | 
    
         
            -
                        value.match? String(name)
         
     | 
| 
       30 
     | 
    
         
            -
                      else
         
     | 
| 
       31 
     | 
    
         
            -
                        value == String(name)
         
     | 
| 
       32 
     | 
    
         
            -
                      end
         
     | 
| 
       33 
     | 
    
         
            -
                    end
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  def ignored_methods
         
     | 
| 
       37 
     | 
    
         
            -
                    keys = %w[IgnoredMethods]
         
     | 
| 
       38 
     | 
    
         
            -
                    keys << deprecated_key if deprecated_key
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                    cop_config.slice(*keys).values.reduce(&:concat)
         
     | 
| 
       41 
     | 
    
         
            -
                  end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                  private
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                  def deprecated_key
         
     | 
| 
       46 
     | 
    
         
            -
                    return unless self.class.respond_to?(:deprecated_key)
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                    self.class.deprecated_key&.to_s
         
     | 
| 
       49 
     | 
    
         
            -
                  end
         
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
       51 
     | 
    
         
            -
              end
         
     | 
| 
       52 
     | 
    
         
            -
            end
         
     |