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-02-24 18:20:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old) and /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rubocop" Thu Feb 24 18:20:23 2022 rev:34 rq:956129 version:1.25.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes 2022-02-02 22:45:02.654055377 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.1958/rubygem-rubocop.changes 2022-02-24 18:23:38.702655480 +0100 @@ -1,0 +2,6 @@ +Tue Feb 15 07:41:35 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 1.25.1 + no changelog found + +------------------------------------------------------------------- Old: ---- rubocop-1.25.0.gem New: ---- rubocop-1.25.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rubocop.spec ++++++ --- /var/tmp/diff_new_pack.UiIzhf/_old 2022-02-24 18:23:39.654655232 +0100 +++ /var/tmp/diff_new_pack.UiIzhf/_new 2022-02-24 18:23:39.666655230 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-rubocop -Version: 1.25.0 +Version: 1.25.1 Release: 0 %define mod_name rubocop %define mod_full_name %{mod_name}-%{version} ++++++ rubocop-1.25.0.gem -> rubocop-1.25.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/config/default.yml new/config/default.yml --- old/config/default.yml 2022-01-18 08:45:16.000000000 +0100 +++ new/config/default.yml 2022-02-03 07:44:29.000000000 +0100 @@ -430,13 +430,13 @@ - prepend - extend ExpectedOrder: - - module_inclusion - - constants - - public_class_methods - - initializer - - public_methods - - protected_methods - - private_methods + - module_inclusion + - constants + - public_class_methods + - initializer + - public_methods + - protected_methods + - private_methods Layout/ClosingHeredocIndentation: Description: 'Checks the indentation of here document closings.' @@ -1900,7 +1900,7 @@ VersionAdded: '0.52' Lint/NextWithoutAccumulator: - Description: >- + Description: >- Do not omit the accumulator when calling `next` in a `reduce`/`inject` block. Enabled: true @@ -3153,7 +3153,7 @@ StyleGuide: '#def-self-class-methods' Enabled: false VersionAdded: '0.89' - EnforcedStyle: def_self + EnforcedStyle: def_self SupportedStyles: - def_self - self_class @@ -3815,8 +3815,8 @@ :>: :<= # `ActiveSupport` defines some common inverse methods. They are listed below, # and not enabled by default. - #:present?: :blank?, - #:include?: :exclude? + # :present?: :blank?, + # :include?: :exclude? # `InverseBlocks` are methods that are inverted by inverting the return # of the block that is passed to the method InverseBlocks: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb new/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb --- old/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb 2022-02-03 07:44:29.000000000 +0100 @@ -81,7 +81,7 @@ locations.each do |loc| line = loc.line - next if line == line_of_def_or_kwbegin + next if line == line_of_def_or_kwbegin || last_rescue_and_end_on_same_line(body) keyword = loc.source # below the keyword @@ -91,6 +91,10 @@ end end + def last_rescue_and_end_on_same_line(body) + body.rescue_type? && body.resbody_branches.last.loc.line == body.parent.loc.end.line + end + def message(location, keyword) format(MSG, location: location, keyword: keyword) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/hash_alignment.rb new/lib/rubocop/cop/layout/hash_alignment.rb --- old/lib/rubocop/cop/layout/hash_alignment.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/layout/hash_alignment.rb 2022-02-03 07:44:29.000000000 +0100 @@ -222,11 +222,16 @@ node.pairs.any? && node.parent&.call_type? + left_sibling = argument_before_hash(node) parent_loc = node.parent.loc - selector = parent_loc.selector || parent_loc.expression + selector = left_sibling || parent_loc.selector || parent_loc.expression same_line?(selector, node.pairs.first) end + def argument_before_hash(hash_node) + hash_node.left_sibling.respond_to?(:loc) ? hash_node.left_sibling : nil + end + def reset! self.offenses_by = {} self.column_deltas = Hash.new { |hash, key| hash[key] = {} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/layout/rescue_ensure_alignment.rb new/lib/rubocop/cop/layout/rescue_ensure_alignment.rb --- old/lib/rubocop/cop/layout/rescue_ensure_alignment.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/layout/rescue_ensure_alignment.rb 2022-02-03 07:44:29.000000000 +0100 @@ -143,7 +143,7 @@ return true end - do_keyword_line == selector.line && rescue_keyword_column == selector.column + do_keyword_line == selector&.line && rescue_keyword_column == selector.column end def aligned_with_leading_dot?(do_keyword_line, send_node_loc, rescue_keyword_column) 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-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb 2022-02-03 07:44:29.000000000 +0100 @@ -8,7 +8,7 @@ EXPLICIT_HASH_VALUE_MSG = 'Explicit the hash value.' def on_pair(node) - return if target_ruby_version <= 3.0 || enforced_shorthand_syntax == 'either' + return if ignore_hash_shorthand_syntax?(node) hash_key_source = node.key.source @@ -31,12 +31,17 @@ private + def ignore_hash_shorthand_syntax?(pair_node) + target_ruby_version <= 3.0 || enforced_shorthand_syntax == 'either' || + !pair_node.parent.hash_type? + end + def enforced_shorthand_syntax cop_config.fetch('EnforcedShorthandSyntax', 'always') end def require_hash_value?(hash_key_source, node) - return true if without_parentheses_call_expr_follows?(node) + return true if require_hash_value_for_around_hash_literal?(node) hash_value = node.value return true unless hash_value.send_type? || hash_value.lvar_type? @@ -44,24 +49,33 @@ hash_key_source != hash_value.source || hash_key_source.end_with?('!', '?') end - def without_parentheses_call_expr_follows?(node) + def require_hash_value_for_around_hash_literal?(node) return false unless (ancestor = node.parent.parent) + return false if ancestor.send_type? && ancestor.method?(:[]) - right_sibling = ancestor.right_sibling - - return true if right_sibling.nil? && without_parentheses?(ancestor) - return false unless right_sibling - return true if node_with_block_and_arguments?(right_sibling) + !node.parent.braces? && !use_element_of_hash_literal_as_receiver?(ancestor, node.parent) && + (use_modifier_form_without_parenthesized_method_call?(ancestor) || + without_parentheses_call_expr_follows?(ancestor)) + end - without_parentheses?(ancestor) && without_parentheses?(right_sibling) + def use_element_of_hash_literal_as_receiver?(ancestor, parent) + # `{value:}.do_something` is a valid syntax. + ancestor.send_type? && ancestor.receiver == parent end - def without_parentheses?(node) - node.respond_to?(:parenthesized?) && !node.parenthesized? + def use_modifier_form_without_parenthesized_method_call?(ancestor) + return false if ancestor.respond_to?(:parenthesized?) && ancestor.parenthesized? + return false unless (parent = ancestor.parent) + + parent.respond_to?(:modifier_form?) && parent.modifier_form? end - def node_with_block_and_arguments?(node) - node.respond_to?(:block_type?) && node.block_type? && node.children&.first&.arguments? + def without_parentheses_call_expr_follows?(ancestor) + right_sibling = ancestor.right_sibling + right_sibling ||= ancestor.each_ancestor.find(&:assignment?)&.right_sibling + return false unless right_sibling + + ancestor.respond_to?(:parenthesized?) && !ancestor.parenthesized? && !!right_sibling end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/naming/method_parameter_name.rb new/lib/rubocop/cop/naming/method_parameter_name.rb --- old/lib/rubocop/cop/naming/method_parameter_name.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/naming/method_parameter_name.rb 2022-02-03 07:44:29.000000000 +0100 @@ -26,7 +26,7 @@ # num1 * num2 # end # - # # With `MinArgNameLength` set to number greater than 1 + # # With `MinNameLength` set to number greater than 1 # def baz(a, b, c) # do_stuff(a, b, c) # end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb new/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb --- old/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb 2022-02-03 07:44:29.000000000 +0100 @@ -48,15 +48,21 @@ node.each_ancestor(:def, :defs).any?(&:endless?) && node.arguments.any? end - # Require hash value omission be enclosed in parentheses to prevent the following issue: - # https://bugs.ruby-lang.org/issues/18396. def require_parentheses_for_hash_value_omission?(node) return false unless (last_argument = node.last_argument) + return false if !last_argument.hash_type? || !last_argument.pairs.last&.value_omission? - next_line = node.parent&.assignment? ? node.parent.right_sibling : node.right_sibling - return false unless next_line + modifier_form?(node) || exist_next_line_expression?(node) + end - last_argument.hash_type? && last_argument.pairs.last&.value_omission? && next_line + def modifier_form?(node) + node.parent.respond_to?(:modifier_form?) && node.parent.modifier_form? + end + + # Require hash value omission be enclosed in parentheses to prevent the following issue: + # https://bugs.ruby-lang.org/issues/18396. + def exist_next_line_expression?(node) + node.parent&.assignment? ? node.parent.right_sibling : node.right_sibling end def syntax_like_method_call?(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/redundant_begin.rb new/lib/rubocop/cop/style/redundant_begin.rb --- old/lib/rubocop/cop/style/redundant_begin.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/style/redundant_begin.rb 2022-02-03 07:44:29.000000000 +0100 @@ -97,7 +97,7 @@ offense_range = node.loc.begin add_offense(offense_range) do |corrector| - if any_ancestor_assignment_node?(node) + if node.parent&.assignment? replace_begin_with_statement(corrector, offense_range, node) else corrector.remove(offense_range) @@ -170,11 +170,7 @@ end def valid_begin_assignment?(node) - any_ancestor_assignment_node?(node) && !node.children.one? - end - - def any_ancestor_assignment_node?(node) - node.each_ancestor.any?(&:assignment?) + node.parent&.assignment? && !node.children.one? end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rubocop/cop/style/swap_values.rb new/lib/rubocop/cop/style/swap_values.rb --- old/lib/rubocop/cop/style/swap_values.rb 2022-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/cop/style/swap_values.rb 2022-02-03 07:44:29.000000000 +0100 @@ -58,6 +58,8 @@ end def simple_assignment?(node) + return false unless node.respond_to?(:type) + SIMPLE_ASSIGNMENT_TYPES.include?(node.type) 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-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/formatter/disabled_config_formatter.rb 2022-02-03 07:44:29.000000000 +0100 @@ -121,9 +121,14 @@ output_buffer.puts "# Offense count: #{offense_count}" if show_offense_counts? cop_class = Cop::Registry.global.find_by_cop_name(cop_name) - output_buffer.puts '# Cop supports --auto-correct.' if cop_class&.support_autocorrect? - default_cfg = default_config(cop_name) + + if supports_safe_auto_correct?(cop_class, default_cfg) + output_buffer.puts '# Cop supports --auto-correct.' + elsif supports_unsafe_autocorrect?(cop_class, default_cfg) + output_buffer.puts '# Cop supports --auto-correct-all.' + end + return unless default_cfg params = cop_config_params(default_cfg, cfg) @@ -132,6 +137,15 @@ output_cop_param_comments(output_buffer, params, default_cfg) end + def supports_safe_auto_correct?(cop_class, default_cfg) + cop_class&.support_autocorrect? && + (default_cfg.nil? || default_cfg['Safe'] || default_cfg['Safe'].nil?) + end + + def supports_unsafe_autocorrect?(cop_class, default_cfg) + cop_class&.support_autocorrect? && !default_cfg.nil? && default_cfg['Safe'] == false + end + def cop_config_params(default_cfg, cfg) default_cfg.keys - %w[Description StyleGuide Reference Enabled Exclude Safe 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-01-18 08:45:16.000000000 +0100 +++ new/lib/rubocop/version.rb 2022-02-03 07:44:29.000000000 +0100 @@ -3,7 +3,7 @@ module RuboCop # This module holds the RuboCop version information. module Version - STRING = '1.25.0' + STRING = '1.25.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 2022-01-18 08:45:16.000000000 +0100 +++ new/metadata 2022-02-03 07:44:29.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rubocop version: !ruby/object:Gem::Version - version: 1.25.0 + version: 1.25.1 platform: ruby authors: - Bozhidar Batsov @@ -10,7 +10,7 @@ autorequire: bindir: exe cert_chain: [] -date: 2022-01-18 00:00:00.000000000 Z +date: 2022-02-03 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: parallel