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 2023-10-17 20:24:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old) and /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.20540 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rubocop" Tue Oct 17 20:24:45 2023 rev:48 rq:1118191 version:1.57.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes 2023-10-12 23:43:00.566852924 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.20540/rubygem-rubocop.changes 2023-10-17 20:24:53.499057916 +0200 @@ -1,0 +2,16 @@ +Fri Oct 13 18:48:13 UTC 2023 - Mykola Krachkovsky <w01dn...@gmail.com> + +- updated to version 1.57.1 + + ## 1.57.1 (2023-10-13) + + ### Bug fixes + + * [#12271](https://github.com/rubocop/rubocop/issues/12271): Fix a false positive for `Lint/RedundantSafeNavigation` when using snake case constant receiver. ([@koic][]) + * [#12265](https://github.com/rubocop/rubocop/issues/12265): Fix an error for `Layout/MultilineMethodCallIndentation` when usingarithmetic operation with block inside a grouped expression. ([@koic][]) + * [#12177](https://github.com/rubocop/rubocop/pull/12177): Fix an incorrect autocorrect for `Style/RedundantException`. ([@ydah][]) + * [#12261](https://github.com/rubocop/rubocop/issues/12261): Fix an infinite loop for `Layout/MultilineMethodCallIndentation` when multiline method chain with a block argument and method chain. ([@ydah][]) + * [#12263](https://github.com/rubocop/rubocop/issues/12263): Fix false positives for `Style/RedundantDoubleSplatHashBraces` when method call for no hash braced double splat receiver. ([@koic][]) + * [#12262](https://github.com/rubocop/rubocop/pull/12262): Fix an incorrect autocorrect for `Style/RedundantDoubleSplatHashBraces` when using double splat hash braces with `merge` method call twice. ([@koic][]) + +------------------------------------------------------------------- Old: ---- rubocop-1.57.0.gem New: ---- rubocop-1.57.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rubocop.spec ++++++ --- /var/tmp/diff_new_pack.IsOXq4/_old 2023-10-17 20:24:54.403089563 +0200 +++ /var/tmp/diff_new_pack.IsOXq4/_new 2023-10-17 20:24:54.407089703 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-rubocop -Version: 1.57.0 +Version: 1.57.1 Release: 0 %define mod_name rubocop %define mod_full_name %{mod_name}-%{version} ++++++ rubocop-1.57.0.gem -> rubocop-1.57.1.gem ++++++ Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/multiline_method_call_indentation.rb new/lib/rubocop/cop/layout/multiline_method_call_indentation.rb --- old/lib/rubocop/cop/layout/multiline_method_call_indentation.rb 2023-10-11 12:49:43.000000000 +0200 +++ new/lib/rubocop/cop/layout/multiline_method_call_indentation.rb 2023-10-13 09:36:04.000000000 +0200 @@ -182,7 +182,7 @@ return unless rhs.source.start_with?('.', '&.') node = semantic_alignment_node(node) - return unless node&.loc&.selector + return unless node&.loc&.selector && node.loc.dot node.loc.dot.join(node.loc.selector) end @@ -227,7 +227,11 @@ return unless (block_node = node.each_descendant(:block, :numblock).first) return unless block_node.multiline? && block_node.parent.call_type? - block_node.parent + if node.receiver.call_type? + node.receiver + else + block_node.parent + end end def first_call_has_a_dot(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/lint/redundant_safe_navigation.rb new/lib/rubocop/cop/lint/redundant_safe_navigation.rb --- old/lib/rubocop/cop/lint/redundant_safe_navigation.rb 2023-10-11 12:49:43.000000000 +0200 +++ new/lib/rubocop/cop/lint/redundant_safe_navigation.rb 2023-10-13 09:36:04.000000000 +0200 @@ -4,8 +4,8 @@ module Cop module Lint # Checks for redundant safe navigation calls. - # Use cases where a constant is `nil` are rare and an offense is detected - # when the receiver is a constant. + # Use cases where a constant, named in camel case for classes and modules is `nil` are rare, + # and an offense is not detected when the receiver is a snake case constant. # # For all receivers, the `instance_of?`, `kind_of?`, `is_a?`, `eql?`, `respond_to?`, # and `equal?` methods are checked by default. @@ -26,7 +26,7 @@ # # @example # # bad - # Const&.do_something + # CamelCaseConst&.do_something # # # bad # do_something if attrs&.respond_to?(:[]) @@ -40,7 +40,7 @@ # end # # # good - # Const.do_something + # CamelCaseConst.do_something # # # good # while node.is_a?(BeginNode) @@ -67,13 +67,16 @@ NIL_SPECIFIC_METHODS = (nil.methods - Object.new.methods).to_set.freeze + SNAKE_CASE = /\A[[:digit:][:upper:]_]+\z/.freeze + # @!method respond_to_nil_specific_method?(node) def_node_matcher :respond_to_nil_specific_method?, <<~PATTERN (csend _ :respond_to? (sym %NIL_SPECIFIC_METHODS)) PATTERN + # rubocop:disable Metrics/AbcSize def on_csend(node) - unless node.receiver.const_type? + unless node.receiver.const_type? && !node.receiver.source.match?(SNAKE_CASE) return unless check?(node) && allowed_method?(node.method_name) return if respond_to_nil_specific_method?(node) end @@ -81,6 +84,7 @@ range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos) add_offense(range) { |corrector| corrector.replace(node.loc.dot, '.') } end + # rubocop:enable Metrics/AbcSize private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb new/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb --- old/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb 2023-10-11 12:49:43.000000000 +0200 +++ new/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb 2023-10-13 09:36:04.000000000 +0200 @@ -27,10 +27,11 @@ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def on_hash(node) - return if !node.braces? || node.pairs.empty? || node.pairs.any?(&:hash_rocket?) + return if node.pairs.empty? || node.pairs.any?(&:hash_rocket?) return unless (parent = node.parent) - return unless (kwsplat = node.each_ancestor(:kwsplat).first) return if parent.call_type? && !merge_method?(parent) + return unless (kwsplat = node.each_ancestor(:kwsplat).first) + return if allowed_double_splat_receiver?(kwsplat) add_offense(kwsplat) do |corrector| autocorrect(corrector, node, kwsplat) @@ -40,6 +41,14 @@ private + def allowed_double_splat_receiver?(kwsplat) + return false unless kwsplat.children.first.call_type? + + root_receiver = root_receiver(kwsplat.children.first) + + !root_receiver&.hash_type? + end + def autocorrect(corrector, node, kwsplat) corrector.remove(kwsplat.loc.operator) corrector.remove(opening_brace(node)) @@ -51,6 +60,15 @@ autocorrect_merge_methods(corrector, merge_methods, kwsplat) end + def root_receiver(node) + receiver = node.receiver + if receiver&.receiver + root_receiver(receiver) + else + receiver + end + end + def select_merge_method_nodes(kwsplat) extract_send_methods(kwsplat).select do |node| merge_method?(node) @@ -84,7 +102,7 @@ end def extract_send_methods(kwsplat) - @extract_send_methods ||= kwsplat.each_descendant(:send, :csend) + kwsplat.each_descendant(:send, :csend) end def convert_to_new_arguments(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/redundant_exception.rb new/lib/rubocop/cop/style/redundant_exception.rb --- old/lib/rubocop/cop/style/redundant_exception.rb 2023-10-11 12:49:43.000000000 +0200 +++ new/lib/rubocop/cop/style/redundant_exception.rb 2023-10-13 09:36:04.000000000 +0200 @@ -5,17 +5,21 @@ module Style # Checks for RuntimeError as the argument of raise/fail. # - # It checks for code like this: - # # @example - # # Bad + # # bad # raise RuntimeError, 'message' - # - # # Bad # raise RuntimeError.new('message') # - # # Good + # # good # raise 'message' + # + # # bad - message is not a string + # raise RuntimeError, Object.new + # raise RuntimeError.new(Object.new) + # + # # good + # raise Object.new.to_s + # class RedundantException < Base extend AutoCorrector @@ -30,26 +34,42 @@ fix_exploded(node) || fix_compact(node) end + private + def fix_exploded(node) exploded?(node) do |command, message| add_offense(node, message: MSG_1) do |corrector| - if node.parenthesized? - corrector.replace(node, "#{command}(#{message.source})") - else - corrector.replace(node, "#{command} #{message.source}") - end + corrector.replace(node, replaced_exploded(node, command, message)) end end end + def replaced_exploded(node, command, message) + arg = string_message?(message) ? message.source : "#{message.source}.to_s" + arg = node.parenthesized? ? "(#{arg})" : " #{arg}" + "#{command}#{arg}" + end + + def string_message?(message) + message.str_type? || message.dstr_type? || message.xstr_type? + end + def fix_compact(node) compact?(node) do |new_call, message| add_offense(node, message: MSG_2) do |corrector| - corrector.replace(new_call, message.source) + corrector.replace(new_call, replaced_compact(message)) end end end + def replaced_compact(message) + if string_message?(message) + message.source + else + "#{message.source}.to_s" + end + end + # @!method exploded?(node) def_node_matcher :exploded?, <<~PATTERN (send nil? ${:raise :fail} (const {nil? cbase} :RuntimeError) $_) 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 2023-10-11 12:49:43.000000000 +0200 +++ new/lib/rubocop/version.rb 2023-10-13 09:36:04.000000000 +0200 @@ -3,7 +3,7 @@ module RuboCop # This module holds the RuboCop version information. module Version - STRING = '1.57.0' + STRING = '1.57.1' 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/metadata new/metadata --- old/metadata 2023-10-11 12:49:43.000000000 +0200 +++ new/metadata 2023-10-13 09:36:04.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rubocop version: !ruby/object:Gem::Version - version: 1.57.0 + version: 1.57.1 platform: ruby authors: - Bozhidar Batsov @@ -10,7 +10,7 @@ autorequire: bindir: exe cert_chain: [] -date: 2023-10-11 00:00:00.000000000 Z +date: 2023-10-13 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: base64