Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-rubocop-ast for
openSUSE:Factory checked in at 2023-10-10 21:00:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop-ast (Old)
and /work/SRC/openSUSE:Factory/.rubygem-rubocop-ast.new.28202 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rubocop-ast"
Tue Oct 10 21:00:04 2023 rev:24 rq:1116489 version:1.29.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rubocop-ast/rubygem-rubocop-ast.changes
2022-12-13 18:57:27.351840025 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-rubocop-ast.new.28202/rubygem-rubocop-ast.changes
2023-10-10 21:00:58.819562073 +0200
@@ -1,0 +2,40 @@
+Sat Sep 2 10:04:21 UTC 2023 - Mykola Krachkovsky <[email protected]>
+
+- updated to version 1.29.0
+
+ ## 1.29.0 (2023-06-01)
+
+ * [#262](https://github.com/rubocop/rubocop-ast/pull/267): Introduce
RuboCop::Ast::MethodDispatchNode#selector. ([@gsamokovarov][])
+
+ ## 1.28.1 (2023-05-01)
+
+ ### Bug fixes
+
+ * [#262](https://github.com/rubocop/rubocop-ast/pull/262): Fix an error when
parsing non UTF-8 frozen string. ([@koic][])
+
+ ## 1.28.0 (2023-03-24)
+
+ ### New features
+
+ * [#259](https://github.com/rubocop/rubocop-ast/pull/259): Add
`forwarded_kwrestarg` node to `AST::Builder`. ([@koic][])
+
+ ## 1.27.0 (2023-02-27)
+
+ ### New features
+
+ * [#229](https://github.com/rubocop/rubocop-ast/pull/229): Add
`source_range` method to `NodePattern`. ([@koic][])
+
+ ## 1.26.0 (2023-02-11)
+
+ ### New features
+
+ * [#255](https://github.com/rubocop/rubocop-ast/pull/255): Make
`Node#class_constructor?` aware of Ruby 3.2's `Data.define`. ([@koic][])
+ * [#255](https://github.com/rubocop/rubocop-ast/pull/255): Make
`Node#class_construcor?` aware of Ruby 2.7's numbered parameters. ([@koic][])
+
+ ## 1.25.0 (2023-02-11)
+
+ ### New features
+
+ * [#256](https://github.com/rubocop-hq/rubocop-ast/pull/256): Support
`Parser::Ruby33` for Ruby 3.3 parser (experimental). ([@koic][])
+
+-------------------------------------------------------------------
Old:
----
rubocop-ast-1.24.0.gem
New:
----
rubocop-ast-1.29.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-rubocop-ast.spec ++++++
--- /var/tmp/diff_new_pack.QxHXDH/_old 2023-10-10 21:01:00.923638373 +0200
+++ /var/tmp/diff_new_pack.QxHXDH/_new 2023-10-10 21:01:00.923638373 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-rubocop-ast
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-rubocop-ast
-Version: 1.24.0
+Version: 1.29.0
Release: 0
%define mod_name rubocop-ast
%define mod_full_name %{mod_name}-%{version}
++++++ rubocop-ast-1.24.0.gem -> rubocop-ast-1.29.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 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/builder.rb 2023-06-01 14:34:56.000000000 +0200
@@ -19,76 +19,77 @@
# @api private
NODE_MAP = {
- and: AndNode,
- and_asgn: AndAsgnNode,
- alias: AliasNode,
- arg: ArgNode,
- blockarg: ArgNode,
- forward_arg: ArgNode,
- kwarg: ArgNode,
- kwoptarg: ArgNode,
- kwrestarg: ArgNode,
- optarg: ArgNode,
- restarg: ArgNode,
- shadowarg: ArgNode,
- args: ArgsNode,
- array: ArrayNode,
- lvasgn: AsgnNode,
- ivasgn: AsgnNode,
- cvasgn: AsgnNode,
- gvasgn: AsgnNode,
- block: BlockNode,
- numblock: BlockNode,
- break: BreakNode,
- case_match: CaseMatchNode,
- casgn: CasgnNode,
- case: CaseNode,
- class: ClassNode,
- const: ConstNode,
- def: DefNode,
- defined?: DefinedNode,
- defs: DefNode,
- dstr: DstrNode,
- ensure: EnsureNode,
- for: ForNode,
- forward_args: ForwardArgsNode,
- float: FloatNode,
- hash: HashNode,
- if: IfNode,
- in_pattern: InPatternNode,
- int: IntNode,
- index: IndexNode,
- indexasgn: IndexasgnNode,
- irange: RangeNode,
- erange: RangeNode,
- kwargs: HashNode,
- kwsplat: KeywordSplatNode,
- lambda: LambdaNode,
- module: ModuleNode,
- next: NextNode,
- op_asgn: OpAsgnNode,
- or_asgn: OrAsgnNode,
- or: OrNode,
- pair: PairNode,
- procarg0: Procarg0Node,
- regexp: RegexpNode,
- rescue: RescueNode,
- resbody: ResbodyNode,
- return: ReturnNode,
- csend: SendNode,
- send: SendNode,
- str: StrNode,
- xstr: StrNode,
- sclass: SelfClassNode,
- super: SuperNode,
- zsuper: SuperNode,
- sym: SymbolNode,
- until: UntilNode,
- until_post: UntilNode,
- when: WhenNode,
- while: WhileNode,
- while_post: WhileNode,
- yield: YieldNode
+ and: AndNode,
+ and_asgn: AndAsgnNode,
+ alias: AliasNode,
+ arg: ArgNode,
+ blockarg: ArgNode,
+ forward_arg: ArgNode,
+ kwarg: ArgNode,
+ kwoptarg: ArgNode,
+ kwrestarg: ArgNode,
+ optarg: ArgNode,
+ restarg: ArgNode,
+ shadowarg: ArgNode,
+ args: ArgsNode,
+ array: ArrayNode,
+ lvasgn: AsgnNode,
+ ivasgn: AsgnNode,
+ cvasgn: AsgnNode,
+ gvasgn: AsgnNode,
+ block: BlockNode,
+ numblock: BlockNode,
+ break: BreakNode,
+ case_match: CaseMatchNode,
+ casgn: CasgnNode,
+ case: CaseNode,
+ class: ClassNode,
+ const: ConstNode,
+ def: DefNode,
+ defined?: DefinedNode,
+ defs: DefNode,
+ dstr: DstrNode,
+ ensure: EnsureNode,
+ for: ForNode,
+ forward_args: ForwardArgsNode,
+ forwarded_kwrestarg: KeywordSplatNode,
+ float: FloatNode,
+ hash: HashNode,
+ if: IfNode,
+ in_pattern: InPatternNode,
+ int: IntNode,
+ index: IndexNode,
+ indexasgn: IndexasgnNode,
+ irange: RangeNode,
+ erange: RangeNode,
+ kwargs: HashNode,
+ kwsplat: KeywordSplatNode,
+ lambda: LambdaNode,
+ module: ModuleNode,
+ next: NextNode,
+ op_asgn: OpAsgnNode,
+ or_asgn: OrAsgnNode,
+ or: OrNode,
+ pair: PairNode,
+ procarg0: Procarg0Node,
+ regexp: RegexpNode,
+ rescue: RescueNode,
+ resbody: ResbodyNode,
+ return: ReturnNode,
+ csend: CsendNode,
+ send: SendNode,
+ str: StrNode,
+ xstr: StrNode,
+ sclass: SelfClassNode,
+ super: SuperNode,
+ zsuper: SuperNode,
+ sym: SymbolNode,
+ until: UntilNode,
+ until_post: UntilNode,
+ when: WhenNode,
+ while: WhileNode,
+ while_post: WhileNode,
+ yield: YieldNode
}.freeze
# Generates {Node} from the given information.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/ext/range.rb
new/lib/rubocop/ast/ext/range.rb
--- old/lib/rubocop/ast/ext/range.rb 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/ext/range.rb 2023-06-01 14:34:56.000000000 +0200
@@ -15,8 +15,8 @@
# :bar
# ]
#
- # node.loc.begin.line_span # => 1..1
- # node.loc.expression.line_span(exclude_end: true) # => 1...4
+ # node.loc.begin.line_span # => 1..1
+ # node.source_range.line_span(exclude_end: true) # => 1...4
def line_span(exclude_end: false)
::Range.new(first_line, last_line, exclude_end)
end
@@ -25,4 +25,4 @@
end
end
-::Parser::Source::Range.include ::RuboCop::AST::Ext::Range
+Parser::Source::Range.include RuboCop::AST::Ext::Range
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node/csend_node.rb
new/lib/rubocop/ast/node/csend_node.rb
--- old/lib/rubocop/ast/node/csend_node.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/lib/rubocop/ast/node/csend_node.rb 2023-06-01 14:34:56.000000000
+0200
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module RuboCop
+ module AST
+ # A node extension for `csend` nodes. This will be used in place of a plain
+ # node when the builder constructs the AST, making its methods available
+ # to all `csend` nodes within RuboCop.
+ class CsendNode < SendNode
+ def send_type?
+ false
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node/keyword_splat_node.rb
new/lib/rubocop/ast/node/keyword_splat_node.rb
--- old/lib/rubocop/ast/node/keyword_splat_node.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node/keyword_splat_node.rb 2023-06-01
14:34:56.000000000 +0200
@@ -2,9 +2,9 @@
module RuboCop
module AST
- # A node extension for `kwsplat` nodes. This will be used in place of a
- # plain node when the builder constructs the AST, making its methods
- # available to all `kwsplat` nodes within RuboCop.
+ # A node extension for `kwsplat` and `forwarded_kwrestarg` nodes. This
will be used in
+ # place of a plain node when the builder constructs the AST, making its
methods available to
+ # all `kwsplat` and `forwarded_kwrestarg` nodes within RuboCop.
class KeywordSplatNode < Node
include HashElementNode
@@ -41,6 +41,13 @@
def node_parts
[self, self]
end
+
+ # This provides `forwarded_kwrestarg` node to return true to be
compatible with `kwsplat` node.
+ #
+ # @return [true]
+ def kwsplat_type?
+ true
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node/mixin/descendence.rb
new/lib/rubocop/ast/node/mixin/descendence.rb
--- old/lib/rubocop/ast/node/mixin/descendence.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node/mixin/descendence.rb 2023-06-01
14:34:56.000000000 +0200
@@ -36,7 +36,10 @@
#
# @return [Array<Node>] an array of child nodes
def child_nodes
- each_child_node.to_a
+ # Iterate child nodes directly to avoid allocating an Enumerator.
+ nodes = []
+ each_child_node { |node| nodes << node }
+ nodes
end
# Calls the given block for each descendant node with depth first order.
@@ -102,7 +105,9 @@
protected
def visit_descendants(types, &block)
- each_child_node do |child|
+ children.each do |child|
+ next unless child.is_a?(::AST::Node)
+
yield child if types.empty? || types.include?(child.type)
child.visit_descendants(types, &block)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node/mixin/method_dispatch_node.rb
new/lib/rubocop/ast/node/mixin/method_dispatch_node.rb
--- old/lib/rubocop/ast/node/mixin/method_dispatch_node.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node/mixin/method_dispatch_node.rb 2023-06-01
14:34:56.000000000 +0200
@@ -5,7 +5,7 @@
# Common functionality for nodes that are a kind of method dispatch:
# `send`, `csend`, `super`, `zsuper`, `yield`, `defined?`,
# and (modern only): `index`, `indexasgn`, `lambda`
- module MethodDispatchNode
+ module MethodDispatchNode # rubocop:disable Metrics/ModuleLength
extend NodePattern::Macros
include MethodIdentifierPredicates
@@ -28,6 +28,17 @@
node_parts[1]
end
+ # The source range for the method name or keyword that dispatches this
call.
+ #
+ # @return [Parser::Source::Range] the source range for the method name
or keyword
+ def selector
+ if loc.respond_to? :keyword
+ loc.keyword
+ else
+ loc.selector
+ end
+ end
+
# The `block` or `numblock` node associated with this method dispatch,
if any.
#
# @return [BlockNode, nil] the `block` or `numblock` node associated
with this method
@@ -147,7 +158,7 @@
#
# @return [Boolean] whether the method is the implicit form of `#call`
def implicit_call?
- method?(:call) && !loc.selector
+ method?(:call) && !selector
end
# Whether this method dispatch has an explicit block.
@@ -211,7 +222,7 @@
#
# @return [Boolean] whether this method is a lambda literal
def lambda_literal?
- block_literal? && loc.expression && loc.expression.source == '->'
+ loc.expression.source == '->' && block_literal?
end
# Checks whether this is a unary operation.
@@ -222,9 +233,9 @@
#
# @return [Boolean] whether this method is a unary operation
def unary_operation?
- return false unless loc.selector
+ return false unless selector
- operator_method? && loc.expression.begin_pos == loc.selector.begin_pos
+ operator_method? && loc.expression.begin_pos == selector.begin_pos
end
# Checks whether this is a binary operation.
@@ -235,9 +246,9 @@
#
# @return [Boolean] whether this method is a binary operation
def binary_operation?
- return false unless loc.selector
+ return false unless selector
- operator_method? && loc.expression.begin_pos != loc.selector.begin_pos
+ operator_method? && loc.expression.begin_pos != selector.begin_pos
end
private
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 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node/mixin/parameterized_node.rb 2023-06-01
14:34:56.000000000 +0200
@@ -82,9 +82,17 @@
# and optimizes other calls
module RestArguments
include ParameterizedNode
+
+ EMPTY_ARGUMENTS = [].freeze
+
# @return [Array<Node>] arguments, if any
def arguments
- children[first_argument_index..].freeze
+ if arguments?
+ children.drop(first_argument_index).freeze
+ else
+ # Skip unneeded Array allocation.
+ EMPTY_ARGUMENTS
+ end
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/send_node.rb
new/lib/rubocop/ast/node/send_node.rb
--- old/lib/rubocop/ast/node/send_node.rb 2022-11-30 19:45:02.000000000
+0100
+++ new/lib/rubocop/ast/node/send_node.rb 2023-06-01 14:34:56.000000000
+0200
@@ -15,6 +15,10 @@
(_ _ _ _ ...)]
PATTERN
+ def send_type?
+ true
+ end
+
private
def first_argument_index
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 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node.rb 2023-06-01 14:34:56.000000000 +0200
@@ -84,8 +84,12 @@
LITERAL_RECURSIVE_TYPES = (OPERATOR_KEYWORDS + COMPOSITE_LITERALS +
%i[begin pair]).freeze
private_constant :LITERAL_RECURSIVE_METHODS, :LITERAL_RECURSIVE_TYPES
+ EMPTY_CHILDREN = [].freeze
+ EMPTY_PROPERTIES = {}.freeze
+ private_constant :EMPTY_CHILDREN, :EMPTY_PROPERTIES
+
# @see https://www.rubydoc.info/gems/ast/AST/Node:initialize
- def initialize(type, children = [], properties = {})
+ def initialize(type, children = EMPTY_CHILDREN, properties =
EMPTY_PROPERTIES)
@mutable_attributes = {}
# ::AST::Node#initialize freezes itself.
@@ -101,11 +105,19 @@
end
end
- Parser::Meta::NODE_TYPES.each do |node_type|
+ (Parser::Meta::NODE_TYPES - [:send]).each do |node_type|
method_name = "#{node_type.to_s.gsub(/\W/, '')}_type?"
- define_method(method_name) do
- type == node_type
- end
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
+ def #{method_name} # def block_type?
+ @type == :#{node_type} # @type == :block
+ end # end
+ RUBY
+ end
+
+ # Most nodes are of 'send' type, so this method is defined
+ # separately to make this check as fast as possible.
+ def send_type?
+ false
end
# Returns the parent node, or `nil` if the receiver is a root node.
@@ -203,9 +215,7 @@
# destructuring method.
#
# @return [Array<Node>] the different parts of the ndde
- def node_parts
- to_a
- end
+ alias node_parts to_a
# Calls the given block for each ancestor node from parent to root.
# If no block is given, an `Enumerator` is returned.
@@ -500,8 +510,14 @@
# @!method class_constructor?(node = self)
def_node_matcher :class_constructor?, <<~PATTERN
- { (send #global_const?({:Class :Module :Struct}) :new ...)
- (block (send #global_const?({:Class :Module :Struct}) :new ...) ...)}
+ {
+ (send #global_const?({:Class :Module :Struct}) :new ...)
+ (send #global_const?(:Data) :define ...)
+ ({block numblock} {
+ (send #global_const?({:Class :Module :Struct}) :new ...)
+ (send #global_const?(:Data) :define ...)
+ } ...)
+ }
PATTERN
# @deprecated Use `:class_constructor?`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/ast/node_pattern/compiler/atom_subcompiler.rb
new/lib/rubocop/ast/node_pattern/compiler/atom_subcompiler.rb
--- old/lib/rubocop/ast/node_pattern/compiler/atom_subcompiler.rb
2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node_pattern/compiler/atom_subcompiler.rb
2023-06-01 14:34:56.000000000 +0200
@@ -38,7 +38,7 @@
end
def visit_set
- set = node.children.map(&:child).to_set.freeze
+ set = node.children.to_set(&:child).freeze
NodePattern::Sets[set]
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node_pattern/compiler/debug.rb
new/lib/rubocop/ast/node_pattern/compiler/debug.rb
--- old/lib/rubocop/ast/node_pattern/compiler/debug.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node_pattern/compiler/debug.rb 2023-06-01
14:34:56.000000000 +0200
@@ -47,7 +47,7 @@
# @return [String] a Rainbow colorized version of ruby
def colorize(color_scheme = COLOR_SCHEME)
map = color_map(color_scheme)
- ast.loc.expression.source_buffer.source.chars.map.with_index
do |char, i|
+ ast.source_range.source_buffer.source.chars.map.with_index do
|char, i|
Rainbow(char).color(map[i])
end.join
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node_pattern/node.rb
new/lib/rubocop/ast/node_pattern/node.rb
--- old/lib/rubocop/ast/node_pattern/node.rb 2022-11-30 19:45:02.000000000
+0100
+++ new/lib/rubocop/ast/node_pattern/node.rb 2023-06-01 14:34:56.000000000
+0200
@@ -75,6 +75,10 @@
self.class.new(type, children, { location: location })
end
+ def source_range
+ loc.expression
+ end
+
INT_TO_RANGE = Hash.new { |h, k| h[k] = k..k }
private_constant :INT_TO_RANGE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node_pattern/parser.racc.rb
new/lib/rubocop/ast/node_pattern/parser.racc.rb
--- old/lib/rubocop/ast/node_pattern/parser.racc.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node_pattern/parser.racc.rb 2023-06-01
14:34:56.000000000 +0200
@@ -1,7 +1,7 @@
# frozen_string_literal: true
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.5.1
+# This file is automatically generated by Racc 1.6.2
# from Racc grammar file "".
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/node_pattern/with_meta.rb
new/lib/rubocop/ast/node_pattern/with_meta.rb
--- old/lib/rubocop/ast/node_pattern/with_meta.rb 2022-11-30
19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node_pattern/with_meta.rb 2023-06-01
14:34:56.000000000 +0200
@@ -48,12 +48,12 @@
def emit_unary_op(type, operator_t = nil, *children)
children[-1] = children[-1].first if children[-1].is_a?(Array) #
token?
- map = source_map(children.first.loc.expression, operator_t:
operator_t)
+ map = source_map(children.first.source_range, operator_t:
operator_t)
n(type, children, map)
end
def emit_list(type, begin_t, children, end_t)
- expr =
children.first.loc.expression.join(children.last.loc.expression)
+ expr =
children.first.source_range.join(children.last.source_range)
map = source_map(expr, begin_t: begin_t, end_t: end_t)
n(type, children, map)
end
@@ -79,8 +79,7 @@
end
def join_exprs(left_expr, right_expr)
- left_expr.loc.expression
- .join(right_expr.loc.expression)
+ left_expr.source_range.join(right_expr.source_range)
end
def source_map(token_or_range, begin_t: nil, end_t: nil,
operator_t: nil, selector_t: nil)
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 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/node_pattern.rb 2023-06-01 14:34:56.000000000 +0200
@@ -54,6 +54,22 @@
VAR = 'node'
+ # Yields its argument and any descendants, depth-first.
+ #
+ def self.descend(element, &block)
+ return to_enum(__method__, element) unless block
+
+ yield element
+
+ if element.is_a?(::RuboCop::AST::Node)
+ element.children.each do |child|
+ descend(child, &block)
+ end
+ end
+
+ nil
+ end
+
attr_reader :pattern, :ast, :match_code
def_delegators :@compiler, :captures, :named_parameters,
:positional_parameters
@@ -100,22 +116,6 @@
initialize(coder['pattern'])
end
- # Yields its argument and any descendants, depth-first.
- #
- def self.descend(element, &block)
- return to_enum(__method__, element) unless block
-
- yield element
-
- if element.is_a?(::RuboCop::AST::Node)
- element.children.each do |child|
- descend(child, &block)
- end
- end
-
- nil
- end
-
def freeze
@match_code.freeze
@compiler.freeze
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 2022-11-30 19:45:02.000000000
+0100
+++ new/lib/rubocop/ast/processed_source.rb 2023-06-01 14:34:56.000000000
+0200
@@ -12,6 +12,9 @@
# @api private
STRING_SOURCE_NAME = '(string)'
+ INVALID_LEVELS = %i[error fatal].freeze
+ private_constant :INVALID_LEVELS
+
attr_reader :path, :buffer, :ast, :comments, :tokens, :diagnostics,
:parser_error, :raw_source, :ruby_version
@@ -20,14 +23,11 @@
new(file, ruby_version, path)
end
- INVALID_LEVELS = %i[error fatal].freeze
- private_constant :INVALID_LEVELS
-
def initialize(source, ruby_version, path = nil)
# Defaults source encoding to UTF-8, regardless of the encoding it has
# been read with, which could be non-utf8 depending on the default
# external encoding.
- source.force_encoding(Encoding::UTF_8) unless source.encoding ==
Encoding::UTF_8
+ (+source).force_encoding(Encoding::UTF_8) unless source.encoding ==
Encoding::UTF_8
@raw_source = source
@path = path
@@ -265,6 +265,9 @@
when 3.2
require 'parser/ruby32'
Parser::Ruby32
+ when 3.3
+ require 'parser/ruby33'
+ Parser::Ruby33
else
raise ArgumentError,
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/sexp.rb new/lib/rubocop/ast/sexp.rb
--- old/lib/rubocop/ast/sexp.rb 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/sexp.rb 2023-06-01 14:34:56.000000000 +0200
@@ -9,7 +9,8 @@
module Sexp
# Creates a {Node} with type `type` and children `children`.
def s(type, *children)
- Node.new(type, children)
+ klass = Builder::NODE_MAP[type] || Node
+ klass.new(type, children)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/ast/token.rb new/lib/rubocop/ast/token.rb
--- old/lib/rubocop/ast/token.rb 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/token.rb 2023-06-01 14:34:56.000000000 +0200
@@ -4,6 +4,8 @@
module AST
# A basic wrapper around Parser's tokens.
class Token
+ LEFT_PAREN_TYPES = %i[tLPAREN tLPAREN2].freeze
+
attr_reader :pos, :type, :text
def self.from_parser_token(parser_token)
@@ -89,7 +91,7 @@
end
def left_parens?
- %i[tLPAREN tLPAREN2].include?(type)
+ LEFT_PAREN_TYPES.include?(type)
end
def right_parens?
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 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast/version.rb 2023-06-01 14:34:56.000000000 +0200
@@ -3,7 +3,7 @@
module RuboCop
module AST
module Version
- STRING = '1.24.0'
+ STRING = '1.29.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 2022-11-30 19:45:02.000000000 +0100
+++ new/lib/rubocop/ast.rb 2023-06-01 14:34:56.000000000 +0200
@@ -76,6 +76,7 @@
require_relative 'ast/node/return_node'
require_relative 'ast/node/self_class_node'
require_relative 'ast/node/send_node'
+require_relative 'ast/node/csend_node'
require_relative 'ast/node/str_node'
require_relative 'ast/node/dstr_node'
require_relative 'ast/node/super_node'
@@ -91,5 +92,5 @@
require_relative 'ast/traversal'
require_relative 'ast/version'
-::RuboCop::AST::NodePattern::Parser.autoload :WithMeta,
"#{__dir__}/ast/node_pattern/with_meta"
-::RuboCop::AST::NodePattern::Compiler.autoload :Debug,
"#{__dir__}/ast/node_pattern/compiler/debug"
+RuboCop::AST::NodePattern::Parser.autoload :WithMeta,
"#{__dir__}/ast/node_pattern/with_meta"
+RuboCop::AST::NodePattern::Compiler.autoload :Debug,
"#{__dir__}/ast/node_pattern/compiler/debug"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2022-11-30 19:45:02.000000000 +0100
+++ new/metadata 2023-06-01 14:34:56.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: rubocop-ast
version: !ruby/object:Gem::Version
- version: 1.24.0
+ version: 1.29.0
platform: ruby
authors:
- Bozhidar Batsov
@@ -10,7 +10,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2022-11-30 00:00:00.000000000 Z
+date: 2023-06-01 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: parser
@@ -18,34 +18,14 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 3.1.1.0
+ version: 3.2.1.0
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 3.1.1.0
-- !ruby/object:Gem::Dependency
- name: bundler
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.15.0
- - - "<"
- - !ruby/object:Gem::Version
- version: '3.0'
- type: :development
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.15.0
- - - "<"
- - !ruby/object:Gem::Version
- version: '3.0'
+ version: 3.2.1.0
description: " RuboCop's Node and NodePattern classes.\n"
email: [email protected]
executables: []
@@ -76,6 +56,7 @@
- lib/rubocop/ast/node/casgn_node.rb
- lib/rubocop/ast/node/class_node.rb
- lib/rubocop/ast/node/const_node.rb
+- lib/rubocop/ast/node/csend_node.rb
- lib/rubocop/ast/node/def_node.rb
- lib/rubocop/ast/node/defined_node.rb
- lib/rubocop/ast/node/dstr_node.rb
@@ -175,7 +156,7 @@
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.3.3
+rubygems_version: 3.4.1
signing_key:
specification_version: 4
summary: RuboCop tools to deal with Ruby code AST.