rubocop-ast 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubocop/ast/builder.rb +1 -0
- data/lib/rubocop/ast/node/complex_node.rb +13 -0
- data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +1 -1
- data/lib/rubocop/ast/node/mixin/numeric_node.rb +2 -2
- data/lib/rubocop/ast/node.rb +1 -1
- data/lib/rubocop/ast/node_pattern/compiler/debug.rb +2 -0
- data/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb +1 -1
- data/lib/rubocop/ast/node_pattern/node.rb +1 -1
- data/lib/rubocop/ast/processed_source.rb +1 -1
- data/lib/rubocop/ast/version.rb +1 -1
- data/lib/rubocop/ast.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b94b9545a7aceaf8b52e8e6b8713df63fe1113c4040fd5f92563438c0307d21
|
4
|
+
data.tar.gz: 6db23c373003f60f0faf0f48ff1a4cb7d086f36820e7f5e732a147eea0d22f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a0fb03bcb60b82177efefcf2146d1512c50f9791f094769d64ae7c87899e9984ce41eebdb1fc8f6d8c40b287e42621f6d4bd9fdde23fe9884ebc0dd2202b5ae
|
7
|
+
data.tar.gz: 8fd5e39ac28109336a207edfedf5fc6b782ede8da4594cfdd1faf41e8e9df4d59a17716e1ea55121c575514d17fce9e0b3071ab98ecc54b007f66af8f002f560
|
data/lib/rubocop/ast/builder.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
# A node extension for `complex` nodes. This will be used in place of a plain
|
6
|
+
# node when the builder constructs the AST, making its methods available to
|
7
|
+
# all `complex` nodes within RuboCop.
|
8
|
+
class ComplexNode < Node
|
9
|
+
include BasicLiteralNode
|
10
|
+
include NumericNode
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module AST
|
5
|
-
# Common functionality for primitive numeric nodes: `int`, `float`, `rational`...
|
5
|
+
# Common functionality for primitive numeric nodes: `int`, `float`, `rational`, `complex`...
|
6
6
|
module NumericNode
|
7
7
|
SIGN_REGEX = /\A[+-]/.freeze
|
8
8
|
private_constant :SIGN_REGEX
|
@@ -15,7 +15,7 @@ module RuboCop
|
|
15
15
|
#
|
16
16
|
# @return [Boolean] whether this literal has a sign.
|
17
17
|
def sign?
|
18
|
-
source.match(SIGN_REGEX)
|
18
|
+
source.match?(SIGN_REGEX)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -261,7 +261,7 @@ module RuboCop
|
|
261
261
|
arities = children
|
262
262
|
.reverse
|
263
263
|
.map(&:arity_range)
|
264
|
-
.map { |r| last = last.begin + r.begin..last.max + r.max }
|
264
|
+
.map { |r| last = (last.begin + r.begin)..(last.max + r.max) }
|
265
265
|
.reverse!
|
266
266
|
arities.push last_arity
|
267
267
|
end
|
@@ -179,7 +179,7 @@ module RuboCop
|
|
179
179
|
class AnyOrder < Node
|
180
180
|
include ForbidInSeqHead
|
181
181
|
|
182
|
-
ARITIES = Hash.new { |h, k| h[k] = k - 1..Float::INFINITY }
|
182
|
+
ARITIES = Hash.new { |h, k| h[k] = (k - 1)..Float::INFINITY }
|
183
183
|
private_constant :ARITIES
|
184
184
|
|
185
185
|
def term_nodes
|
@@ -341,7 +341,7 @@ module RuboCop
|
|
341
341
|
|
342
342
|
parser_class = parser_class(ruby_version, parser_engine)
|
343
343
|
|
344
|
-
parser_instance = if prism_result
|
344
|
+
parser_instance = if parser_engine == :parser_prism && prism_result
|
345
345
|
# NOTE: Since it is intended for use with Ruby LSP, it targets only Prism.
|
346
346
|
# If there is no reuse of a pre-parsed result, such as in Ruby LSP,
|
347
347
|
# regular parsing with Prism occurs, and `else` branch will be executed.
|
data/lib/rubocop/ast/version.rb
CHANGED
data/lib/rubocop/ast.rb
CHANGED
@@ -48,6 +48,7 @@ require_relative 'ast/node/case_match_node'
|
|
48
48
|
require_relative 'ast/node/case_node'
|
49
49
|
require_relative 'ast/node/casgn_node'
|
50
50
|
require_relative 'ast/node/class_node'
|
51
|
+
require_relative 'ast/node/complex_node'
|
51
52
|
require_relative 'ast/node/const_node'
|
52
53
|
require_relative 'ast/node/def_node'
|
53
54
|
require_relative 'ast/node/defined_node'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-
|
13
|
+
date: 2025-07-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- lib/rubocop/ast/node/case_node.rb
|
70
70
|
- lib/rubocop/ast/node/casgn_node.rb
|
71
71
|
- lib/rubocop/ast/node/class_node.rb
|
72
|
+
- lib/rubocop/ast/node/complex_node.rb
|
72
73
|
- lib/rubocop/ast/node/const_node.rb
|
73
74
|
- lib/rubocop/ast/node/csend_node.rb
|
74
75
|
- lib/rubocop/ast/node/def_node.rb
|