Hello community,

here is the log from the commit of package rubygem-rubocop-ast for 
openSUSE:Factory checked in at 2020-10-05 19:33:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop-ast (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-rubocop-ast.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-rubocop-ast"

Mon Oct  5 19:33:28 2020 rev:4 rq:838077 version:0.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rubocop-ast/rubygem-rubocop-ast.changes  
2020-09-08 22:51:01.427624390 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-rubocop-ast.new.4249/rubygem-rubocop-ast.changes
        2020-10-05 19:33:34.069226138 +0200
@@ -1,0 +2,6 @@
+Fri Sep 25 14:50:15 UTC 2020 - Stephan Kulow <[email protected]>
+
+updated to version 0.5.0
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  rubocop-ast-0.3.0.gem

New:
----
  rubocop-ast-0.5.0.gem

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

Other differences:
------------------
++++++ rubygem-rubocop-ast.spec ++++++
--- /var/tmp/diff_new_pack.HCQ81A/_old  2020-10-05 19:33:35.605227639 +0200
+++ /var/tmp/diff_new_pack.HCQ81A/_new  2020-10-05 19:33:35.609227643 +0200
@@ -16,26 +16,28 @@
 #
 
 
-%define mod_name rubocop-ast
-%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-ast
-Version:        0.3.0
+Version:        0.5.0
 Release:        0
-Summary:        RuboCop tools to deal with Ruby code AST
-License:        MIT
-Group:          Development/Languages/Ruby
-URL:            https://github.com/rubocop-hq/rubocop-ast
-Source:         https://rubygems.org/gems/%{mod_full_name}.gem
-Source1:        gem2rpm.yml
+%define mod_name rubocop-ast
+%define mod_full_name %{mod_name}-%{version}
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  %{ruby >= 2.3.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
+URL:            https://github.com/rubocop-hq/rubocop-ast
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
+Source1:        gem2rpm.yml
+Summary:        RuboCop tools to deal with Ruby code AST
+License:        MIT
+Group:          Development/Languages/Ruby
 
 %description
 RuboCop's Node and NodePattern classes.

++++++ rubocop-ast-0.3.0.gem -> rubocop-ast-0.5.0.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/ast/builder.rb 
new/lib/rubocop/ast/builder.rb
--- old/lib/rubocop/ast/builder.rb      2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/builder.rb      2020-09-24 20:14:08.000000000 +0200
@@ -27,6 +27,7 @@
         case_match:   CaseMatchNode,
         case:         CaseNode,
         class:        ClassNode,
+        const:        ConstNode,
         def:          DefNode,
         defined?:     DefinedNode,
         defs:         DefNode,
@@ -48,6 +49,7 @@
         or:           OrNode,
         pair:         PairNode,
         regexp:       RegexpNode,
+        rescue:       RescueNode,
         resbody:      ResbodyNode,
         return:       ReturnNode,
         csend:        SendNode,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/ext/set.rb 
new/lib/rubocop/ast/ext/set.rb
--- old/lib/rubocop/ast/ext/set.rb      1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rubocop/ast/ext/set.rb      2020-09-24 20:14:08.000000000 +0200
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+test = :foo
+case test
+when Set[:foo]
+  # ok, RUBY_VERSION > 2.4
+else
+  # Harmonize `Set#===`
+  class Set
+    alias === include?
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node/block_node.rb 
new/lib/rubocop/ast/node/block_node.rb
--- old/lib/rubocop/ast/node/block_node.rb      2020-08-02 03:02:52.000000000 
+0200
+++ new/lib/rubocop/ast/node/block_node.rb      2020-09-24 20:14:08.000000000 
+0200
@@ -25,7 +25,7 @@
       # @return [Array<Node>]
       def arguments
         if numblock_type?
-          [] # Numbered parameters have no block arguments.
+          [].freeze # Numbered parameters have no block arguments.
         else
           node_parts[1]
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node/const_node.rb 
new/lib/rubocop/ast/node/const_node.rb
--- old/lib/rubocop/ast/node/const_node.rb      1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/rubocop/ast/node/const_node.rb      2020-09-24 20:14:08.000000000 
+0200
@@ -0,0 +1,65 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module AST
+    # A node extension for `const` nodes.
+    class ConstNode < Node
+      # The `send` node associated with this block.
+      #
+      # @return [Node, nil] the node associated with the scope (e.g. cbase, 
const, ...)
+      def namespace
+        children[0]
+      end
+
+      # @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => 
:Bar
+      def short_name
+        children[1]
+      end
+
+      # The body of this block.
+      #
+      # @return [Boolean] if the constant is a Module / Class, according to 
the standard convention.
+      #                   Note: some classes might have uppercase in which 
case this method
+      #                         returns false
+      def module_name?
+        short_name.match?(/[[:lower:]]/)
+      end
+      alias class_name? module_name?
+
+      # @return [Boolean] if the constant starts with `::` (aka s(:cbase))
+      def absolute?
+        return false unless namespace
+
+        each_path.first.cbase_type?
+      end
+
+      # @return [Boolean] if the constant does not start with `::` (aka 
s(:cbase))
+      def relative?
+        !absolute?
+      end
+
+      # Yield nodes for the namespace
+      #
+      #   For `::Foo::Bar::BAZ` => yields:
+      #      s(:cbase), then
+      #      s(:const, :Foo), then
+      #      s(:const, s(:const, :Foo), :Bar)
+      def each_path(&block)
+        return to_enum(__method__) unless block_given?
+
+        descendants = []
+        last = self
+        loop do
+          last = last.children.first
+          break if last.nil?
+
+          descendants << last
+          break unless last.const_type?
+        end
+        descendants.reverse_each(&block)
+
+        self
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node/mixin/parameterized_node.rb 
new/lib/rubocop/ast/node/mixin/parameterized_node.rb
--- old/lib/rubocop/ast/node/mixin/parameterized_node.rb        2020-08-02 
03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/node/mixin/parameterized_node.rb        2020-09-24 
20:14:08.000000000 +0200
@@ -82,9 +82,9 @@
       # and optimizes other calls
       module RestArguments
         include ParameterizedNode
