rubocop 1.80.2 → 1.81.7
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 +14 -2
 - data/lib/rubocop/cli/command/auto_generate_config.rb +2 -2
 - data/lib/rubocop/cli.rb +1 -2
 - data/lib/rubocop/config_loader.rb +3 -1
 - data/lib/rubocop/config_loader_resolver.rb +5 -4
 - data/lib/rubocop/config_store.rb +5 -0
 - data/lib/rubocop/cop/autocorrect_logic.rb +4 -4
 - data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
 - data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +3 -1
 - data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +1 -1
 - data/lib/rubocop/cop/layout/class_structure.rb +1 -1
 - data/lib/rubocop/cop/layout/dot_position.rb +1 -1
 - data/lib/rubocop/cop/layout/empty_line_between_defs.rb +30 -12
 - data/lib/rubocop/cop/layout/hash_alignment.rb +2 -5
 - data/lib/rubocop/cop/layout/line_length.rb +9 -1
 - data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +6 -4
 - data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +8 -0
 - data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
 - data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +3 -2
 - data/lib/rubocop/cop/lint/cop_directive_syntax.rb +13 -7
 - data/lib/rubocop/cop/lint/debugger.rb +0 -2
 - data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +4 -1
 - data/lib/rubocop/cop/lint/empty_interpolation.rb +11 -0
 - data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +16 -6
 - data/lib/rubocop/cop/lint/rescue_exception.rb +1 -4
 - data/lib/rubocop/cop/lint/self_assignment.rb +1 -1
 - data/lib/rubocop/cop/lint/shadowed_argument.rb +7 -7
 - data/lib/rubocop/cop/lint/void.rb +7 -0
 - data/lib/rubocop/cop/message_annotator.rb +1 -1
 - data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
 - data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
 - data/lib/rubocop/cop/naming/method_name.rb +3 -1
 - data/lib/rubocop/cop/naming/predicate_method.rb +16 -4
 - data/lib/rubocop/cop/security/json_load.rb +33 -11
 - data/lib/rubocop/cop/style/array_intersect.rb +2 -2
 - data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +47 -0
 - data/lib/rubocop/cop/style/conditional_assignment.rb +7 -3
 - data/lib/rubocop/cop/style/constant_visibility.rb +14 -9
 - data/lib/rubocop/cop/style/double_negation.rb +1 -1
 - data/lib/rubocop/cop/style/endless_method.rb +15 -2
 - data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
 - data/lib/rubocop/cop/style/float_division.rb +15 -1
 - data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
 - data/lib/rubocop/cop/style/nil_comparison.rb +9 -7
 - data/lib/rubocop/cop/style/one_line_conditional.rb +17 -9
 - data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
 - data/lib/rubocop/cop/style/redundant_format.rb +26 -5
 - data/lib/rubocop/cop/style/redundant_interpolation.rb +11 -2
 - data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -0
 - data/lib/rubocop/cop/style/redundant_regexp_argument.rb +4 -0
 - data/lib/rubocop/cop/style/redundant_regexp_escape.rb +8 -0
 - data/lib/rubocop/cop/style/semicolon.rb +23 -7
 - data/lib/rubocop/cop/style/sole_nested_conditional.rb +8 -1
 - data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +45 -0
 - data/lib/rubocop/cop/style/unless_else.rb +10 -9
 - data/lib/rubocop/cop/utils/format_string.rb +10 -0
 - data/lib/rubocop/cops_documentation_generator.rb +4 -4
 - data/lib/rubocop/lsp/diagnostic.rb +21 -20
 - data/lib/rubocop/lsp/routes.rb +36 -9
 - data/lib/rubocop/lsp/runtime.rb +2 -2
 - data/lib/rubocop/lsp/server.rb +2 -2
 - data/lib/rubocop/lsp/stdin_runner.rb +0 -16
 - data/lib/rubocop/target_ruby.rb +10 -1
 - data/lib/rubocop/version.rb +1 -1
 - data/lib/rubocop.rb +1 -0
 - data/lib/ruby_lsp/rubocop/addon.rb +23 -8
 - data/lib/ruby_lsp/rubocop/runtime_adapter.rb +49 -15
 - metadata +7 -6
 
| 
         @@ -7,30 +7,45 @@ module RubyLsp 
     | 
|
| 
       7 
