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-07-08 14:03:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old) and /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.1523 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rubocop" Fri Jul 8 14:03:22 2022 rev:40 rq:987857 version:1.31.2 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes 2022-07-02 15:34:41.735031560 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.1523/rubygem-rubocop.changes 2022-07-08 14:03:29.266557050 +0200 @@ -1,0 +2,14 @@ +Fri Jul 8 08:45:47 UTC 2022 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 1.31.2 + + ### Bug fixes + + * [#10774](https://github.com/rubocop/rubocop/pull/10774): Fix false negatives in `Style/DocumentationMethod` when a public method is defined after a private one. ([@Darhazer][]) + * [#10764](https://github.com/rubocop/rubocop/issues/10764): Fix performance issue for Layout/FirstHashElementIndentation and Layout/FirstArrayElementIndentation. ([@j-miyake][]) + * [#10780](https://github.com/rubocop/rubocop/issues/10780): Fix an error when using `rubocop:auto_correct` deprecated custom rake task. ([@koic][]) + * [#10786](https://github.com/rubocop/rubocop/issues/10786): Fix a false positive for `Lint/NonAtomicFileOperation` when using complex conditional. ([@koic][]) + * [#10785](https://github.com/rubocop/rubocop/pull/10785): Fix a false negative for `Style/RedundantParentheses` when parens around a receiver of a method call with an argument. ([@koic][]) + * [#10026](https://github.com/rubocop/rubocop/issues/10026): Fix merging of array parameters in either parent of default config. ([@jonas054][]) + +------------------------------------------------------------------- Old: ---- rubocop-1.31.1.gem New: ---- rubocop-1.31.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rubocop.spec ++++++ --- /var/tmp/diff_new_pack.RPpRHp/_old 2022-07-08 14:03:29.738557612 +0200 +++ /var/tmp/diff_new_pack.RPpRHp/_new 2022-07-08 14:03:29.742557617 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-rubocop -Version: 1.31.1 +Version: 1.31.2 Release: 0 %define mod_name rubocop %define mod_full_name %{mod_name}-%{version} ++++++ rubocop-1.31.1.gem -> rubocop-1.31.2.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/config_loader_resolver.rb new/lib/rubocop/config_loader_resolver.rb --- old/lib/rubocop/config_loader_resolver.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/config_loader_resolver.rb 2022-07-07 10:04:10.000000000 +0200 @@ -179,7 +179,7 @@ def determine_inherit_mode(hash, key) cop_cfg = hash[key] - local_inherit = cop_cfg.delete('inherit_mode') if cop_cfg.is_a?(Hash) + local_inherit = cop_cfg['inherit_mode'] if cop_cfg.is_a?(Hash) local_inherit || hash['inherit_mode'] || {} end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/base.rb new/lib/rubocop/cop/base.rb --- old/lib/rubocop/cop/base.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/base.rb 2022-07-07 10:04:10.000000000 +0200 @@ -48,7 +48,7 @@ InvestigationReport = Struct.new(:cop, :processed_source, :offenses, :corrector) # List of methods names to restrict calls for `on_send` / `on_csend` - RESTRICT_ON_SEND = Set[].freeze + RESTRICT_ON_SEND = Set[].freeze # rubocop:disable InternalAffairs/UselessRestrictOnSend # List of cops that should not try to autocorrect at the same # time as this cop 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-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/generator.rb 2022-07-07 10:04:10.000000000 +0200 @@ -62,6 +62,10 @@ # For example MSG = 'Use `#good_method` instead of `#bad_method`.' + # TODO: Don't call `on_send` unless the method name is in this list + # If you don't need `on_send` in the cop you created, remove it. + RESTRICT_ON_SEND = %%i[bad_method].freeze + # @!method bad_method?(node) def_node_matcher :bad_method?, <<~PATTERN (send nil? :bad_method ...) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb new/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb --- old/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb 2022-07-07 10:04:10.000000000 +0200 @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module InternalAffairs + # Check for useless `RESTRICT_ON_SEND`. + # + # @example + # # bad + # class FooCop + # RESTRICT_ON_SEND = %i[bad_method].freeze + # end + # + # # good + # class FooCop + # RESTRICT_ON_SEND = %i[bad_method].freeze + # def on_send(node) + # # ... + # end + # end + # + # # good + # class FooCop + # RESTRICT_ON_SEND = %i[bad_method].freeze + # def after_send(node) + # # ... + # end + # end + # + class UselessRestrictOnSend < Base + extend AutoCorrector + + MSG = 'Useless `RESTRICT_ON_SEND` is defined.' + + # @!method defined_send_callback?(node) + def_node_search :defined_send_callback?, '(def {:on_send :after_send} ...)' + + def on_casgn(node) + return if !restrict_on_send?(node) || defined_send_callback?(node.parent) + + add_offense(node) do |corrector| + corrector.remove(node) + end + end + + private + + def restrict_on_send?(node) + node.name == :RESTRICT_ON_SEND + 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-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/internal_affairs.rb 2022-07-07 10:04:10.000000000 +0200 @@ -20,3 +20,4 @@ require_relative 'internal_affairs/style_detected_api_use' require_relative 'internal_affairs/undefined_config' require_relative 'internal_affairs/useless_message_assertion' +require_relative 'internal_affairs/useless_restrict_on_send' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/first_array_element_indentation.rb new/lib/rubocop/cop/layout/first_array_element_indentation.rb --- old/lib/rubocop/cop/layout/first_array_element_indentation.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/layout/first_array_element_indentation.rb 2022-07-07 10:04:10.000000000 +0200 @@ -120,14 +120,15 @@ check_first(first_elem, left_bracket, left_parenthesis, 0) end - check_right_bracket(array_node.loc.end, left_bracket, left_parenthesis) + check_right_bracket(array_node.loc.end, first_elem, left_bracket, left_parenthesis) end - def check_right_bracket(right_bracket, left_bracket, left_parenthesis) + def check_right_bracket(right_bracket, first_elem, left_bracket, left_parenthesis) # if the right bracket is on the same line as the last value, accept return if /\S/.match?(right_bracket.source_line[0...right_bracket.column]) - expected_column, indent_base_type = indent_base(left_bracket, left_parenthesis) + expected_column, indent_base_type = indent_base(left_bracket, first_elem, + left_parenthesis) @column_delta = expected_column - right_bracket.column return if @column_delta.zero? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/first_hash_element_indentation.rb new/lib/rubocop/cop/layout/first_hash_element_indentation.rb --- old/lib/rubocop/cop/layout/first_hash_element_indentation.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/layout/first_hash_element_indentation.rb 2022-07-07 10:04:10.000000000 +0200 @@ -158,14 +158,14 @@ end end - check_right_brace(hash_node.loc.end, left_brace, left_parenthesis) + check_right_brace(hash_node.loc.end, first_pair, left_brace, left_parenthesis) end - def check_right_brace(right_brace, left_brace, left_parenthesis) + def check_right_brace(right_brace, first_pair, left_brace, left_parenthesis) # if the right brace is on the same line as the last value, accept return if /\S/.match?(right_brace.source_line[0...right_brace.column]) - expected_column, indent_base_type = indent_base(left_brace, left_parenthesis) + expected_column, indent_base_type = indent_base(left_brace, first_pair, left_parenthesis) @column_delta = expected_column - right_brace.column return if @column_delta.zero? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/lint/non_atomic_file_operation.rb new/lib/rubocop/cop/lint/non_atomic_file_operation.rb --- old/lib/rubocop/cop/lint/non_atomic_file_operation.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/lint/non_atomic_file_operation.rb 2022-07-07 10:04:10.000000000 +0200 @@ -71,18 +71,22 @@ PATTERN def on_send(node) - return unless node.parent&.if_type? - return if node.parent.else_branch + return unless (parent = node.parent) && parent.if_type? + return if allowable_use_with_if?(parent) return if explicit_not_force?(node) - return unless (exist_node = send_exist_node(node.parent).first) + return unless (exist_node = send_exist_node(parent).first) return unless exist_node.first_argument == node.first_argument - offense(node, exist_node) + register_offense(node, exist_node) end private - def offense(node, exist_node) + def allowable_use_with_if?(if_node) + if_node.condition.and_type? || if_node.condition.or_type? || if_node.else_branch + end + + def register_offense(node, exist_node) range = range_between(node.parent.loc.keyword.begin_pos, exist_node.loc.expression.end_pos) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/mixin/def_node.rb new/lib/rubocop/cop/mixin/def_node.rb --- old/lib/rubocop/cop/mixin/def_node.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/mixin/def_node.rb 2022-07-07 10:04:10.000000000 +0200 @@ -5,8 +5,7 @@ # Common functionality for checking def nodes. module DefNode extend NodePattern::Macros - - NON_PUBLIC_MODIFIERS = %w[private protected].freeze + include VisibilityHelp private @@ -15,11 +14,7 @@ end def preceding_non_public_modifier?(node) - stripped_source_upto(node.first_line).any? { |line| NON_PUBLIC_MODIFIERS.include?(line) } - end - - def stripped_source_upto(index) - processed_source[0..index].map(&:strip) + node_visibility(node) != :public end # @!method non_public_modifier?(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/mixin/multiline_element_indentation.rb new/lib/rubocop/cop/mixin/multiline_element_indentation.rb --- old/lib/rubocop/cop/mixin/multiline_element_indentation.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/mixin/multiline_element_indentation.rb 2022-07-07 10:04:10.000000000 +0200 @@ -26,7 +26,7 @@ def check_first(first, left_brace, left_parenthesis, offset) actual_column = first.source_range.column - indent_base_column, indent_base_type = indent_base(left_brace, left_parenthesis) + indent_base_column, indent_base_type = indent_base(left_brace, first, left_parenthesis) expected_column = indent_base_column + configured_indentation_width + offset @column_delta = expected_column - actual_column @@ -47,10 +47,10 @@ end end - def indent_base(left_brace, left_parenthesis) + def indent_base(left_brace, first, left_parenthesis) return [left_brace.column, :left_brace_or_bracket] if style == brace_alignment_style - pair = hash_pair_where_value_beginning_with(left_brace) + pair = hash_pair_where_value_beginning_with(left_brace, first) if pair && key_and_value_begin_on_same_line?(pair) && right_sibling_begins_on_subsequent_line?(pair) return [pair.loc.column, :parent_hash_key] @@ -63,17 +63,10 @@ [left_brace.source_line =~ /\S/, :start_of_line] end - def hash_pair_where_value_beginning_with(left_brace) - node = node_beginning_with(left_brace) - node.parent&.pair_type? ? node.parent : nil - end + def hash_pair_where_value_beginning_with(left_brace, first) + return unless first && first.parent.loc.begin == left_brace - def node_beginning_with(left_brace) - processed_source.ast.each_descendant do |node| - if node.loc.is_a?(Parser::Source::Map::Collection) && (node.loc.begin == left_brace) - break node - end - end + first.parent&.parent&.pair_type? ? first.parent.parent : nil end def key_and_value_begin_on_same_line?(pair) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/module_function.rb new/lib/rubocop/cop/style/module_function.rb --- old/lib/rubocop/cop/style/module_function.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/style/module_function.rb 2022-07-07 10:04:10.000000000 +0200 @@ -117,10 +117,10 @@ end def check_module_function(nodes) - private_directive = nodes.any? { |node| private_directive?(node) } + return if nodes.any? { |node| private_directive?(node) } nodes.each do |node| - yield node if extend_self_node?(node) && !private_directive + yield node if extend_self_node?(node) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/redundant_parentheses.rb new/lib/rubocop/cop/style/redundant_parentheses.rb --- old/lib/rubocop/cop/style/redundant_parentheses.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/style/redundant_parentheses.rb 2022-07-07 10:04:10.000000000 +0200 @@ -81,7 +81,8 @@ end def like_method_argument_parentheses?(node) - node.send_type? && node.arguments.size == 1 && !node.arithmetic_operation? + node.send_type? && node.arguments.one? && + !node.arithmetic_operation? && node.first_argument.begin_type? end def empty_parentheses?(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/top_level_method_definition.rb new/lib/rubocop/cop/style/top_level_method_definition.rb --- old/lib/rubocop/cop/style/top_level_method_definition.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/cop/style/top_level_method_definition.rb 2022-07-07 10:04:10.000000000 +0200 @@ -47,8 +47,6 @@ class TopLevelMethodDefinition < Base MSG = 'Do not define methods at the top-level.' - RESTRICT_ON_SEND = %i[define_method].freeze - def on_def(node) return unless top_level_method_definition?(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/rake_task.rb new/lib/rubocop/rake_task.rb --- old/lib/rubocop/rake_task.rb 2022-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/rake_task.rb 2022-07-07 10:04:10.000000000 +0200 @@ -73,11 +73,15 @@ namespace(name) do # rubocop:todo Naming/InclusiveLanguage task(:auto_correct, *args) do + require 'rainbow' warn Rainbow( 'rubocop:auto_correct task is deprecated; ' \ 'use rubocop:autocorrect task or rubocop:autocorrect_all task instead.' ).yellow - ::Rake::Task['rubocop:autocorrect'].invoke + RakeFileUtils.verbose(verbose) do + yield(*[self, task_args].slice(0, task_block.arity)) if task_block + perform('--autocorrect') + end end # rubocop:enable Naming/InclusiveLanguage 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-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop/version.rb 2022-07-07 10:04:10.000000000 +0200 @@ -3,7 +3,7 @@ module RuboCop # This module holds the RuboCop version information. module Version - STRING = '1.31.1' + STRING = '1.31.2' 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-06-29 08:54:47.000000000 +0200 +++ new/lib/rubocop.rb 2022-07-07 10:04:10.000000000 +0200 @@ -72,7 +72,6 @@ require_relative 'rubocop/cop/mixin/configurable_formatting' require_relative 'rubocop/cop/mixin/configurable_naming' require_relative 'rubocop/cop/mixin/configurable_numbering' -require_relative 'rubocop/cop/mixin/def_node' require_relative 'rubocop/cop/mixin/documentation_comment' require_relative 'rubocop/cop/mixin/duplication' require_relative 'rubocop/cop/mixin/range_help' @@ -130,6 +129,7 @@ require_relative 'rubocop/cop/mixin/unused_argument' require_relative 'rubocop/cop/mixin/visibility_help' require_relative 'rubocop/cop/mixin/comments_help' # relies on visibility_help +require_relative 'rubocop/cop/mixin/def_node' # relies on visibility_help require_relative 'rubocop/cop/utils/format_string' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2022-06-29 08:54:47.000000000 +0200 +++ new/metadata 2022-07-07 10:04:10.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rubocop version: !ruby/object:Gem::Version - version: 1.31.1 + version: 1.31.2 platform: ruby authors: - Bozhidar Batsov @@ -10,7 +10,7 @@ autorequire: bindir: exe cert_chain: [] -date: 2022-06-29 00:00:00.000000000 Z +date: 2022-07-07 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: json @@ -301,6 +301,7 @@ - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb - lib/rubocop/cop/internal_affairs/undefined_config.rb - lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +- lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb - lib/rubocop/cop/layout/access_modifier_indentation.rb - lib/rubocop/cop/layout/argument_alignment.rb - lib/rubocop/cop/layout/array_alignment.rb @@ -985,7 +986,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.2.22 +rubygems_version: 3.1.2 signing_key: specification_version: 4 summary: Automatic Ruby code style checking tool.