-        # @return [Array] arguments, if any
+        # @return [Array<Node>] arguments, if any
         def arguments
-          children[first_argument_index..-1]
+          children[first_argument_index..-1].freeze
         end
 
         # A shorthand for getting the first argument of the node.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node/resbody_node.rb 
new/lib/rubocop/ast/node/resbody_node.rb
--- old/lib/rubocop/ast/node/resbody_node.rb    2020-08-02 03:02:52.000000000 
+0200
+++ new/lib/rubocop/ast/node/resbody_node.rb    2020-09-24 20:14:08.000000000 
+0200
@@ -13,12 +13,33 @@
         node_parts[2]
       end
 
+      # Returns an array of all the exceptions in the `rescue` clause.
+      #
+      # @return [Array<Node>] an array of exception nodes
+      def exceptions
+        exceptions_node = node_parts[0]
+        if exceptions_node.nil?
+          []
+        elsif exceptions_node.array_type?
+          exceptions_node.values
+        else
+          [exceptions_node]
+        end
+      end
+
       # Returns the exception variable of the `rescue` clause.
       #
       # @return [Node, nil] The exception variable of the `resbody`.
       def exception_variable
         node_parts[1]
       end
+
+      # Returns the index of the `resbody` branch within the exception 
handling statement.
+      #
+      # @return [Integer] the index of the `resbody` branch
+      def branch_index
+        parent.resbody_branches.index(self)
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node/rescue_node.rb 
new/lib/rubocop/ast/node/rescue_node.rb
--- old/lib/rubocop/ast/node/rescue_node.rb     1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/rubocop/ast/node/rescue_node.rb     2020-09-24 20:14:08.000000000 
+0200
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+module RuboCop
+  module AST
+    # A node extension for `rescue` nodes. This will be used in place of a
+    # plain node when the builder constructs the AST, making its methods
+    # available to all `rescue` nodes within RuboCop.
+    class RescueNode < Node
+      # Returns the body of the rescue node.
+      #
+      # @return [Node, nil] The body of the rescue node.
+      def body
+        node_parts[0]
+      end
+
+      # Returns an array of all the rescue branches in the exception handling 
statement.
+      #
+      # @return [Array<ResbodyNode>] an array of `resbody` nodes
+      def resbody_branches
+        node_parts[1...-1]
+      end
+
+      # Returns an array of all the rescue branches in the exception handling 
statement.
+      #
+      # @return [Array<Node, nil>] an array of the bodies of the rescue 
branches
+      # and the else (if any). Note that these bodies could be nil.
+      def branches
+        bodies = resbody_branches.map(&:body)
+        bodies.push(else_branch) if else?
+        bodies
+      end
+
+      # Returns the else branch of the exception handling statement, if any.
+      #
+      # @return [Node] the else branch node of the exception handling statement
+      # @return [nil] if the exception handling statement does not have an 
else branch.
+      def else_branch
+        node_parts[-1]
+      end
+
+      # Checks whether this exception handling statement has an `else` branch.
+      #
+      # @return [Boolean] whether the exception handling statement has an 
`else` branch
+      def else?
+        loc.else
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node.rb new/lib/rubocop/ast/node.rb
--- old/lib/rubocop/ast/node.rb 2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/node.rb 2020-09-24 20:14:08.000000000 +0200
@@ -38,7 +38,7 @@
       IMMUTABLE_LITERALS = (LITERALS - MUTABLE_LITERALS).freeze
 
       EQUALS_ASSIGNMENTS = %i[lvasgn ivasgn cvasgn gvasgn
-                              casgn masgn].freeze
+                              casgn masgn rasgn mrasgn].freeze
       SHORTHAND_ASSIGNMENTS = %i[op_asgn or_asgn and_asgn].freeze
       ASSIGNMENTS = (EQUALS_ASSIGNMENTS + SHORTHAND_ASSIGNMENTS).freeze
 