7 
     | 
    
         
             
                # Provides an adapter to bridge RuboCop's built-in LSP runtime with Ruby LSP's add-on.
         
     | 
| 
       8 
8 
     | 
    
         
             
                # @api private
         
     | 
| 
       9 
9 
     | 
    
         
             
                class RuntimeAdapter
         
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
      
 10 
     | 
    
         
            +
                  def initialize(message_queue)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @message_queue = message_queue
         
     | 
| 
      
 12 
     | 
    
         
            +
                    reload_config
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                  def  
     | 
| 
       13 
     | 
    
         
            -
                     
     | 
| 
      
 15 
     | 
    
         
            +
                  def reload_config
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @runtime = nil
         
     | 
| 
      
 17 
     | 
    
         
            +
                    options, _paths = ::RuboCop::Options.new.parse([])
         
     | 
| 
       14 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
                    config_store = ::RuboCop::ConfigStore.new
         
     | 
| 
      
 20 
     | 
    
         
            +
                    config_store.apply_options!(options)
         
     | 
| 
       15 
21 
     | 
    
         
             
                    @runtime = ::RuboCop::LSP::Runtime.new(config_store)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  rescue ::RuboCop::Error => e
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @message_queue << Notification.window_show_message(
         
     | 
| 
      
 24 
     | 
    
         
            +
                      "RuboCop configuration error: #{e.message}. Formatting will not be available.",
         
     | 
| 
      
 25 
     | 
    
         
            +
                      type: Constant::MessageType::ERROR
         
     | 
| 
      
 26 
     | 
    
         
            +
                    )
         
     | 
| 
       16 
27 
     | 
    
         
             
                  end
         
     | 
| 
       17 
28 
     | 
    
         | 
| 
       18 
29 
     | 
    
         
             
                  def run_diagnostic(uri, document)
         
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
                       
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
                    with_error_handling do
         
     | 
| 
      
 31 
     | 
    
         
            +
                      @runtime.offenses(
         
     | 
| 
      
 32 
     | 
    
         
            +
                        uri_to_path(uri),
         
     | 
| 
      
 33 
     | 
    
         
            +
                        document.source,
         
     | 
| 
      
 34 
     | 
    
         
            +
                        document.encoding,
         
     | 
| 
      
 35 
     | 
    
         
            +
                        prism_result: prism_result(document)
         
     | 
| 
      
 36 
     | 
    
         
            +
                      )
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
       25 
38 
     | 
    
         
             
                  end
         
     | 
| 
       26 
39 
     | 
    
         | 
| 
       27 
40 
     | 
    
         
             
                  def run_formatting(uri, document)
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
                       
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
                    with_error_handling do
         
     | 
| 
      
 42 
     | 
    
         
            +
                      @runtime.format(
         
     | 
| 
      
 43 
     | 
    
         
            +
                        uri_to_path(uri),
         
     | 
| 
      
 44 
     | 
    
         
            +
                        document.source,
         
     | 
| 
      
 45 
     | 
    
         
            +
                        command: 'rubocop.formatAutocorrects',
         
     | 
| 
      
 46 
     | 
    
         
            +
                        prism_result: prism_result(document)
         
     | 
| 
      
 47 
     | 
    
         
            +
                      )
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
       34 
49 
     | 
    
         
             
                  end
         
     | 
| 
       35 
50 
     | 
    
         | 
| 
       36 
51 
     | 
    
         
             
                  def run_range_formatting(_uri, _partial_source, _base_indentation)
         
     | 
| 
         @@ -43,6 +58,25 @@ module RubyLsp 
     | 
|
| 
       43 
58 
     | 
    
         | 
| 
       44 
59 
     | 
    
         
             
                  private
         
     | 
| 
       45 
60 
     | 
    
         | 
| 
      
 61 
     | 
    
         
            +
                  def with_error_handling
         
     | 
| 
      
 62 
     | 
    
         
            +
                    return unless @runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    yield
         
     | 
| 
      
 65 
     | 
    
         
            +
                  rescue StandardError => e
         
     | 
| 
      
 66 
     | 
    
         
            +
                    ::RuboCop::LSP::Logger.log(e.full_message, prefix: '[RuboCop]')
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    message = if e.is_a?(::RuboCop::ErrorWithAnalyzedFileLocation)
         
     | 
| 
      
 69 
     | 
    
         
            +
                                "for the #{e.cop.name} cop"
         
     | 
