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 2021-05-16 23:40:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-rubocop"

Sun May 16 23:40:25 2021 rev:24 rq:890732 version:1.14.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes  
2021-04-22 18:04:41.398573211 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2988/rubygem-rubocop.changes    
    2021-05-16 23:40:59.177861180 +0200
@@ -1,0 +2,48 @@
+Wed May  5 08:44:30 UTC 2021 - Dan ??erm??k <dcer...@suse.com>
+
+- New upstream release 1.14
+
+### New features
+
+* [#7669](https://github.com/rubocop/rubocop/issues/7669): New cop 
`Bundler/GemVersion` requires or forbids specifying gem versions.
+([@timlkelly][])
+* [#9758](https://github.com/rubocop/rubocop/pull/9758): Support 
`TargetRubyVersion 3.1` (experimental). ([@koic][])
+* [#9377](https://github.com/rubocop/rubocop/issues/9377): Add cop 
`Layout/SingleLineBlockChain`. ([@jonas054][])
+
+### Bug fixes
+
+* [#9751](https://github.com/rubocop/rubocop/pull/9751): `Style/StringLiteral` 
doesn't autocorrect global variable interpolation.
+([@etiennebarrie][])
+* [#9731](https://github.com/rubocop/rubocop/issues/9731): Fix two 
autocorrection issues for `Style/NegatedIfElseCondition`.
+([@dvandersluis][])
+* [#9740](https://github.com/rubocop/rubocop/pull/9740): Fix an incorrect 
auto-correct for `Style/SingleLineMethods` when defining setter
+method. ([@koic][])
+* [#9757](https://github.com/rubocop/rubocop/pull/9757): Fix a false positive 
for `Lint/NumberConversion` when `:to_f` is one of multiple
+method arguments. ([@koic][])
+* [#9761](https://github.com/rubocop/rubocop/issues/9761): Fix 
`Style/ClassAndModuleChildren` false negative for `compact` style when a
+class/module is partially nested. ([@dvandersluis][])
+* [#9748](https://github.com/rubocop/rubocop/pull/9748): Prevent infinite 
loops during symlink traversal. ([@Tonkpils][])
+* [#9762](https://github.com/rubocop/rubocop/issues/9762): Update 
`VariableForce` to be able to handle `case-match` nodes.
+([@dvandersluis][])
+* [#9729](https://github.com/rubocop/rubocop/issues/9729): Fix an error for 
`Style/IfUnlessModifier` when variable assignment is used in
+the branch body of if modifier. ([@koic][])
+* [#9750](https://github.com/rubocop/rubocop/issues/9750): Fix an incorrect 
auto-correct for `Style/SoleNestedConditional` when when using
+nested `if` within `unless foo == bar`. ([@koic][])
+* [#9751](https://github.com/rubocop/rubocop/pull/9751): `Style/StringLiteral` 
autocorrects `'\\'` into `"\\"`. ([@etiennebarrie][])
+* [#9732](https://github.com/rubocop/rubocop/pull/9732): Support deprecated 
Socket.gethostbyaddr and Socket.gethostbyname.
+([@AndreiEres][])
+* [#9713](https://github.com/rubocop/rubocop/issues/9713): Fix autocorrection 
for block local variables in `Lint/UnusedBlockArgument`.
+([@tejasbubane][])
+* [#9746](https://github.com/rubocop/rubocop/pull/9746): Fix a false positive 
for `Lint/UnreachableLoop` when using conditional `next` in
+a loop. ([@koic][])
+
+[@timlkelly]: https://github.com/timlkelly
+[@koic]: https://github.com/koic
+[@jonas054]: https://github.com/jonas054
+[@etiennebarrie]: https://github.com/etiennebarrie
+[@dvandersluis]: https://github.com/dvandersluis
+[@Tonkpils]: https://github.com/Tonkpils
+[@AndreiEres]: https://github.com/AndreiEres
+[@tejasbubane]: https://github.com/tejasbubane
+
+-------------------------------------------------------------------

Old:
----
  rubocop-1.13.0.gem

New:
----
  rubocop-1.14.0.gem

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

Other differences:
------------------
++++++ rubygem-rubocop.spec ++++++
--- /var/tmp/diff_new_pack.hSrq8F/_old  2021-05-16 23:40:59.653859406 +0200
+++ /var/tmp/diff_new_pack.hSrq8F/_new  2021-05-16 23:40:59.653859406 +0200
@@ -16,29 +16,28 @@
 #
 
 
+%define mod_name rubocop
+%define mod_full_name %{mod_name}-%{version}
 #
 # This file was generated with a gem2rpm.yml and not just plain gem2rpm.
 # All sections marked as MANUAL, license headers, summaries and descriptions
 # can be maintained in that file. Please consult this file before editing any
 # of those fields
 #
-
 Name:           rubygem-rubocop
-Version:        1.13.0
+Version:        1.14.0
 Release:        0
-%define mod_name rubocop
-%define mod_full_name %{mod_name}-%{version}
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Summary:        Automatic Ruby code style checking tool
+License:        MIT
+Group:          Development/Languages/Ruby
+URL:            https://github.com/rubocop/rubocop
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
+Source1:        gem2rpm.yml
 BuildRequires:  %{ruby >= 2.5.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
 BuildRequires:  update-alternatives
-URL:            https://github.com/rubocop/rubocop
-Source:         https://rubygems.org/gems/%{mod_full_name}.gem
-Source1:        gem2rpm.yml
-Summary:        Automatic Ruby code style checking tool
-License:        MIT
-Group:          Development/Languages/Ruby
+# FIXME: use proper Requires(pre/post/preun/...)
 PreReq:         update-alternatives
 
 %description

++++++ rubocop-1.13.0.gem -> rubocop-1.14.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-04-20 10:04:17.000000000 +0200
+++ new/README.md       2021-05-05 09:54:15.000000000 +0200
@@ -52,7 +52,7 @@
 in your `Gemfile`:
 
 ```rb
-gem 'rubocop', '~> 1.13', require: false
+gem 'rubocop', '~> 1.14', 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      2021-04-20 10:04:17.000000000 +0200
+++ new/config/default.yml      2021-05-05 09:54:15.000000000 +0200
@@ -130,7 +130,7 @@
   # What MRI version of the Ruby interpreter is the inspected code intended to
   # run on? (If there is more than one, set this to the lowest version.)
   # If a value is specified for TargetRubyVersion then it is used. Acceptable
-  # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
+  # values are specificed as a float (i.e. 3.0); the teeny version of Ruby
   # should not be included. If the project specifies a Ruby version in the
   # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop 
will
   # try to determine the desired version of Ruby by inspecting the
@@ -138,7 +138,7 @@
   # or gems.locked file. (Although the Ruby version is specified in the Gemfile
   # or gems.rb file, RuboCop reads the final value from the lock file.) If the
   # Ruby version is still unresolved, RuboCop will use the oldest officially
-  # supported Ruby version (currently Ruby 2.4).
+  # supported Ruby version (currently Ruby 2.5).
   TargetRubyVersion: ~
   # Determines if a notification for extension libraries should be shown when
   # rubocop is run. Keys are the name of the extension, and values are an array
@@ -174,6 +174,20 @@
   IgnoredGems: []
   OnlyFor: []
 
+Bundler/GemVersion:
+  Description: 'Requires or forbids specifying gem versions.'
+  Enabled: false
+  VersionAdded: '1.14'
+  EnforcedStyle: 'required'
+  SupportedStyles:
+    - 'required'
+    - 'forbidden'
+  Include:
+    - '**/*.gemfile'
+    - '**/Gemfile'
+    - '**/gems.rb'
+  AllowedGems: []
+
 Bundler/InsecureProtocolSource:
   Description: >-
                  The source `:gemcutter`, `:rubygems` and `:rubyforge` are 
deprecated
@@ -1114,6 +1128,11 @@
   Enabled: true
   VersionAdded: '0.49'
 
+Layout/SingleLineBlockChain:
+  Description: 'Put method call on a separate line if chained to a single line 
block.'
+  Enabled: false
+  VersionAdded: '1.14'
+
 Layout/SpaceAfterColon:
   Description: 'Use spaces after colons.'
   StyleGuide: '#spaces-operators'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/bundler/gem_comment.rb 
new/lib/rubocop/cop/bundler/gem_comment.rb
--- old/lib/rubocop/cop/bundler/gem_comment.rb  2021-04-20 10:04:17.000000000 
+0200
+++ new/lib/rubocop/cop/bundler/gem_comment.rb  2021-05-05 09:54:15.000000000 
+0200
@@ -82,6 +82,7 @@
       #
       class GemComment < Base
         include DefNode
+        include GemDeclaration
 
         MSG = 'Missing gem description comment.'
         CHECKED_OPTIONS_CONFIG = 'OnlyFor'
@@ -90,9 +91,6 @@
         RESTRICTIVE_VERSION_PATTERN = /<|~>/.freeze
         RESTRICT_ON_SEND = %i[gem].freeze
 
-        # @!method gem_declaration?(node)
-        def_node_matcher :gem_declaration?, '(send nil? :gem str ...)'
-
         def on_send(node)
           return unless gem_declaration?(node)
           return if ignored_gem?(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/bundler/gem_version.rb 
new/lib/rubocop/cop/bundler/gem_version.rb
--- old/lib/rubocop/cop/bundler/gem_version.rb  1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/rubocop/cop/bundler/gem_version.rb  2021-05-05 09:54:15.000000000 
+0200
@@ -0,0 +1,99 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module Cop
+    module Bundler
+      # Enforce that Gem version specifications are either required
+      # or forbidden.
+      #
+      # @example EnforcedStyle: required (default)
+      #  # bad
+      #  gem 'rubocop'
+      #
+      #  # good
+      #  gem 'rubocop', '~> 1.12'
+      #
+      #  # good
+      #  gem 'rubocop', '>= 1.10.0'
+      #
+      #  # good
+      #  gem 'rubocop', '>= 1.5.0', '< 1.10.0'
+      #
+      # @example EnforcedStyle: forbidden
+      #  # good
+      #  gem 'rubocop'
+      #
+      #  # bad
+      #  gem 'rubocop', '~> 1.12'
+      #
+      #  # bad
+      #  gem 'rubocop', '>= 1.10.0'
+      #
+      #  # bad
+      #  gem 'rubocop', '>= 1.5.0', '< 1.10.0'
+      #
+      class GemVersion < Base
+        include ConfigurableEnforcedStyle
+        include GemDeclaration
+
+        REQUIRED_MSG = 'Gem version specification is required.'
+        FORBIDDEN_MSG = 'Gem version specification is forbidden.'
+        VERSION_SPECIFICATION_REGEX = /^\s*[~<>=]*\s*[0-9.]+/.freeze
+
+        # @!method includes_version_specification?(node)
+        def_node_matcher :includes_version_specification?, <<~PATTERN
+          (send nil? :gem <(str #version_specification?) ...>)
+        PATTERN
+
+        def on_send(node)
+          return unless gem_declaration?(node)
+          return if allowed_gem?(node)
+
+          if offense?(node)
+            add_offense(node)
+            opposite_style_detected
+          else
+            correct_style_detected
+          end
+        end
+
+        private
+
+        def allowed_gem?(node)
+          allowed_gems.include?(node.first_argument.value)
+        end
+
+        def allowed_gems
+          Array(cop_config['AllowedGems'])
+        end
+
+        def message(range)
+          gem_specification = range.source
+
+          if required_style?
+            format(REQUIRED_MSG, gem_specification: gem_specification)
+          elsif forbidden_style?
+            format(FORBIDDEN_MSG, gem_specification: gem_specification)
+          end
+        end
+
+        def offense?(node)
+          (required_style? && !includes_version_specification?(node)) ||
+            (forbidden_style? && includes_version_specification?(node))
+        end
+
+        def forbidden_style?
+          style == :forbidden
+        end
+
+        def required_style?
+          style == :required
+        end
+
+        def version_specification?(expression)
+          expression.match?(VERSION_SPECIFICATION_REGEX)
+        end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/layout/redundant_line_break.rb 
new/lib/rubocop/cop/layout/redundant_line_break.rb
--- old/lib/rubocop/cop/layout/redundant_line_break.rb  2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/layout/redundant_line_break.rb  2021-05-05 
09:54:15.000000000 +0200
@@ -79,8 +79,20 @@
         end
 
         def configured_to_not_be_inspected?(node)
+          return true if other_cop_takes_precedence?(node)
+
           !cop_config['InspectBlocks'] && (node.block_type? ||
-                                           
node.each_child_node(:block).any?(&:multiline?))
+                                           
node.each_descendant(:block).any?(&:multiline?))
+        end
+
+        def other_cop_takes_precedence?(node)
+          single_line_block_chain_enabled? && 
node.each_descendant(:block).any? do |block_node|
+            block_node.parent.send_type? && block_node.parent.loc.dot && 
!block_node.multiline?
+          end
+        end
+
+        def single_line_block_chain_enabled?
+          @config.for_cop('Layout/SingleLineBlockChain')['Enabled']
         end
 
         def suitable_as_single_line?(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/layout/single_line_block_chain.rb 
new/lib/rubocop/cop/layout/single_line_block_chain.rb
--- old/lib/rubocop/cop/layout/single_line_block_chain.rb       1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/rubocop/cop/layout/single_line_block_chain.rb       2021-05-05 
09:54:15.000000000 +0200
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module Cop
+    module Layout
+      # This cop checks if method calls are chained onto single line blocks. 
It considers that a
+      # line break before the dot improves the readability of the code.
+      #
+      # @example
+      #   # bad
+      #   example.select { |item| item.cond? }.join('-')
+      #
+      #   # good
+      #   example.select { |item| item.cond? }
+      #          .join('-')
+      #
+      #   # good (not a concern for this cop)
+      #   example.select do |item|
+      #     item.cond?
+      #   end.join('-')
+      #
+      class SingleLineBlockChain < Base
+        include RangeHelp
+        extend AutoCorrector
+
+        MSG = 'Put method call on a separate line if chained to a single line 
block.'
+
+        def on_send(node)
+          range = offending_range(node)
+          add_offense(range) { |corrector| corrector.insert_before(range, 
"\n") } if range
+        end
+
+        private
+
+        def offending_range(node)
+          receiver = node.receiver
+          return unless receiver&.block_type?
+
+          receiver_location = receiver.loc
+          closing_block_delimiter_line_number = receiver_location.end.line
+          return if receiver_location.begin.line < 
closing_block_delimiter_line_number
+
+          node_location = node.loc
+          dot_range = node_location.dot
+          return unless dot_range
+          return if dot_range.line > closing_block_delimiter_line_number
+
+          range_between(dot_range.begin_pos, node_location.selector.end_pos)
+        end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/deprecated_class_methods.rb 
new/lib/rubocop/cop/lint/deprecated_class_methods.rb
--- old/lib/rubocop/cop/lint/deprecated_class_methods.rb        2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/lint/deprecated_class_methods.rb        2021-05-05 
09:54:15.000000000 +0200
@@ -24,17 +24,17 @@
         extend AutoCorrector
 
         # Inner class to DeprecatedClassMethods.
-        # This class exists to add abstraction and clean naming to the
-        # objects that are going to be operated on.
+        # This class exists to add abstraction and clean naming
+        # to the deprecated objects
         class DeprecatedClassMethod
           include RuboCop::AST::Sexp
 
-          attr_reader :class_constant, :deprecated_method, :replacement_method
+          attr_reader :method, :class_constant
 
-          def initialize(deprecated:, replacement:, class_constant: nil)
-            @deprecated_method = deprecated
-            @replacement_method = replacement
+          def initialize(method, class_constant: nil, correctable: true)
+            @method = method
             @class_constant = class_constant
+            @correctable = correctable
           end
 
           def class_nodes
@@ -48,28 +48,80 @@
                 [nil]
               end
           end
+
+          def correctable?
+            @correctable
+          end
+
+          def to_s
+            [class_constant, method].compact.join(delimeter)
+          end
+
+          private
+
+          def delimeter
+            CLASS_METHOD_DELIMETER
+          end
+        end
+
+        # Inner class to DeprecatedClassMethods.
+        # This class exists to add abstraction and clean naming
+        # to the replacements for deprecated objects
+        class Replacement
+          attr_reader :method, :class_constant
+
+          def initialize(method, class_constant: nil, instance_method: false)
+            @method = method
+            @class_constant = class_constant
+            @instance_method = instance_method
+          end
+
+          def to_s
+            [class_constant, method].compact.join(delimeter)
+          end
+
+          private
+
+          def delimeter
+            instance_method? ? INSTANCE_METHOD_DELIMETER : 
CLASS_METHOD_DELIMETER
+          end
+
+          def instance_method?
+            @instance_method
+          end
         end
 
         MSG = '`%<current>s` is deprecated in favor of `%<prefer>s`.'
-        DEPRECATED_METHODS_OBJECT = [
-          DeprecatedClassMethod.new(deprecated: :exists?,
-                                    replacement: :exist?,
-                                    class_constant: :File),
-          DeprecatedClassMethod.new(deprecated: :exists?,
-                                    replacement: :exist?,
-                                    class_constant: :Dir),
-          DeprecatedClassMethod.new(deprecated: :iterator?, replacement: 
:block_given?)
-        ].freeze
 
-        RESTRICT_ON_SEND = 
DEPRECATED_METHODS_OBJECT.map(&:deprecated_method).freeze
+        DEPRECATED_METHODS_OBJECT = {
+          DeprecatedClassMethod.new(:exists?, class_constant: :File) =>
+            Replacement.new(:exist?, class_constant: :File),
+
+          DeprecatedClassMethod.new(:exists?, class_constant: :Dir) =>
+            Replacement.new(:exist?, class_constant: :Dir),
+
+          DeprecatedClassMethod.new(:iterator?) => 
Replacement.new(:block_given?),
+
+          DeprecatedClassMethod.new(:gethostbyaddr, class_constant: :Socket, 
correctable: false) =>
+            Replacement.new(:getnameinfo, class_constant: :Addrinfo, 
instance_method: true),
+
+          DeprecatedClassMethod.new(:gethostbyname, class_constant: :Socket, 
correctable: false) =>
+            Replacement.new(:getaddrinfo, class_constant: :Addrinfo, 
instance_method: true)
+        }.freeze
+
+        RESTRICT_ON_SEND = DEPRECATED_METHODS_OBJECT.keys.map(&:method).freeze
+
+        CLASS_METHOD_DELIMETER = '.'
+        INSTANCE_METHOD_DELIMETER = '#'
 
         def on_send(node)
-          check(node) do |data|
-            message = format(MSG, current: deprecated_method(data),
-                                  prefer: replacement_method(data))
+          check(node) do |deprecated|
+            message = format(MSG, current: deprecated, prefer: 
replacement(deprecated))
 
             add_offense(node.loc.selector, message: message) do |corrector|
-              corrector.replace(node.loc.selector, 
data.replacement_method.to_s)
+              if deprecated.correctable?
+                corrector.replace(node.loc.selector, 
replacement(deprecated).method)
+              end
             end
           end
         end
@@ -77,28 +129,16 @@
         private
 
         def check(node)
-          DEPRECATED_METHODS_OBJECT.each do |data|
-            next unless data.class_nodes.include?(node.receiver)
-            next unless node.method?(data.deprecated_method)
+          DEPRECATED_METHODS_OBJECT.each_key do |deprecated|
+            next unless deprecated.class_nodes.include?(node.receiver)
+            next unless node.method?(deprecated.method)
 
-            yield data
+            yield deprecated
           end
         end
 
-        def deprecated_method(data)
-          method_call(data.class_constant, data.deprecated_method)
-        end
-
-        def replacement_method(data)
-          method_call(data.class_constant, data.replacement_method)
-        end
-
-        def method_call(class_constant, method)
-          if class_constant
-            format('%<constant>s.%<method>s', constant: class_constant, 
method: method)
-          else
-            format('%<method>s', method: method)
-          end
+        def replacement(deprecated)
+          DEPRECATED_METHODS_OBJECT[deprecated]
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/number_conversion.rb 
new/lib/rubocop/cop/lint/number_conversion.rb
--- old/lib/rubocop/cop/lint/number_conversion.rb       2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/lint/number_conversion.rb       2021-05-05 
09:54:15.000000000 +0200
@@ -97,7 +97,7 @@
 
         def handle_as_symbol(node)
           to_method_symbol(node) do |receiver, sym_node, to_method|
-            next if receiver.nil?
+            next if receiver.nil? || !node.arguments.one?
 
             message = format(
               MSG,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/unreachable_loop.rb 
new/lib/rubocop/cop/lint/unreachable_loop.rb
--- old/lib/rubocop/cop/lint/unreachable_loop.rb        2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/lint/unreachable_loop.rb        2021-05-05 
09:54:15.000000000 +0200
@@ -87,6 +87,7 @@
         include IgnoredPattern
 
         MSG = 'This loop will have at most one iteration.'
+        CONTINUE_KEYWORDS = %i[next redo].freeze
 
         def on_while(node)
           check(node)
@@ -116,7 +117,10 @@
           break_statement = statements.find { |statement| 
break_statement?(statement) }
           return unless break_statement
 
-          add_offense(node) unless 
preceded_by_continue_statement?(break_statement)
+          unless preceded_by_continue_statement?(break_statement) ||
+                 conditional_continue_keyword?(break_statement)
+            add_offense(node)
+          end
         end
 
         def statements(node)
@@ -177,9 +181,15 @@
           break_statement.left_siblings.any? do |sibling|
             next if sibling.loop_keyword? || loop_method?(sibling)
 
-            sibling.each_descendant(:next, :redo).any?
+            sibling.each_descendant(*CONTINUE_KEYWORDS).any?
           end
         end
+
+        def conditional_continue_keyword?(break_statement)
+          or_node = break_statement.each_descendant(:or).to_a.last
+
+          or_node && CONTINUE_KEYWORDS.include?(or_node.rhs.type)
+        end
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/lint/unused_block_argument.rb 
new/lib/rubocop/cop/lint/unused_block_argument.rb
--- old/lib/rubocop/cop/lint/unused_block_argument.rb   2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/lint/unused_block_argument.rb   2021-05-05 
09:54:15.000000000 +0200
@@ -67,11 +67,17 @@
         end
 
         def check_argument(variable)
-          return if allowed_block?(variable) || 
allowed_keyword_argument?(variable)
+          return if allowed_block?(variable) ||
+                    allowed_keyword_argument?(variable) ||
+                    used_block_local?(variable)
 
           super
         end
 
+        def used_block_local?(variable)
+          variable.explicit_block_local_variable? && 
!variable.assignments.empty?
+        end
+
         def allowed_block?(variable)
           !variable.block_argument? || (ignore_empty_blocks? && 
empty_block?(variable))
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/mixin/gem_declaration.rb 
new/lib/rubocop/cop/mixin/gem_declaration.rb
--- old/lib/rubocop/cop/mixin/gem_declaration.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/rubocop/cop/mixin/gem_declaration.rb        2021-05-05 
09:54:15.000000000 +0200
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module Cop
+    # Common functionality for checking gem declarations.
+    module GemDeclaration
+      extend NodePattern::Macros
+
+      # @!method gem_declaration?(node)
+      def_node_matcher :gem_declaration?, '(send nil? :gem str ...)'
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/mixin/string_literals_help.rb 
new/lib/rubocop/cop/mixin/string_literals_help.rb
--- old/lib/rubocop/cop/mixin/string_literals_help.rb   2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/mixin/string_literals_help.rb   2021-05-05 
09:54:15.000000000 +0200
@@ -15,7 +15,7 @@
         if style == :single_quotes
           !double_quotes_required?(src)
         else
-          !/" | \\[^'] | \#(@|\{)/x.match?(src)
+          !/" | \\[^'\\] | \#[@{$]/x.match?(src)
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/class_and_module_children.rb 
new/lib/rubocop/cop/style/class_and_module_children.rb
--- old/lib/rubocop/cop/style/class_and_module_children.rb      2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/style/class_and_module_children.rb      2021-05-05 
09:54:15.000000000 +0200
@@ -132,7 +132,7 @@
         end
 
         def check_compact_style(node, body)
-          return unless one_child?(body) && !compact_node_name?(node)
+          return unless needs_compacting?(body)
 
           add_offense(node.loc.name, message: COMPACT_MSG) do |corrector|
             autocorrect(corrector, node)
@@ -145,12 +145,12 @@
           nest_or_compact(corrector, node)
         end
 
-        def one_child?(body)
+        def needs_compacting?(body)
           body && %i[module class].include?(body.type)
         end
 
         def compact_node_name?(node)
-          /::/.match?(node.loc.name.source)
+          /::/.match?(node.identifier.source)
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/if_unless_modifier.rb 
new/lib/rubocop/cop/style/if_unless_modifier.rb
--- old/lib/rubocop/cop/style/if_unless_modifier.rb     2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/style/if_unless_modifier.rb     2021-05-05 
09:54:15.000000000 +0200
@@ -67,15 +67,14 @@
 
         def autocorrect(corrector, node)
           replacement = if node.modifier_form?
-                          indentation = ' ' * node.source_range.column
-                          last_argument = node.if_branch.last_argument
+                          last_argument = node.if_branch.last_argument if 
node.if_branch.send_type?
 
                           if last_argument.respond_to?(:heredoc?) && 
last_argument.heredoc?
                             heredoc = extract_heredoc_from(last_argument)
                             remove_heredoc(corrector, heredoc)
-                            to_normal_form_with_heredoc(node, indentation, 
heredoc)
+                            to_normal_form_with_heredoc(node, indent(node), 
heredoc)
                           else
-                            to_normal_form(node, indentation)
+                            to_normal_form(node, indent(node))
                           end
                         else
                           to_modifier_form(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/negated_if_else_condition.rb 
new/lib/rubocop/cop/style/negated_if_else_condition.rb
--- old/lib/rubocop/cop/style/negated_if_else_condition.rb      2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/style/negated_if_else_condition.rb      2021-05-05 
09:54:15.000000000 +0200
@@ -29,7 +29,6 @@
       #
       class NegatedIfElseCondition < Base
         include RangeHelp
-        include CommentsHelp
         extend AutoCorrector
 
         MSG = 'Invert the negated condition and swap the %<type>s branches.'
@@ -98,21 +97,30 @@
           if node.if_branch.nil?
             corrector.remove(range_by_whole_lines(node.loc.else, 
include_final_newline: true))
           else
-            if_range = node_with_comments(node.if_branch)
-            else_range = node_with_comments(node.else_branch)
+            if_range = if_range(node)
+            else_range = else_range(node)
 
             corrector.replace(if_range, else_range.source)
             corrector.replace(else_range, if_range.source)
           end
         end
 
-        def node_with_comments(node)
-          first_statement = node.begin_type? ? node.children[0] : node
-          return node if 
processed_source.ast_with_comments[first_statement].empty?
-
-          begin_pos = source_range_with_comment(first_statement).begin_pos
-          end_pos = node.source_range.end_pos
-          Parser::Source::Range.new(buffer, begin_pos, end_pos)
+        # Collect the entire if branch, including whitespace and comments
+        def if_range(node)
+          if node.ternary?
+            node.if_branch
+          else
+            range_between(node.condition.loc.expression.end_pos, 
node.loc.else.begin_pos)
+          end
+        end
+
+        # Collect the entire else branch, including whitespace and comments
+        def else_range(node)
+          if node.ternary?
+            node.else_branch
+          else
+            range_between(node.loc.else.end_pos, node.loc.end.begin_pos)
+          end
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/single_line_methods.rb 
new/lib/rubocop/cop/style/single_line_methods.rb
--- old/lib/rubocop/cop/style/single_line_methods.rb    2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/style/single_line_methods.rb    2021-05-05 
09:54:15.000000000 +0200
@@ -68,6 +68,7 @@
           return false unless endless_method_config['Enabled']
           return false if endless_method_config['EnforcedStyle'] == 'disallow'
           return false unless body_node
+          return false if body_node.parent.assignment_method?
 
           !(body_node.begin_type? || body_node.kwbegin_type?)
         end
@@ -115,15 +116,19 @@
         end
 
         def method_body_source(method_body)
-          if !method_body.send_type? || method_body.arguments.empty? || 
method_body.parenthesized?
-            method_body.source
-          else
+          if require_parentheses?(method_body)
             arguments_source = method_body.arguments.map(&:source).join(', ')
             body_source = "#{method_body.method_name}(#{arguments_source})"
 
             method_body.receiver ? 
"#{method_body.receiver.source}.#{body_source}" : body_source
+          else
+            method_body.source
           end
         end
+
+        def require_parentheses?(method_body)
+          method_body.send_type? && !method_body.arguments.empty? && 
!method_body.comparison_method?
+        end
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/style/sole_nested_conditional.rb 
new/lib/rubocop/cop/style/sole_nested_conditional.rb
--- old/lib/rubocop/cop/style/sole_nested_conditional.rb        2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/style/sole_nested_conditional.rb        2021-05-05 
09:54:15.000000000 +0200
@@ -80,10 +80,7 @@
         def autocorrect(corrector, node, if_branch)
           corrector.wrap(node.condition, '(', ')') if node.condition.or_type?
 
-          if node.unless?
-            corrector.replace(node.loc.keyword, 'if')
-            corrector.insert_before(node.condition, '!')
-          end
+          correct_from_unless_to_if(corrector, node) if node.unless?
 
           and_operator = if_branch.unless? ? ' && !' : ' && '
           if if_branch.modifier_form?
@@ -94,6 +91,17 @@
           end
         end
 
+        def correct_from_unless_to_if(corrector, node)
+          corrector.replace(node.loc.keyword, 'if')
+
+          condition = node.condition
+          if condition.send_type? && condition.comparison_method? && 
!condition.parenthesized?
+            corrector.wrap(node.condition, '!(', ')')
+          else
+            corrector.insert_before(node.condition, '!')
+          end
+        end
+
         def correct_for_guard_condition_style(corrector, node, if_branch, 
and_operator)
           outer_condition = node.condition
           correct_outer_condition(corrector, outer_condition)
@@ -136,7 +144,8 @@
         end
 
         def requrie_parentheses?(condition)
-          condition.send_type? && !condition.arguments.empty? && 
!condition.parenthesized?
+          condition.send_type? && !condition.arguments.empty? && 
!condition.parenthesized? &&
+            !condition.comparison_method?
         end
 
         def arguments_range(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/cop/variable_force/branch.rb 
new/lib/rubocop/cop/variable_force/branch.rb
--- old/lib/rubocop/cop/variable_force/branch.rb        2021-04-20 
10:04:17.000000000 +0200
+++ new/lib/rubocop/cop/variable_force/branch.rb        2021-05-05 
09:54:15.000000000 +0200
@@ -226,6 +226,21 @@
           end
         end
 
+        # case target
+        # in pattern # in_pattern
+        # else
+        #   else_body
+        # end
+        class CaseMatch < Base
+          define_predicate :target?,     child_index: 0
+          define_predicate :in_pattern?, child_index: 1..-2
+          define_predicate :else_body?,  child_index: -1
+
+          def always_run?
+            target?
+          end
+        end
+
         # for element in collection
         #   loop_body
         # end
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    2021-04-20 10:04:17.000000000 
+0200
+++ new/lib/rubocop/rspec/shared_contexts.rb    2021-05-05 09:54:15.000000000 
+0200
@@ -131,3 +131,7 @@
 RSpec.shared_context 'ruby 3.0', :ruby30 do
   let(:ruby_version) { 3.0 }
 end
+
+RSpec.shared_context 'ruby 3.1', :ruby31 do
+  let(:ruby_version) { 3.1 }
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/target_finder.rb 
new/lib/rubocop/target_finder.rb
--- old/lib/rubocop/target_finder.rb    2021-04-20 10:04:17.000000000 +0200
+++ new/lib/rubocop/target_finder.rb    2021-05-05 09:54:15.000000000 +0200
@@ -100,12 +100,19 @@
                   next true if dir.end_with?('/./', '/../')
                   next true if File.fnmatch?(exclude_pattern, dir, flags)
 
-                  File.symlink?(dir.chomp('/')) && 
File.fnmatch?(exclude_pattern,
-                                                                 
"#{File.realpath(dir)}/", flags)
+                  symlink_excluded_or_infinite_loop?(base_dir, dir, 
exclude_pattern, flags)
                 end
       dirs.flat_map { |dir| wanted_dir_patterns(dir, exclude_pattern, flags) 
}.unshift(base_dir)
     end
 
+    def symlink_excluded_or_infinite_loop?(base_dir, current_dir, 
exclude_pattern, flags)
+      dir_realpath = File.realpath(current_dir)
+      File.symlink?(current_dir.chomp('/')) && (
+        File.fnmatch?(exclude_pattern, "#{dir_realpath}/", flags) ||
+        File.realpath(base_dir).start_with?(dir_realpath)
+      )
+    end
+
     def combined_exclude_glob_patterns(base_dir)
       exclude = @config_store.for(base_dir).for_all_cops['Exclude']
       patterns = exclude.select { |pattern| pattern.is_a?(String) && 
pattern.end_with?('/**/*') }
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      2021-04-20 10:04:17.000000000 +0200
+++ new/lib/rubocop/target_ruby.rb      2021-05-05 09:54:15.000000000 +0200
@@ -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].freeze
+    KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0, 3.1].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  2021-04-20 10:04:17.000000000 +0200
+++ new/lib/rubocop/version.rb  2021-05-05 09:54:15.000000000 +0200
@@ -3,7 +3,7 @@
 module RuboCop
   # This module holds the RuboCop version information.
   module Version
-    STRING = '1.13.0'
+    STRING = '1.14.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  2021-04-20 10:04:17.000000000 +0200
+++ new/lib/rubocop.rb  2021-05-05 09:54:15.000000000 +0200
@@ -82,6 +82,7 @@
 require_relative 'rubocop/cop/mixin/enforce_superclass'
 require_relative 'rubocop/cop/mixin/first_element_line_break'
 require_relative 'rubocop/cop/mixin/frozen_string_literal'
+require_relative 'rubocop/cop/mixin/gem_declaration'
 require_relative 'rubocop/cop/mixin/hash_alignment_styles'
 require_relative 'rubocop/cop/mixin/hash_transform_method'
 require_relative 'rubocop/cop/mixin/ignored_pattern'
@@ -148,6 +149,7 @@
 
 require_relative 'rubocop/cop/bundler/duplicated_gem'
 require_relative 'rubocop/cop/bundler/gem_comment'
+require_relative 'rubocop/cop/bundler/gem_version'
 require_relative 'rubocop/cop/bundler/insecure_protocol_source'
 require_relative 'rubocop/cop/bundler/ordered_gems'
 
@@ -223,6 +225,7 @@
 require_relative 'rubocop/cop/layout/parameter_alignment'
 require_relative 'rubocop/cop/layout/redundant_line_break'
 require_relative 'rubocop/cop/layout/rescue_ensure_alignment'
+require_relative 'rubocop/cop/layout/single_line_block_chain'
 require_relative 'rubocop/cop/layout/space_after_colon'
 require_relative 'rubocop/cop/layout/space_after_comma'
 require_relative 'rubocop/cop/layout/space_after_method_name'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-04-20 10:04:17.000000000 +0200
+++ new/metadata        2021-05-05 09:54:15.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: rubocop
 version: !ruby/object:Gem::Version
-  version: 1.13.0
+  version: 1.14.0
 platform: ruby
 authors:
 - Bozhidar Batsov
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: exe
 cert_chain: []
-date: 2021-04-20 00:00:00.000000000 Z
+date: 2021-05-05 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: parallel
@@ -100,7 +100,7 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.2.0
+        version: 1.5.0
     - - "<"
       - !ruby/object:Gem::Version
         version: '2.0'
@@ -110,7 +110,7 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.2.0
+        version: 1.5.0
     - - "<"
       - !ruby/object:Gem::Version
         version: '2.0'
@@ -221,6 +221,7 @@
 - lib/rubocop/cop/base.rb
 - lib/rubocop/cop/bundler/duplicated_gem.rb
 - lib/rubocop/cop/bundler/gem_comment.rb
+- lib/rubocop/cop/bundler/gem_version.rb
 - lib/rubocop/cop/bundler/insecure_protocol_source.rb
 - lib/rubocop/cop/bundler/ordered_gems.rb
 - lib/rubocop/cop/commissioner.rb
@@ -333,6 +334,7 @@
 - lib/rubocop/cop/layout/parameter_alignment.rb
 - lib/rubocop/cop/layout/redundant_line_break.rb
 - lib/rubocop/cop/layout/rescue_ensure_alignment.rb
+- lib/rubocop/cop/layout/single_line_block_chain.rb
 - lib/rubocop/cop/layout/space_after_colon.rb
 - lib/rubocop/cop/layout/space_after_comma.rb
 - lib/rubocop/cop/layout/space_after_method_name.rb
@@ -524,6 +526,7 @@
 - lib/rubocop/cop/mixin/enforce_superclass.rb
 - lib/rubocop/cop/mixin/first_element_line_break.rb
 - lib/rubocop/cop/mixin/frozen_string_literal.rb
+- lib/rubocop/cop/mixin/gem_declaration.rb
 - lib/rubocop/cop/mixin/hash_alignment_styles.rb
 - lib/rubocop/cop/mixin/hash_transform_method.rb
 - lib/rubocop/cop/mixin/heredoc.rb
@@ -872,7 +875,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.13/
+  documentation_uri: https://docs.rubocop.org/rubocop/1.14/
   bug_tracker_uri: https://github.com/rubocop/rubocop/issues
 post_install_message: 
 rdoc_options: []

Reply via email to