Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-rubocop for openSUSE:Factory 
checked in at 2022-03-10 22:46:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2349 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-rubocop"

Thu Mar 10 22:46:05 2022 rev:35 rq:960905 version:1.26.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes  
2022-02-24 18:23:38.702655480 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2349/rubygem-rubocop.changes    
    2022-03-11 11:35:30.558214000 +0100
@@ -1,0 +2,29 @@
+Thu Mar 10 16:37:22 UTC 2022 - Manuel Schnitzer <mschnit...@suse.com>
+
+- updated to version 1.26.0
+
+  ### New features
+
+  * [#10419](https://github.com/rubocop/rubocop/pull/10419): Add new 
`Style/NestedFileDirname` cop. ([@koic][])
+  * [#10433](https://github.com/rubocop/rubocop/pull/10433): Support 
`TargetRubyVersion 3.2` (experimental). ([@koic][])
+
+  ### Bug fixes
+
+  * [#10406](https://github.com/rubocop/rubocop/pull/10406): Fix a false 
positive for `Lint/InheritException` when inheriting a standard lib exception 
class that is not a subclass of `StandardError`. ([@koic][])
+  * [#10421](https://github.com/rubocop/rubocop/issues/10421): Make 
`Style/DefWithParentheses` aware of endless method definition. ([@koic][])
+  * [#10401](https://github.com/rubocop/rubocop/issues/10401): Fix a false 
positive for `Style/HashSyntax` when local variable hash key and hash value are 
the same. ([@koic][])
+  * [#10424](https://github.com/rubocop/rubocop/pull/10424): Fix a false 
positive for `Security/YamlLoad` when using Ruby 3.1+ (Psych 4). ([@koic][])
+  * [#10446](https://github.com/rubocop/rubocop/pull/10446): 
Lint/RedundantDirGlobSort unset SafeAutoCorrect. ([@friendlyantz][])
+  * [#10403](https://github.com/rubocop/rubocop/issues/10403): Fix an error 
for `Style/StringConcatenation` when string concatenation with multiline 
heredoc text. ([@koic][])
+  * [#10432](https://github.com/rubocop/rubocop/pull/10432): Fix an error when 
using regexp with non-encoding option. ([@koic][])
+  * [#10415](https://github.com/rubocop/rubocop/issues/10415): Fix an error 
for `Lint/UselessTimes` when using `1.times` with method chain. ([@koic][])
+
+  ### Changes
+
+  * [#10408](https://github.com/rubocop/rubocop/pull/10408): Mark 
`Lint/InheritException` as unsafe auto-correction. ([@koic][])
+  * [#10407](https://github.com/rubocop/rubocop/pull/10407): Change 
`EnforcedStyle` from `runtime_error` to `standard_error` for 
`Lint/InheritException`. ([@koic][])
+  * [#10414](https://github.com/rubocop/rubocop/pull/10414): Update 
auto-gen-config's auto-correction comments to be more clear. ([@maxjacobson][])
+  * [#10427](https://github.com/rubocop/rubocop/issues/10427): Mark 
`Style/For` as unsafe auto-correction. ([@issyl0][])
+  * [#10410](https://github.com/rubocop/rubocop/issues/10410): Improve help 
string for `--fail-level` CLI option. ([@tejasbubane][])
+
+-------------------------------------------------------------------

Old:
----
  rubocop-1.25.1.gem

New:
----
  rubocop-1.26.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-rubocop.spec ++++++
--- /var/tmp/diff_new_pack.BqLIFx/_old  2022-03-11 11:35:31.034214558 +0100
+++ /var/tmp/diff_new_pack.BqLIFx/_new  2022-03-11 11:35:31.038214563 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-rubocop
-Version:        1.25.1
+Version:        1.26.0
 Release:        0
 %define mod_name rubocop
 %define mod_full_name %{mod_name}-%{version}

++++++ rubocop-1.25.1.gem -> rubocop-1.26.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2022-02-03 07:44:29.000000000 +0100
+++ new/README.md       2022-03-09 17:40:19.000000000 +0100
@@ -53,7 +53,7 @@
 in your `Gemfile`:
 
 ```rb
-gem 'rubocop', '~> 1.25', require: false
+gem 'rubocop', '~> 1.26', require: false
 ```
 
 See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) 
for further details.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/config/default.yml new/config/default.yml
--- old/config/default.yml      2022-02-03 07:44:29.000000000 +0100
+++ new/config/default.yml      2022-03-09 17:40:19.000000000 +0100
@@ -262,7 +262,7 @@
     - '**/*.gemspec'
 
 Gemspec/RequireMFA:
-  Description: 'Checks that the gemspec has metadata to require MFA from 
RubyGems.'
+  Description: 'Checks that the gemspec has metadata to require Multi-Factor 
Authentication from RubyGems.'
   Enabled: pending
   VersionAdded: '1.23'
   Reference:
@@ -1816,12 +1816,14 @@
 Lint/InheritException:
   Description: 'Avoid inheriting from the `Exception` class.'
   Enabled: true
+  SafeAutoCorrect: false
   VersionAdded: '0.41'
+  VersionChanged: '1.26'
   # The default base class in favour of `Exception`.
-  EnforcedStyle: runtime_error
+  EnforcedStyle: standard_error
   SupportedStyles:
-    - runtime_error
     - standard_error
+    - runtime_error
 
 Lint/InterpolationCheck:
   Description: 'Raise warning for interpolation in single q strs.'
@@ -2011,6 +2013,8 @@
   Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
   Enabled: pending
   VersionAdded: '1.8'
+  VersionChanged: '1.26'
+  SafeAutoCorrect: false
 
 Lint/RedundantRequireStatement:
   Description: 'Checks for unnecessary `require` statement.'
@@ -3542,8 +3546,9 @@
   Description: 'Checks use of for or each in multiline loops.'
   StyleGuide: '#no-for-loops'
   Enabled: true
+  SafeAutoCorrect: false
   VersionAdded: '0.13'
-  VersionChanged: '0.59'
+  VersionChanged: '1.26'
   EnforcedStyle: each
   SupportedStyles:
     - each
@@ -4122,6 +4127,11 @@
   Enabled: true
   VersionAdded: '0.20'
 
+Style/NestedFileDirname:
+  Description: 'Checks for nested `File.dirname`.'
+  Enabled: pending
+  VersionAdded: '1.26'
+
 Style/NestedModifier:
   Description: 'Avoid using nested modifiers.'
   StyleGuide: '#no-nested-modifiers'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cli.rb new/lib/rubocop/cli.rb
--- old/lib/rubocop/cli.rb      2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cli.rb      2022-03-09 17:40:19.000000000 +0100
@@ -14,7 +14,7 @@
       ignore_disable_comments lint only only_guide_cops require safe
     ].freeze
 
-    class Finished < RuntimeError; end
+    class Finished < StandardError; end
 
     attr_reader :options, :config_store
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/badge.rb new/lib/rubocop/cop/badge.rb
--- old/lib/rubocop/cop/badge.rb        2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/badge.rb        2022-03-09 17:40:19.000000000 +0100
@@ -19,7 +19,13 @@
       end
 
       def self.parse(identifier)
-        new(identifier.split('/'))
+        new(identifier.split('/').map { |i| camel_case(i) })
+      end
+
+      def self.camel_case(name_part)
+        return 'RSpec' if name_part == 'rspec'
+
+        name_part.gsub(/^\w|_\w/) { |match| match[-1, 1].upcase }
       end
 
       def initialize(class_name_parts)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/gemspec/require_mfa.rb 
new/lib/rubocop/cop/gemspec/require_mfa.rb
--- old/lib/rubocop/cop/gemspec/require_mfa.rb  2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/gemspec/require_mfa.rb  2022-03-09 17:40:19.000000000 
+0100
@@ -5,9 +5,10 @@
     module Gemspec
       # Requires a gemspec to have `rubygems_mfa_required` metadata set.
       #
-      # This setting tells RubyGems that MFA is required for accounts to
-      # be able perform privileged operations, such as (see
-      # RubyGems' documentation for the full list of privileged operations):
+      # This setting tells RubyGems that MFA (Multi-Factor Authentication) is
+      # required for accounts to be able perform privileged operations, such as
+      # (see RubyGems' documentation for the full list of privileged
+      # operations):
       #
       # * `gem push`
       # * `gem yank`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/generator.rb 
new/lib/rubocop/cop/generator.rb
--- old/lib/rubocop/cop/generator.rb    2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/generator.rb    2022-03-09 17:40:19.000000000 +0100
@@ -8,13 +8,7 @@
     # and spec file when given a valid qualified cop name.
     # @api private
     class Generator
-      # NOTE: RDoc 5.1.0 or lower has the following issue.
-      # https://github.com/rubocop/rubocop/issues/7043
-      #
-      # The following `String#gsub` can be replaced with
-      # squiggly heredoc when RuboCop supports Ruby 2.5 or higher
-      # (RDoc 6.0 or higher).
-      SOURCE_TEMPLATE = <<-RUBY.gsub(/^ {8}/, '')
+      SOURCE_TEMPLATE = <<~RUBY
         # frozen_string_literal: true
 
         module RuboCop
@@ -68,6 +62,7 @@
                 # For example
                 MSG = 'Use `#good_method` instead of `#bad_method`.'
 
+                # @!method bad_method?(node)
                 def_node_matcher :bad_method?, <<~PATTERN
                   (send nil? :bad_method ...)
                 PATTERN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb 
new/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
--- old/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb  
1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb  
2022-03-09 17:40:19.000000000 +0100
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module Cop
+    module InternalAffairs
+      # Checks for redundant `:config` parameter in the `context` arguments.
+      #
+      # @example
+      #
+      #   # bad
+      #   context 'foo', :config do
+      #   end
+      #
+      #   # good
+      #   context 'foo' do
+      #   end
+      #
+      class RedundantContextConfigParameter < Base
+        include RangeHelp
+        extend AutoCorrector
+
+        MSG = 'Remove the redundant `:config` parameter.'
+        RESTRICT_ON_SEND = %i[context].freeze
+
+        def on_send(node)
+          arguments = node.arguments
+          config_node = arguments.detect { |argument| argument.source == 
':config' }
+          return unless config_node
+
+          add_offense(config_node) do |corrector|
+            dup_arguments = arguments.dup
+            dup_arguments.delete(config_node)
+
+            corrector.replace(offense_range(arguments), 
dup_arguments.map(&:source).join(', '))
+          end
+        end
+
+        private
+
+        def offense_range(arguments)
+          range_between(arguments.first.source_range.begin_pos, 
arguments.last.source_range.end_pos)
+        end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/internal_affairs.rb 
new/lib/rubocop/cop/internal_affairs.rb
--- old/lib/rubocop/cop/internal_affairs.rb     2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/internal_affairs.rb     2022-03-09 17:40:19.000000000 
+0100
@@ -9,6 +9,7 @@
 require_relative 'internal_affairs/node_matcher_directive'
 require_relative 'internal_affairs/node_type_predicate'
 require_relative 'internal_affairs/offense_location_keyword'
+require_relative 'internal_affairs/redundant_context_config_parameter'
 require_relative 'internal_affairs/redundant_described_class_as_subject'
 require_relative 'internal_affairs/redundant_let_rubocop_config_new'
 require_relative 'internal_affairs/redundant_location_argument'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/layout/case_indentation.rb 
new/lib/rubocop/cop/layout/case_indentation.rb
--- old/lib/rubocop/cop/layout/case_indentation.rb      2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/layout/case_indentation.rb      2022-03-09 
17:40:19.000000000 +0100
@@ -3,7 +3,7 @@
 module RuboCop
   module Cop
     module Layout
-      # This cop checks how the `when` and `in`s of a `case` expression
+      # This cop checks how the `when` and ``in``s of a `case` expression
       # are indented in relation to its `case` or `end` keyword.
       #
       # It will register a separate offense for each misaligned `when` and 
`in`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/rubocop/cop/layout/multiline_operation_indentation.rb 
new/lib/rubocop/cop/layout/multiline_operation_indentation.rb
--- old/lib/rubocop/cop/layout/multiline_operation_indentation.rb       
2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/layout/multiline_operation_indentation.rb       
2022-03-09 17:40:19.000000000 +0100
@@ -3,27 +3,26 @@
 module RuboCop
   module Cop
     module Layout
-      # This cop checks the indentation of the right hand side operand in
-      # binary operations that span more than one line.
+      # This cop checks the indentation of the right hand side operand in 
binary operations that
+      # span more than one line.
       #
-      # The `aligned` style checks that operators are aligned if they are part
-      # of an `if` or `while` condition, a `return` statement, etc. In other
-      # contexts, the second operand should be indented regardless of enforced
-      # style.
+      # The `aligned` style checks that operators are aligned if they are part 
of an `if` or `while`
+      # condition, an explicit `return` statement, etc. In other contexts, the 
second operand should
+      # be indented regardless of enforced style.
       #
       # @example EnforcedStyle: aligned (default)
       #   # bad
       #   if a +
       #       b
       #     something &&
-      #       something_else
+      #     something_else
       #   end
       #
       #   # good
       #   if a +
       #      b
       #     something &&
-      #     something_else
+      #       something_else
       #   end
       #
       # @example EnforcedStyle: indented
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/inherit_exception.rb 
new/lib/rubocop/cop/lint/inherit_exception.rb
--- old/lib/rubocop/cop/lint/inherit_exception.rb       2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/lint/inherit_exception.rb       2022-03-09 
17:40:19.000000000 +0100
@@ -3,12 +3,16 @@
 module RuboCop
   module Cop
     module Lint
-      # This cop looks for error classes inheriting from `Exception`
-      # and its standard library subclasses, excluding subclasses of
-      # `StandardError`. It is configurable to suggest using either
-      # `RuntimeError` (default) or `StandardError` instead.
+      # This cop looks for error classes inheriting from `Exception`.
+      # It is configurable to suggest using either `StandardError` (default) or
+      # `RuntimeError` instead.
+      #
+      # @safety
+      #   This cop's autocorrection is unsafe because `rescue` that omit
+      #   exception class handle `StandardError` and its subclasses,
+      #   but not `Exception` and its subclasses.
       #
-      # @example EnforcedStyle: runtime_error (default)
+      # @example EnforcedStyle: standard_error (default)
       #   # bad
       #
       #   class C < Exception; end
@@ -17,11 +21,11 @@
       #
       #   # good
       #
-      #   class C < RuntimeError; end
+      #   class C < StandardError; end
       #
-      #   C = Class.new(RuntimeError)
+      #   C = Class.new(StandardError)
       #
-      # @example EnforcedStyle: standard_error
+      # @example EnforcedStyle: runtime_error
       #   # bad
       #
       #   class C < Exception; end
@@ -30,31 +34,18 @@
       #
       #   # good
       #
-      #   class C < StandardError; end
+      #   class C < RuntimeError; end
       #
-      #   C = Class.new(StandardError)
+      #   C = Class.new(RuntimeError)
       class InheritException < Base
         include ConfigurableEnforcedStyle
         extend AutoCorrector
 
-        MSG = 'Inherit from `%<prefer>s` instead of `%<current>s`.'
+        MSG = 'Inherit from `%<prefer>s` instead of `Exception`.'
         PREFERRED_BASE_CLASS = {
           runtime_error: 'RuntimeError',
           standard_error: 'StandardError'
         }.freeze
-        ILLEGAL_CLASSES = %w[
-          Exception
-          SystemStackError
-          NoMemoryError
-          SecurityError
-          NotImplementedError
-          LoadError
-          SyntaxError
-          ScriptError
-          Interrupt
-          SignalException
-          SystemExit
-        ].freeze
 
         RESTRICT_ON_SEND = %i[new].freeze
 
@@ -66,7 +57,7 @@
         PATTERN
 
         def on_class(node)
-          return unless node.parent_class && 
illegal_class_name?(node.parent_class)
+          return unless node.parent_class && 
exception_class?(node.parent_class)
 
           message = message(node.parent_class)
 
@@ -77,7 +68,7 @@
 
         def on_send(node)
           constant = class_new_call?(node)
-          return unless constant && illegal_class_name?(constant)
+          return unless constant && exception_class?(constant)
 
           message = message(constant)
 
@@ -92,8 +83,8 @@
           format(MSG, prefer: preferred_base_class, current: node.const_name)
         end
 
-        def illegal_class_name?(class_node)
-          ILLEGAL_CLASSES.include?(class_node.const_name)
+        def exception_class?(class_node)
+          class_node.const_name == 'Exception'
         end
 
         def preferred_base_class
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb 
new/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb
--- old/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb       
2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb       
2022-03-09 17:40:19.000000000 +0100
@@ -19,7 +19,7 @@
         include RangeHelp
         extend AutoCorrector
 
-        MSG = '`(...)` interpreted as grouped expression.'
+        MSG = '`%<argument>s` interpreted as grouped expression.'
 
         def on_send(node)
           return if valid_context?(node)
@@ -28,8 +28,9 @@
           return unless space_length.positive?
 
           range = space_range(node.first_argument.source_range, space_length)
+          message = format(MSG, argument: node.first_argument.source)
 
-          add_offense(range) { |corrector| corrector.remove(range) }
+          add_offense(range, message: message) { |corrector| 
corrector.remove(range) }
         end
         alias on_csend on_send
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb 
new/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb
--- old/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb 2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb 2022-03-09 
17:40:19.000000000 +0100
@@ -6,6 +6,11 @@
       # Sort globbed results by default in Ruby 3.0.
       # This cop checks for redundant `sort` method to `Dir.glob` and `Dir[]`.
       #
+      # @safety
+      # This cop is unsafe, in case of having a file and a directory with
+      # identical names, since directory will be loaded before the file, which
+      # will break `exe/files.rb` that rely on `exe.rb` file.
+      #
       # @example
       #
       #   # bad
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/useless_times.rb 
new/lib/rubocop/cop/lint/useless_times.rb
--- old/lib/rubocop/cop/lint/useless_times.rb   2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/lint/useless_times.rb   2022-03-09 17:40:19.000000000 
+0100
@@ -51,20 +51,24 @@
           node = node.block_node if node.block_literal?
 
           add_offense(node, message: format(MSG, count: count)) do |corrector|
-            next unless own_line?(node)
+            next if !own_line?(node) || node.parent&.send_type?
 
-            if never_process?(count, node)
-              remove_node(corrector, node)
-            elsif !proc_name.empty?
-              autocorrect_block_pass(corrector, node, proc_name)
-            else
-              autocorrect_block(corrector, node)
-            end
+            autocorrect(corrector, count, node, proc_name)
           end
         end
 
         private
 
+        def autocorrect(corrector, count, node, proc_name)
+          if never_process?(count, node)
+            remove_node(corrector, node)
+          elsif !proc_name.empty?
+            autocorrect_block_pass(corrector, node, proc_name)
+          else
+            autocorrect_block(corrector, node)
+          end
+        end
+
         def never_process?(count, node)
           count < 1 || (node.block_type? && node.body.nil?)
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb 
new/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
--- old/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb  2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb  2022-03-09 
17:40:19.000000000 +0100
@@ -41,7 +41,7 @@
       end
 
       def require_hash_value?(hash_key_source, node)
-        return true if require_hash_value_for_around_hash_literal?(node)
+        return true if !node.key.sym_type? || 
require_hash_value_for_around_hash_literal?(node)
 
         hash_value = node.value
         return true unless hash_value.send_type? || hash_value.lvar_type?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/security/yaml_load.rb 
new/lib/rubocop/cop/security/yaml_load.rb
--- old/lib/rubocop/cop/security/yaml_load.rb   2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/security/yaml_load.rb   2022-03-09 17:40:19.000000000 
+0100
@@ -7,17 +7,21 @@
       # potential security issues leading to remote code execution when
       # loading from an untrusted source.
       #
+      # NOTE: Ruby 3.1+ (Psych 4) uses `Psych.load` as `Psych.safe_load` by 
default.
+      #
       # @safety
       #   The behaviour of the code might change depending on what was
       #   in the YAML payload, since `YAML.safe_load` is more restrictive.
       #
       # @example
       #   # bad
-      #   YAML.load("--- foo")
+      #   YAML.load("--- !ruby/object:Foo {}") # Psych 3 is unsafe by default
       #
       #   # good
-      #   YAML.safe_load("--- foo")
-      #   YAML.dump("foo")
+      #   YAML.safe_load("--- !ruby/object:Foo {}", [Foo])                    
# Ruby 2.5  (Psych 3)
+      #   YAML.safe_load("--- !ruby/object:Foo {}", permitted_classes: [Foo]) 
# Ruby 3.0- (Psych 3)
+      #   YAML.load("--- !ruby/object:Foo {}", permitted_classes: [Foo])      
# Ruby 3.1+ (Psych 4)
+      #   YAML.dump(foo)
       #
       class YAMLLoad < Base
         extend AutoCorrector
@@ -31,6 +35,8 @@
         PATTERN
 
         def on_send(node)
+          return if target_ruby_version >= 3.1
+
           yaml_load(node) do
             add_offense(node.loc.selector) do |corrector|
               corrector.replace(node.loc.selector, 'safe_load')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/def_with_parentheses.rb 
new/lib/rubocop/cop/style/def_with_parentheses.rb
--- old/lib/rubocop/cop/style/def_with_parentheses.rb   2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/def_with_parentheses.rb   2022-03-09 
17:40:19.000000000 +0100
@@ -11,27 +11,33 @@
       #
       #   # bad
       #   def foo()
-      #     # does a thing
+      #     do_something
       #   end
       #
       #   # good
       #   def foo
-      #     # does a thing
+      #     do_something
       #   end
       #
-      #   # also good
-      #   def foo() does_a_thing end
+      #   # bad
+      #   def foo() = do_something
+      #
+      #   # good
+      #   def foo = do_something
+      #
+      #   # good (without parentheses it's a syntax error)
+      #   def foo() do_something end
       #
       # @example
       #
       #   # bad
       #   def Baz.foo()
-      #     # does a thing
+      #     do_something
       #   end
       #
       #   # good
       #   def Baz.foo
-      #     # does a thing
+      #     do_something
       #   end
       class DefWithParentheses < Base
         extend AutoCorrector
@@ -39,12 +45,11 @@
         MSG = "Omit the parentheses in defs when the method doesn't accept any 
arguments."
 
         def on_def(node)
-          return if node.single_line?
-          return unless !node.arguments? && (node_arguments_loc_begin = 
node.arguments.loc.begin)
+          return if node.single_line? && !node.endless?
+          return unless !node.arguments? && (node_arguments = 
node.arguments.source_range)
 
-          add_offense(node_arguments_loc_begin) do |corrector|
-            corrector.remove(node_arguments_loc_begin)
-            corrector.remove(node.arguments.loc.end)
+          add_offense(node_arguments) do |corrector|
+            corrector.remove(node_arguments)
           end
         end
         alias on_defs on_def
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/for.rb 
new/lib/rubocop/cop/style/for.rb
--- old/lib/rubocop/cop/style/for.rb    2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/for.rb    2022-03-09 17:40:19.000000000 +0100
@@ -38,6 +38,10 @@
       #     end
       #   end
       #
+      # @safety
+      #   This cop's autocorrection is unsafe because the scope of
+      #   variables is different between `each` and `for`.
+      #
       class For < Base
         include ConfigurableEnforcedStyle
         include RangeHelp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/lambda_call.rb 
new/lib/rubocop/cop/style/lambda_call.rb
--- old/lib/rubocop/cop/style/lambda_call.rb    2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/style/lambda_call.rb    2022-03-09 17:40:19.000000000 
+0100
@@ -22,45 +22,37 @@
         include ConfigurableEnforcedStyle
         extend AutoCorrector
 
+        MSG = 'Prefer the use of `%<prefer>s` over `%<current>s`.'
         RESTRICT_ON_SEND = %i[call].freeze
 
         def on_send(node)
           return unless node.receiver
 
           if offense?(node)
-            add_offense(node) do |corrector|
+            prefer = prefer(node)
+            current = node.source
+
+            add_offense(node, message: format(MSG, prefer: prefer, current: 
current)) do |corrector|
               opposite_style_detected
-              autocorrect(corrector, node)
+              corrector.replace(node, prefer)
             end
           else
             correct_style_detected
           end
         end
 
-        def autocorrect(corrector, node)
-          if explicit_style?
-            receiver = node.receiver.source
-            replacement = node.source.sub("#{receiver}.", "#{receiver}.call")
-
-            corrector.replace(node, replacement)
-          else
-            add_parentheses(node, corrector) unless node.parenthesized?
-            corrector.remove(node.loc.selector)
-          end
-        end
-
         private
 
         def offense?(node)
           (explicit_style? && node.implicit_call?) || (implicit_style? && 
!node.implicit_call?)
         end
 
-        def message(_node)
-          if explicit_style?
-            'Prefer the use of `lambda.call(...)` over `lambda.(...)`.'
-          else
-            'Prefer the use of `lambda.(...)` over `lambda.call(...)`.'
-          end
+        def prefer(node)
+          receiver = node.receiver.source
+          arguments = node.arguments.map(&:source).join(', ')
+          method = explicit_style? ? "call(#{arguments})" : "(#{arguments})"
+
+          "#{receiver}.#{method}"
         end
 
         def implicit_style?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/nested_file_dirname.rb 
new/lib/rubocop/cop/style/nested_file_dirname.rb
--- old/lib/rubocop/cop/style/nested_file_dirname.rb    1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/rubocop/cop/style/nested_file_dirname.rb    2022-03-09 
17:40:19.000000000 +0100
@@ -0,0 +1,66 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module Cop
+    module Style
+      # This cop checks for nested `File.dirname`.
+      # It replaces nested `File.dirname` with the level argument introduced 
in Ruby 3.1.
+      #
+      # @example
+      #
+      #   # bad
+      #   File.dirname(File.dirname(path))
+      #
+      #   # good
+      #   File.dirname(path, 2)
+      #
+      class NestedFileDirname < Base
+        include RangeHelp
+        extend AutoCorrector
+        extend TargetRubyVersion
+
+        MSG = 'Use `dirname(%<path>s, %<level>s)` instead.'
+        RESTRICT_ON_SEND = %i[dirname].freeze
+
+        minimum_target_ruby_version 3.1
+
+        # @!method file_dirname?(node)
+        def_node_matcher :file_dirname?, <<~PATTERN
+          (send
+            (const {cbase nil?} :File) :dirname ...)
+        PATTERN
+
+        def on_send(node)
+          return if file_dirname?(node.parent) || 
!file_dirname?(node.first_argument)
+
+          path, level = path_with_dir_level(node, 1)
+          return if level < 2
+
+          message = format(MSG, path: path, level: level)
+          range = offense_range(node)
+
+          add_offense(range, message: message) do |corrector|
+            corrector.replace(range, "dirname(#{path}, #{level})")
+          end
+        end
+
+        private
+
+        def path_with_dir_level(node, level)
+          first_argument = node.first_argument
+
+          if file_dirname?(first_argument)
+            level += 1
+            path_with_dir_level(first_argument, level)
+          else
+            [first_argument.source, level]
+          end
+        end
+
+        def offense_range(node)
+          range_between(node.loc.selector.begin_pos, node.source_range.end_pos)
+        end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/optional_boolean_parameter.rb 
new/lib/rubocop/cop/style/optional_boolean_parameter.rb
--- old/lib/rubocop/cop/style/optional_boolean_parameter.rb     2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/optional_boolean_parameter.rb     2022-03-09 
17:40:19.000000000 +0100
@@ -54,8 +54,9 @@
         private
 
         def format_message(argument)
-          source = argument.source
-          format(MSG, original: source, replacement: source.sub(/\s+=/, ':'))
+          replacement = "#{argument.name}: #{argument.default_value.source}"
+
+          format(MSG, original: argument.source, replacement: replacement)
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/string_concatenation.rb 
new/lib/rubocop/cop/style/string_concatenation.rb
--- old/lib/rubocop/cop/style/string_concatenation.rb   2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/string_concatenation.rb   2022-03-09 
17:40:19.000000000 +0100
@@ -134,7 +134,13 @@
         end
 
         def uncorrectable?(part)
-          part.multiline? || (part.str_type? && part.heredoc?) || 
part.each_descendant(:block).any?
+          part.multiline? || heredoc?(part) || 
part.each_descendant(:block).any?
+        end
+
+        def heredoc?(node)
+          return false unless node.str_type? || node.dstr_type?
+
+          node.heredoc?
         end
 
         def corrected_ancestor?(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb 
new/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb
--- old/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb        
2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb        
2022-03-09 17:40:19.000000000 +0100
@@ -10,7 +10,7 @@
       # last item of all non-empty, multiline array literals.
       # * `comma`: Requires a comma after last item in an array,
       # but only when each item is on its own line.
-      # * `no_comma`: Does not requires a comma after the
+      # * `no_comma`: Does not require a comma after the
       # last item in an array
       #
       # @example EnforcedStyleForMultiline: consistent_comma
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb 
new/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb
--- old/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb 2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb 2022-03-09 
17:40:19.000000000 +0100
@@ -10,7 +10,7 @@
       # last item of all non-empty, multiline hash literals.
       # * `comma`: Requires a comma after the last item in a hash,
       # but only when each item is on its own line.
-      # * `no_comma`: Does not requires a comma after the
+      # * `no_comma`: Does not require a comma after the
       # last item in a hash
       #
       # @example EnforcedStyleForMultiline: consistent_comma
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/variable_force.rb 
new/lib/rubocop/cop/variable_force.rb
--- old/lib/rubocop/cop/variable_force.rb       2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/cop/variable_force.rb       2022-03-09 17:40:19.000000000 
+0100
@@ -186,11 +186,7 @@
       end
 
       def regexp_captured_names(node)
-        regexp_string = node.children.select(&:str_type?).map do |child|
-          child.children.first
-        end.join || ''
-
-        regexp = Regexp.new(regexp_string)
+        regexp = node.to_regexp
 
         regexp.named_captures.keys
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cops_documentation_generator.rb 
new/lib/rubocop/cops_documentation_generator.rb
--- old/lib/rubocop/cops_documentation_generator.rb     2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/cops_documentation_generator.rb     2022-03-09 
17:40:19.000000000 +0100
@@ -191,8 +191,8 @@
 
   def wrap_backtick(value)
     if value.is_a?(String)
-      # Use `+` to prevent text like `**/*.gemspec` from being bold.
-      value.start_with?('*') ? "`+#{value}+`" : "`#{value}`"
+      # Use `+` to prevent text like `**/*.gemspec`, `spec/**/*` from being 
bold.
+      value.include?('*') ? "`+#{value}+`" : "`#{value}`"
     else
       "`#{value}`"
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/formatter/disabled_config_formatter.rb 
new/lib/rubocop/formatter/disabled_config_formatter.rb
--- old/lib/rubocop/formatter/disabled_config_formatter.rb      2022-02-03 
07:44:29.000000000 +0100
+++ new/lib/rubocop/formatter/disabled_config_formatter.rb      2022-03-09 
17:40:19.000000000 +0100
@@ -124,9 +124,9 @@
         default_cfg = default_config(cop_name)
 
         if supports_safe_auto_correct?(cop_class, default_cfg)
-          output_buffer.puts '# Cop supports --auto-correct.'
+          output_buffer.puts '# This cop supports safe auto-correction 
(--auto-correct).'
         elsif supports_unsafe_autocorrect?(cop_class, default_cfg)
-          output_buffer.puts '# Cop supports --auto-correct-all.'
+          output_buffer.puts '# This cop supports unsafe auto-correction 
(--auto-correct-all).'
         end
 
         return unless default_cfg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/options.rb new/lib/rubocop/options.rb
--- old/lib/rubocop/options.rb  2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/options.rb  2022-03-09 17:40:19.000000000 +0100
@@ -467,8 +467,14 @@
                                          'This option applies to the 
previously',
                                          'specified --format, or the default 
format',
                                          'if no format is specified.'],
-      fail_level:                       ['Minimum severity (A/I/R/C/W/E/F) for 
exit',
-                                         'with error code.'],
+      fail_level:                       ['Minimum severity for exit with error 
code.',
+                                         '  [A] autocorrect',
+                                         '  [I] info',
+                                         '  [R] refactor',
+                                         '  [C] convention',
+                                         '  [W] warning',
+                                         '  [E] error',
+                                         '  [F] fatal'],
       display_time:                     'Display elapsed time in seconds.',
       display_only_failed:              ['Only output offense messages. Omit 
passing',
                                          'cops. Only valid for --format 
junit.'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/rspec/shared_contexts.rb 
new/lib/rubocop/rspec/shared_contexts.rb
--- old/lib/rubocop/rspec/shared_contexts.rb    2022-02-03 07:44:29.000000000 
+0100
+++ new/lib/rubocop/rspec/shared_contexts.rb    2022-03-09 17:40:19.000000000 
+0100
@@ -135,3 +135,7 @@
 RSpec.shared_context 'ruby 3.1', :ruby31 do
   let(:ruby_version) { 3.1 }
 end
+
+RSpec.shared_context 'ruby 3.2', :ruby32 do
+  let(:ruby_version) { 3.2 }
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/runner.rb new/lib/rubocop/runner.rb
--- old/lib/rubocop/runner.rb   2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/runner.rb   2022-03-09 17:40:19.000000000 +0100
@@ -8,7 +8,7 @@
   class Runner # rubocop:disable Metrics/ClassLength
     # An exception indicating that the inspection loop got stuck correcting
     # offenses back and forth.
-    class InfiniteCorrectionLoop < RuntimeError
+    class InfiniteCorrectionLoop < StandardError
       attr_reader :offenses
 
       def initialize(path, offenses_by_iteration, loop_start: -1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/target_ruby.rb 
new/lib/rubocop/target_ruby.rb
--- old/lib/rubocop/target_ruby.rb      2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/target_ruby.rb      2022-03-09 17:40:19.000000000 +0100
@@ -4,7 +4,7 @@
   # The kind of Ruby that code inspected by RuboCop is written in.
   # @api private
   class TargetRuby
-    KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0, 3.1].freeze
+    KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0, 3.1, 3.2].freeze
     DEFAULT_VERSION = KNOWN_RUBIES.first
 
     OBSOLETE_RUBIES = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/version.rb new/lib/rubocop/version.rb
--- old/lib/rubocop/version.rb  2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop/version.rb  2022-03-09 17:40:19.000000000 +0100
@@ -3,7 +3,7 @@
 module RuboCop
   # This module holds the RuboCop version information.
   module Version
-    STRING = '1.25.1'
+    STRING = '1.26.0'
 
     MSG = '%<version>s (using Parser %<parser_version>s, '\
           'rubocop-ast %<rubocop_ast_version>s, ' \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop.rb new/lib/rubocop.rb
--- old/lib/rubocop.rb  2022-02-03 07:44:29.000000000 +0100
+++ new/lib/rubocop.rb  2022-03-09 17:40:19.000000000 +0100
@@ -552,6 +552,7 @@
 require_relative 'rubocop/cop/style/negated_if_else_condition'
 require_relative 'rubocop/cop/style/negated_unless'
 require_relative 'rubocop/cop/style/negated_while'
+require_relative 'rubocop/cop/style/nested_file_dirname'
 require_relative 'rubocop/cop/style/nested_modifier'
 require_relative 'rubocop/cop/style/nested_parenthesized_calls'
 require_relative 'rubocop/cop/style/nested_ternary_operator'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2022-02-03 07:44:29.000000000 +0100
+++ new/metadata        2022-03-09 17:40:19.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: rubocop
 version: !ruby/object:Gem::Version
-  version: 1.25.1
+  version: 1.26.0
 platform: ruby
 authors:
 - Bozhidar Batsov
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: exe
 cert_chain: []
-date: 2022-02-03 00:00:00.000000000 Z
+date: 2022-03-09 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: parallel
@@ -100,7 +100,7 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.15.1
+        version: 1.16.0
     - - "<"
       - !ruby/object:Gem::Version
         version: '2.0'
@@ -110,7 +110,7 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.15.1
+        version: 1.16.0
     - - "<"
       - !ruby/object:Gem::Version
         version: '2.0'
@@ -269,6 +269,7 @@
 - lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
 - lib/rubocop/cop/internal_affairs/node_type_predicate.rb
 - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
+- lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
 - lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
 - lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb
 - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
@@ -737,6 +738,7 @@
 - lib/rubocop/cop/style/negated_if_else_condition.rb
 - lib/rubocop/cop/style/negated_unless.rb
 - lib/rubocop/cop/style/negated_while.rb
+- lib/rubocop/cop/style/nested_file_dirname.rb
 - lib/rubocop/cop/style/nested_modifier.rb
 - lib/rubocop/cop/style/nested_parenthesized_calls.rb
 - lib/rubocop/cop/style/nested_ternary_operator.rb
@@ -911,7 +913,7 @@
   homepage_uri: https://rubocop.org/
   changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
   source_code_uri: https://github.com/rubocop/rubocop/
-  documentation_uri: https://docs.rubocop.org/rubocop/1.25/
+  documentation_uri: https://docs.rubocop.org/rubocop/1.26/
   bug_tracker_uri: https://github.com/rubocop/rubocop/issues
   rubygems_mfa_required: 'true'
 post_install_message: 

Reply via email to