rubocop-ast 1.10.0 → 1.14.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/README.md +4 -4
- data/lib/rubocop/ast/node/class_node.rb +2 -2
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +4 -4
- data/lib/rubocop/ast/node/module_node.rb +2 -2
- data/lib/rubocop/ast/node/self_class_node.rb +2 -2
- data/lib/rubocop/ast/node.rb +5 -5
- data/lib/rubocop/ast/node_pattern/lexer.rex.rb +1 -1
- data/lib/rubocop/ast/traversal.rb +2 -3
- data/lib/rubocop/ast/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1693e1ea234859e4e84ac9ff85465e2779d1588aa82593e41e2fe1348611a286
|
4
|
+
data.tar.gz: d8fee8a82d5fa065c29f8801979d4a90a45b4fb8ac25ee9b8dc0f3c44da07c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6219c5798d3f7a9f8cf40a3ee1e85754547ae2ded2b037a4847811db03b575d558e183919bab53c11b824cca19d012846aa9b3e6d208fb217729a54c0b0cd4b1
|
7
|
+
data.tar.gz: 1b2db6a28cb91be686411c52de1af8b1dcceb09c1726e173a7d3d91c0c5384cfa6ac165fb12110e01156496b2b64da37998828eb1752423230ff64091a2fadd3
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# RuboCop AST
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/rubocop-ast)
|
4
|
-
[](https://codeclimate.com/github/rubocop
|
6
|
-
[](https://codeclimate.com/github/rubocop
|
4
|
+
[](https://github.com/rubocop/rubocop-ast/actions?query=workflow%3ACI)
|
5
|
+
[](https://codeclimate.com/github/rubocop/rubocop-ast/test_coverage)
|
6
|
+
[](https://codeclimate.com/github/rubocop/rubocop-ast/maintainability)
|
7
7
|
|
8
|
-
Contains the classes needed by [RuboCop](https://github.com/rubocop
|
8
|
+
Contains the classes needed by [RuboCop](https://github.com/rubocop/rubocop) to deal with Ruby's AST, in particular:
|
9
9
|
|
10
10
|
* `RuboCop::AST::Node` ([doc](docs/modules/ROOT/pages/node_types.adoc))
|
11
11
|
* `RuboCop::AST::NodePattern` ([doc](docs/modules/ROOT/pages/node_pattern.adoc))
|
@@ -6,9 +6,9 @@ module RuboCop
|
|
6
6
|
# node when the builder constructs the AST, making its methods available
|
7
7
|
# to all `class` nodes within RuboCop.
|
8
8
|
class ClassNode < Node
|
9
|
-
# The
|
9
|
+
# The identifier for this `class` node.
|
10
10
|
#
|
11
|
-
# @return [Node] the
|
11
|
+
# @return [Node] the identifier of the class
|
12
12
|
def identifier
|
13
13
|
node_parts[0]
|
14
14
|
end
|
@@ -28,9 +28,9 @@ module RuboCop
|
|
28
28
|
node_parts[1]
|
29
29
|
end
|
30
30
|
|
31
|
-
# The `block` node associated with this method dispatch, if any.
|
31
|
+
# The `block` or `numblock` node associated with this method dispatch, if any.
|
32
32
|
#
|
33
|
-
# @return [BlockNode, nil] the `block` node associated with this method
|
33
|
+
# @return [BlockNode, nil] the `block` or `numblock` node associated with this method
|
34
34
|
# call or `nil`
|
35
35
|
def block_node
|
36
36
|
parent if block_literal?
|
@@ -154,7 +154,7 @@ module RuboCop
|
|
154
154
|
#
|
155
155
|
# @return [Boolean] whether the dispatched method has a block
|
156
156
|
def block_literal?
|
157
|
-
parent&.block_type? && eql?(parent.send_node)
|
157
|
+
(parent&.block_type? || parent&.numblock_type?) && eql?(parent.send_node)
|
158
158
|
end
|
159
159
|
|
160
160
|
# Checks whether this node is an arithmetic operation
|
@@ -171,7 +171,7 @@ module RuboCop
|
|
171
171
|
#
|
172
172
|
# private def foo; end
|
173
173
|
#
|
174
|
-
# @return
|
174
|
+
# @return whether the `def|defs` node is a modifier or not.
|
175
175
|
# See also `def_modifier` that returns the node or `nil`
|
176
176
|
def def_modifier?(node = self)
|
177
177
|
!!def_modifier(node)
|
@@ -6,9 +6,9 @@ module RuboCop
|
|
6
6
|
# plain node when the builder constructs the AST, making its methods
|
7
7
|
# available to all `module` nodes within RuboCop.
|
8
8
|
class ModuleNode < Node
|
9
|
-
# The
|
9
|
+
# The identifier for this `module` node.
|
10
10
|
#
|
11
|
-
# @return [Node] the
|
11
|
+
# @return [Node] the identifier of the module
|
12
12
|
def identifier
|
13
13
|
node_parts[0]
|
14
14
|
end
|
@@ -6,9 +6,9 @@ module RuboCop
|
|
6
6
|
# plain node when the builder constructs the AST, making its methods
|
7
7
|
# available to all `sclass` nodes within RuboCop.
|
8
8
|
class SelfClassNode < Node
|
9
|
-
# The
|
9
|
+
# The identifier for this `sclass` node. (Always `self`.)
|
10
10
|
#
|
11
|
-
# @return [Node] the
|
11
|
+
# @return [Node] the identifier of the class
|
12
12
|
def identifier
|
13
13
|
node_parts[0]
|
14
14
|
end
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -425,7 +425,7 @@ module RuboCop
|
|
425
425
|
end
|
426
426
|
|
427
427
|
def keyword?
|
428
|
-
return true if special_keyword? || send_type? && prefix_not?
|
428
|
+
return true if special_keyword? || (send_type? && prefix_not?)
|
429
429
|
return false unless KEYWORDS.include?(type)
|
430
430
|
|
431
431
|
!OPERATOR_KEYWORDS.include?(type) || loc.operator.is?(type.to_s)
|
@@ -464,7 +464,7 @@ module RuboCop
|
|
464
464
|
end
|
465
465
|
|
466
466
|
def numeric_type?
|
467
|
-
int_type? || float_type?
|
467
|
+
int_type? || float_type? || rational_type? || complex_type?
|
468
468
|
end
|
469
469
|
|
470
470
|
def range_type?
|
@@ -507,20 +507,20 @@ module RuboCop
|
|
507
507
|
# @deprecated Use `:class_constructor?`
|
508
508
|
# @!method struct_constructor?(node = self)
|
509
509
|
def_node_matcher :struct_constructor?, <<~PATTERN
|
510
|
-
(block (send #global_const?(:Struct) :new ...) _ $_)
|
510
|
+
({block numblock} (send #global_const?(:Struct) :new ...) _ $_)
|
511
511
|
PATTERN
|
512
512
|
|
513
513
|
# @!method class_definition?(node = self)
|
514
514
|
def_node_matcher :class_definition?, <<~PATTERN
|
515
515
|
{(class _ _ $_)
|
516
516
|
(sclass _ $_)
|
517
|
-
(block (send #global_const?({:Struct :Class}) :new ...) _ $_)}
|
517
|
+
({block numblock} (send #global_const?({:Struct :Class}) :new ...) _ $_)}
|
518
518
|
PATTERN
|
519
519
|
|
520
520
|
# @!method module_definition?(node = self)
|
521
521
|
def_node_matcher :module_definition?, <<~PATTERN
|
522
522
|
{(module _ $_)
|
523
|
-
(block (send #global_const?(:Module) :new ...) _ $_)}
|
523
|
+
({block numblock} (send #global_const?(:Module) :new ...) _ $_)}
|
524
524
|
PATTERN
|
525
525
|
|
526
526
|
# Some expressions are evaluated for their value, some for their side
|
@@ -91,11 +91,10 @@ module RuboCop
|
|
91
91
|
|
92
92
|
many_symbol_children = %i[regopt]
|
93
93
|
|
94
|
-
node_child = %i[
|
95
|
-
match_current_line defined?
|
94
|
+
node_child = %i[not match_current_line defined?
|
96
95
|
arg_expr pin if_guard unless_guard
|
97
96
|
match_with_trailing_comma]
|
98
|
-
node_or_nil_child = %i[preexe postexe]
|
97
|
+
node_or_nil_child = %i[block_pass preexe postexe]
|
99
98
|
|
100
99
|
NO_CHILD_NODES = (no_children + opt_symbol_child + literal_child).to_set.freeze
|
101
100
|
private_constant :NO_CHILD_NODES # Used by Commissioner
|
data/lib/rubocop/ast/version.rb
CHANGED
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.14.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: 2021-
|
13
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -150,15 +150,16 @@ files:
|
|
150
150
|
- lib/rubocop/ast/token.rb
|
151
151
|
- lib/rubocop/ast/traversal.rb
|
152
152
|
- lib/rubocop/ast/version.rb
|
153
|
-
homepage: https://github.com/rubocop
|
153
|
+
homepage: https://github.com/rubocop/rubocop-ast
|
154
154
|
licenses:
|
155
155
|
- MIT
|
156
156
|
metadata:
|
157
157
|
homepage_uri: https://www.rubocop.org/
|
158
|
-
changelog_uri: https://github.com/rubocop
|
159
|
-
source_code_uri: https://github.com/rubocop
|
158
|
+
changelog_uri: https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md
|
159
|
+
source_code_uri: https://github.com/rubocop/rubocop-ast/
|
160
160
|
documentation_uri: https://docs.rubocop.org/rubocop-ast/
|
161
|
-
bug_tracker_uri: https://github.com/rubocop
|
161
|
+
bug_tracker_uri: https://github.com/rubocop/rubocop-ast/issues
|
162
|
+
rubygems_mfa_required: 'true'
|
162
163
|
post_install_message:
|
163
164
|
rdoc_options: []
|
164
165
|
require_paths:
|