| 
      
 70 
     | 
    
         
            +
                              else
         
     | 
| 
      
 71 
     | 
    
         
            +
                                "- #{e.message}"
         
     | 
| 
      
 72 
     | 
    
         
            +
                              end
         
     | 
| 
      
 73 
     | 
    
         
            +
                    raise Requests::Formatting::Error, <<~MSG
         
     | 
| 
      
 74 
     | 
    
         
            +
                      An internal error occurred #{message}.
         
     | 
| 
      
 75 
     | 
    
         
            +
                      Updating to a newer version of RuboCop may solve this.
         
     | 
| 
      
 76 
     | 
    
         
            +
                      For more details, run RuboCop on the command line.
         
     | 
| 
      
 77 
     | 
    
         
            +
                    MSG
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       46 
80 
     | 
    
         
             
                  # duplicated from: lib/standard/lsp/routes.rb
         
     | 
| 
       47 
81 
     | 
    
         
             
                  # modified to incorporate Ruby LSP's to_standardized_path method
         
     | 
| 
       48 
82 
     | 
    
         
             
                  def uri_to_path(uri)
         
     | 
    
        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.81.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Bozhidar Batsov
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            - Yuji Nakayama
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2025- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2025-10-31 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -127,7 +127,7 @@ dependencies: 
     | 
|
| 
       127 
127 
     | 
    
         
             
                requirements:
         
     | 
| 
       128 
128 
     | 
    
         
             
                - - ">="
         
     | 
| 
       129 
129 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       130 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 130 
     | 
    
         
            +
                    version: 1.47.1
         
     | 
| 
       131 
131 
     | 
    
         
             
                - - "<"
         
     | 
| 
       132 
132 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       133 
133 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
         @@ -137,7 +137,7 @@ dependencies: 
     | 
|
| 
       137 
137 
     | 
    
         
             
                requirements:
         
     | 
| 
       138 
138 
     | 
    
         
             
                - - ">="
         
     | 
| 
       139 
139 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       140 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 140 
     | 
    
         
            +
                    version: 1.47.1
         
     | 
| 
       141 
141 
     | 
    
         
             
                - - "<"
         
     | 
| 
       142 
142 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       143 
143 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
         @@ -708,6 +708,7 @@ files: 
     | 
|
| 
       708 
708 
     | 
    
         
             
            - lib/rubocop/cop/style/array_coercion.rb
         
     | 
| 
       709 
709 
     | 
    
         
             
            - lib/rubocop/cop/style/array_first_last.rb
         
     | 
| 
       710 
710 
     | 
    
         
             
            - lib/rubocop/cop/style/array_intersect.rb
         
     | 
| 
      
 711 
     | 
    
         
            +
            - lib/rubocop/cop/style/array_intersect_with_single_element.rb
         
     | 
| 
       711 
712 
     | 
    
         
             
            - lib/rubocop/cop/style/array_join.rb
         
     | 
| 
       712 
713 
     | 
    
         
             
            - lib/rubocop/cop/style/ascii_comments.rb
         
     | 
| 
       713 
714 
     | 
    
         
             
            - lib/rubocop/cop/style/attr.rb
         
     | 
| 
         @@ -1090,9 +1091,9 @@ licenses: 
     | 
|
| 
       1090 
1091 
     | 
    
         
             
            - MIT
         
     | 
| 
       1091 
1092 
     | 
    
         
             
            metadata:
         
     | 
| 
       1092 
1093 
     | 
    
         
             
              homepage_uri: https://rubocop.org/
         
     | 
| 
       1093 
     | 
    
         
            -
              changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1. 
     | 
| 
      
 1094 
     | 
    
         
            +
              changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.81.7
         
     | 
| 
       1094 
1095 
     | 
    
         
             
              source_code_uri: https://github.com/rubocop/rubocop/
         
     | 
| 
       1095 
     | 
    
         
            -
              documentation_uri: https://docs.rubocop.org/rubocop/1. 
     | 
| 
      
 1096 
     | 
    
         
            +
              documentation_uri: https://docs.rubocop.org/rubocop/1.81/
         
     | 
| 
       1096 
1097 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rubocop/rubocop/issues
         
     | 
| 
       1097 
1098 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       1098 
1099 
     | 
    
         
             
            rdoc_options: []
         
     |