@@ -92,6 +92,16 @@
         @mutable_attributes[:parent] = node
       end
 
+      # @return [Boolean]
+      def parent?
+        !!parent
+      end
+
+      # @return [Boolean]
+      def root?
+        !parent
+      end
+
       def complete!
         @mutable_attributes.freeze
         each_child_node(&:complete!)
@@ -116,12 +126,50 @@
 
       # Returns the index of the receiver node in its siblings. (Sibling index
       # uses zero based numbering.)
+      # Use is discouraged, this is a potentially slow method.
       #
-      # @return [Integer] the index of the receiver node in its siblings
+      # @return [Integer, nil] the index of the receiver node in its siblings
       def sibling_index
         parent&.children&.index { |sibling| sibling.equal?(self) }
       end
 
+      # Use is discouraged, this is a potentially slow method and can lead
+      # to even slower algorithms
+      # @return [Node, nil] the right (aka next) sibling
+      def right_sibling
+        return unless parent
+
+        parent.children[sibling_index + 1].freeze
+      end
+
+      # Use is discouraged, this is a potentially slow method and can lead
+      # to even slower algorithms
+      # @return [Node, nil] the left (aka previous) sibling
+      def left_sibling
+        i = sibling_index
+        return if i.nil? || i.zero?
+
+        parent.children[i - 1].freeze
+      end
+
+      # Use is discouraged, this is a potentially slow method and can lead
+      # to even slower algorithms
+      # @return [Array<Node>] the left (aka previous) siblings
+      def left_siblings
+        return [].freeze unless parent
+
+        parent.children[0...sibling_index].freeze
+      end
+
+      # Use is discouraged, this is a potentially slow method and can lead
+      # to even slower algorithms
+      # @return [Array<Node>] the right (aka next) siblings
+      def right_siblings
+        return [].freeze unless parent
+
+        parent.children[sibling_index + 1..-1].freeze
+      end
+
       # Common destructuring method. This can be used to normalize
       # destructuring for different variations of the node.
       # Some node types override this with their own custom
