rubocop-ast 1.13.0 → 1.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/ast/node/class_node.rb +2 -2
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +1 -1
- data/lib/rubocop/ast/node/module_node.rb +2 -2
- data/lib/rubocop/ast/node/pair_node.rb +7 -0
- data/lib/rubocop/ast/node/self_class_node.rb +2 -2
- data/lib/rubocop/ast/node.rb +1 -1
- data/lib/rubocop/ast/node_pattern/lexer.rex +1 -1
- 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 +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac49ca3995eb3db7cbaf7983c8ebc40c0e7782147d3c0c0f501bff87fe78738
|
4
|
+
data.tar.gz: 57372bcc10931495c9001ce0b7521cac1034cca0fc56fda28b4480ee7cb8ab5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 378c302ab6c0d052d28610174d04fe61ad8e8f35a5d4792c90696e4367c8a52e5bf7b969694e592b0c5dfbbedd54139ab94d2c99c9965607df686275adee7eda
|
7
|
+
data.tar.gz: 2f4bc4fd4c1ea1f7d1829d6ad4b448f9a00b40a7b641d30e87ab1784de5f654afbf6ecdff9a98f12cd4c91b273448cf5668de198aebd903205ae460599956e1f
|
@@ -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
|
@@ -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
|
@@ -62,6 +62,13 @@ module RuboCop
|
|
62
62
|
def value_on_new_line?
|
63
63
|
key.loc.line != value.loc.line
|
64
64
|
end
|
65
|
+
|
66
|
+
# Checks whether the `pair` uses hash value omission.
|
67
|
+
#
|
68
|
+
# @return [Boolean] whether this `pair` uses hash value omission
|
69
|
+
def value_omission?
|
70
|
+
source.end_with?(':')
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
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
@@ -274,7 +274,7 @@ module RuboCop
|
|
274
274
|
|
275
275
|
# @!method receiver(node = self)
|
276
276
|
def_node_matcher :receiver, <<~PATTERN
|
277
|
-
{(send $_ ...) ({block numblock} (
|
277
|
+
{(send $_ ...) ({block numblock} (call $_ ...) ...)}
|
278
278
|
PATTERN
|
279
279
|
|
280
280
|
# @!method str_content(node = self)
|
@@ -12,7 +12,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
12
12
|
|
13
13
|
macros
|
14
14
|
CONST_NAME /[A-Z:][a-zA-Z_:]+/
|
15
|
-
SYMBOL_NAME /[\w
|
15
|
+
SYMBOL_NAME /[\w+@*\/?!<>=~|%^&-]+|\[\]=?/
|
16
16
|
IDENTIFIER /[a-z][a-zA-Z0-9_]*/
|
17
17
|
NODE_TYPE /[a-z][a-zA-Z0-9_-]*/ # Same as identifier but allows '-'
|
18
18
|
CALL /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
@@ -25,7 +25,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
25
25
|
|
26
26
|
# :stopdoc:
|
27
27
|
CONST_NAME = /[A-Z:][a-zA-Z_:]+/
|
28
|
-
SYMBOL_NAME = /[\w
|
28
|
+
SYMBOL_NAME = /[\w+@*\/?!<>=~|%^&-]+|\[\]=?/
|
29
29
|
IDENTIFIER = /[a-z][a-zA-Z0-9_]*/
|
30
30
|
NODE_TYPE = /[a-z][a-zA-Z0-9_-]*/
|
31
31
|
CALL = /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
@@ -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.15.2
|
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:
|
13
|
+
date: 2022-02-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -159,6 +159,7 @@ metadata:
|
|
159
159
|
source_code_uri: https://github.com/rubocop/rubocop-ast/
|
160
160
|
documentation_uri: https://docs.rubocop.org/rubocop-ast/
|
161
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:
|
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
175
|
- !ruby/object:Gem::Version
|
175
176
|
version: '0'
|
176
177
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.3.3
|
178
179
|
signing_key:
|
179
180
|
specification_version: 4
|
180
181
|
summary: RuboCop tools to deal with Ruby code AST.
|