@@ -261,8 +309,10 @@
         self
       end
 
+      # Note: Some rare nodes may have no source, like `s(:args)` in `foo {}`
+      # @return [String, nil]
       def source
-        loc.expression.source
+        loc.expression&.source
       end
 
       def source_range
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/node_pattern.rb 
new/lib/rubocop/ast/node_pattern.rb
--- old/lib/rubocop/ast/node_pattern.rb 2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/node_pattern.rb 2020-09-24 20:14:08.000000000 +0200
@@ -205,7 +205,7 @@
 
         def initialize(str, root = 'node0', node_var = root)
           @string   = str
-          # For def_node_pattern, root == node_var
+          # For def_node_matcher, root == node_var
           # For def_node_search, root is the root node to search on,
           # and node_var is the current descendant being searched.
           @root     = root
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/processed_source.rb 
new/lib/rubocop/ast/processed_source.rb
--- old/lib/rubocop/ast/processed_source.rb     2020-08-02 03:02:52.000000000 
+0200
+++ new/lib/rubocop/ast/processed_source.rb     2020-09-24 20:14:08.000000000 
+0200
@@ -159,6 +159,20 @@
           .length
       end
 
+      def tokens_within(range_or_node)
+        begin_index = first_token_index(range_or_node)
+        end_index = last_token_index(range_or_node)
+        sorted_tokens[begin_index..end_index]
+      end
+
+      def first_token_of(range_or_node)
+        sorted_tokens[first_token_index(range_or_node)]
+      end
+
+      def last_token_of(range_or_node)
+        sorted_tokens[last_token_index(range_or_node)]
+      end
+
       private
 
       def comment_index
@@ -215,9 +229,9 @@
         when 2.7
           require 'parser/ruby27'
           Parser::Ruby27
-        when 2.8
-          require 'parser/ruby28'
-          Parser::Ruby28
+        when 2.8, 3.0
+          require 'parser/ruby30'
+          Parser::Ruby30
         else
           raise ArgumentError,
                 "RuboCop found unknown Ruby version: #{ruby_version.inspect}"
@@ -240,6 +254,32 @@
           end
         end
       end
+
+      def first_token_index(range_or_node)
+        begin_pos = source_range(range_or_node).begin_pos
+        sorted_tokens.bsearch_index { |token| token.begin_pos >= begin_pos }
+      end
+
+      def last_token_index(range_or_node)
+        end_pos = source_range(range_or_node).end_pos
+        sorted_tokens.bsearch_index { |token| token.end_pos >= end_pos }
+      end
+
+      # The tokens list is always sorted by token position, except for cases 
when heredoc
+      # is passed as a method argument. In this case tokens are interleaved by
+      # heredoc contents' tokens.
+      def sorted_tokens
+        # Use stable sort.
+        @sorted_tokens ||= tokens.sort_by.with_index { |token, i| 
[token.begin_pos, i] }
+      end
+
+      def source_range(range_or_node)
+        if range_or_node.respond_to?(:source_range)
+          range_or_node.source_range
+        else
+          range_or_node
+        end
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/traversal.rb 
new/lib/rubocop/ast/traversal.rb
--- old/lib/rubocop/ast/traversal.rb    2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/traversal.rb    2020-09-24 20:14:08.000000000 +0200
@@ -28,7 +28,7 @@
                              arg_expr pin match_rest if_guard unless_guard
                              match_with_trailing_comma].freeze
       MANY_CHILD_NODES  = %i[dstr dsym xstr regexp array hash pair
-                             mlhs masgn or_asgn and_asgn
+                             mlhs masgn or_asgn and_asgn rasgn mrasgn
                              undef alias args super yield or and
                              while_post until_post iflipflop eflipflop
                              match_with_lvasgn begin kwbegin return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast/version.rb 
new/lib/rubocop/ast/version.rb
--- old/lib/rubocop/ast/version.rb      2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast/version.rb      2020-09-24 20:14:08.000000000 +0200
@@ -3,7 +3,7 @@
 module RuboCop
   module AST
     module Version
-      STRING = '0.3.0'
+      STRING = '0.5.0'
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rubocop/ast.rb new/lib/rubocop/ast.rb
--- old/lib/rubocop/ast.rb      2020-08-02 03:02:52.000000000 +0200
+++ new/lib/rubocop/ast.rb      2020-09-24 20:14:08.000000000 +0200
@@ -5,6 +5,7 @@
 require 'set'
 
 require_relative 'ast/ext/range'
+require_relative 'ast/ext/set'
 require_relative 'ast/node_pattern'
 require_relative 'ast/sexp'
 require_relative 'ast/node'
@@ -28,6 +29,7 @@
 require_relative 'ast/node/case_match_node'
 require_relative 'ast/node/case_node'
 require_relative 'ast/node/class_node'
+require_relative 'ast/node/const_node'
 require_relative 'ast/node/def_node'
 require_relative 'ast/node/defined_node'
 require_relative 'ast/node/ensure_node'
@@ -47,6 +49,7 @@
 require_relative 'ast/node/pair_node'
 require_relative 'ast/node/range_node'
 require_relative 'ast/node/regexp_node'
+require_relative 'ast/node/rescue_node'
 require_relative 'ast/node/resbody_node'
 require_relative 'ast/node/return_node'
 require_relative 'ast/node/self_class_node'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2020-08-02 03:02:52.000000000 +0200
+++ new/metadata        2020-09-24 20:14:08.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: rubocop-ast
 version: !ruby/object:Gem::Version
-  version: 0.3.0
+  version: 0.5.0
 platform: ruby
 authors:
 - Bozhidar Batsov
@@ -10,7 +10,7 @@
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2020-08-02 00:00:00.000000000 Z
+date: 2020-09-24 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: parser
@@ -18,14 +18,14 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 2.7.1.4
+        version: 2.7.1.5
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 2.7.1.4
+        version: 2.7.1.5
 - !ruby/object:Gem::Dependency
   name: bundler
   requirement: !ruby/object:Gem::Requirement
@@ -60,6 +60,7 @@
 - lib/rubocop/ast.rb
 - lib/rubocop/ast/builder.rb
 - lib/rubocop/ast/ext/range.rb
+- lib/rubocop/ast/ext/set.rb
 - lib/rubocop/ast/node.rb
 - lib/rubocop/ast/node/alias_node.rb
 - lib/rubocop/ast/node/and_node.rb
@@ -70,6 +71,7 @@
 - lib/rubocop/ast/node/case_match_node.rb
 - lib/rubocop/ast/node/case_node.rb
 - lib/rubocop/ast/node/class_node.rb
+- lib/rubocop/ast/node/const_node.rb
 - lib/rubocop/ast/node/def_node.rb
 - lib/rubocop/ast/node/defined_node.rb
 - lib/rubocop/ast/node/ensure_node.rb
@@ -101,6 +103,7 @@
 - lib/rubocop/ast/node/range_node.rb
 - lib/rubocop/ast/node/regexp_node.rb
 - lib/rubocop/ast/node/resbody_node.rb
+- lib/rubocop/ast/node/rescue_node.rb
 - lib/rubocop/ast/node/return_node.rb
 - lib/rubocop/ast/node/self_class_node.rb
 - lib/rubocop/ast/node/send_node.rb


Reply via email to