rubocop-ast 1.1.1 → 1.4.2
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 +3 -1
- data/lib/rubocop/ast.rb +4 -1
- data/lib/rubocop/ast/builder.rb +14 -2
- data/lib/rubocop/ast/ext/range_min_max.rb +18 -0
- data/lib/rubocop/ast/node.rb +21 -5
- data/lib/rubocop/ast/node/arg_node.rb +34 -0
- data/lib/rubocop/ast/node/args_node.rb +10 -0
- data/lib/rubocop/ast/node/array_node.rb +1 -1
- data/lib/rubocop/ast/node/block_node.rb +27 -0
- data/lib/rubocop/ast/node/case_match_node.rb +1 -1
- data/lib/rubocop/ast/node/case_node.rb +1 -1
- data/lib/rubocop/ast/node/const_node.rb +1 -1
- data/lib/rubocop/ast/node/dstr_node.rb +16 -0
- data/lib/rubocop/ast/node/hash_node.rb +2 -2
- data/lib/rubocop/ast/node/if_node.rb +1 -1
- data/lib/rubocop/ast/node/mixin/descendence.rb +4 -8
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +4 -0
- data/lib/rubocop/ast/node/procarg0_node.rb +17 -0
- data/lib/rubocop/ast/node/regexp_node.rb +1 -1
- data/lib/rubocop/ast/node/send_node.rb +1 -0
- data/lib/rubocop/ast/node/when_node.rb +1 -1
- data/lib/rubocop/ast/node_pattern.rb +2 -2
- data/lib/rubocop/ast/node_pattern/compiler.rb +1 -1
- data/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb +2 -2
- data/lib/rubocop/ast/node_pattern/lexer.rb +1 -1
- data/lib/rubocop/ast/node_pattern/lexer.rex +4 -3
- data/lib/rubocop/ast/node_pattern/lexer.rex.rb +4 -3
- data/lib/rubocop/ast/node_pattern/method_definer.rb +2 -0
- data/lib/rubocop/ast/node_pattern/node.rb +6 -21
- data/lib/rubocop/ast/node_pattern/parser.racc.rb +39 -39
- data/lib/rubocop/ast/processed_source.rb +1 -1
- data/lib/rubocop/ast/traversal.rb +3 -2
- data/lib/rubocop/ast/version.rb +1 -1
- metadata +10 -7
- data/lib/rubocop/ast/ext/set.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fc7baac2fa613e95c79a9de02f42586585a1aaf0821a77f25ada657e653448
|
4
|
+
data.tar.gz: d16431779a8cc2f5b795fe112de79a6e3628103b3e79fbea7213a8f9fa8da35e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d3cb6e72ed495bae000b28312de6955cfce4eb0aa2a77af7fcb352bc9ea7b2fdb60e74a1b7e1f0ef70169dc6863e1536421606db3b0f197055263b4c3458158
|
7
|
+
data.tar.gz: e9a57e796da77a05151a8c14974aba9737f409761ba48562bd848ad26c1a1c30ae0016ed821e1630d85757583e8e17ffccaa820f9e3f06b9fafa62f939ec9c6c
|
data/README.md
CHANGED
@@ -35,7 +35,9 @@ See the [docs site](https://docs.rubocop.org/rubocop-ast) for more details.
|
|
35
35
|
|
36
36
|
### Parser compatibility switches
|
37
37
|
|
38
|
-
This gem, by default, uses most [legacy AST output from parser](https://github.com/whitequark/parser/#usage), except for
|
38
|
+
This gem, by default, uses most [legacy AST output from parser](https://github.com/whitequark/parser/#usage), except for the following which are set to `true`:
|
39
|
+
* `emit_forward_arg`
|
40
|
+
* `emit_match_pattern`
|
39
41
|
|
40
42
|
The main `RuboCop` gem uses these defaults (and is currently only compatible with these), but this gem can be used separately from `RuboCop` and is meant to be compatible with all settings. For example, to have `-> { ... }` emitted
|
41
43
|
as `LambdaNode` instead of `SendNode`:
|
data/lib/rubocop/ast.rb
CHANGED
@@ -5,7 +5,7 @@ require 'forwardable'
|
|
5
5
|
require 'set'
|
6
6
|
|
7
7
|
require_relative 'ast/ext/range'
|
8
|
-
require_relative 'ast/ext/
|
8
|
+
require_relative 'ast/ext/range_min_max'
|
9
9
|
require_relative 'ast/node_pattern/method_definer'
|
10
10
|
require_relative 'ast/node_pattern'
|
11
11
|
require_relative 'ast/node/mixin/descendence'
|
@@ -36,6 +36,7 @@ require_relative 'ast/node/mixin/predicate_operator_node'
|
|
36
36
|
require_relative 'ast/node/mixin/basic_literal_node'
|
37
37
|
require_relative 'ast/node/alias_node'
|
38
38
|
require_relative 'ast/node/and_node'
|
39
|
+
require_relative 'ast/node/arg_node'
|
39
40
|
require_relative 'ast/node/args_node'
|
40
41
|
require_relative 'ast/node/array_node'
|
41
42
|
require_relative 'ast/node/block_node'
|
@@ -61,6 +62,7 @@ require_relative 'ast/node/module_node'
|
|
61
62
|
require_relative 'ast/node/next_node'
|
62
63
|
require_relative 'ast/node/or_node'
|
63
64
|
require_relative 'ast/node/pair_node'
|
65
|
+
require_relative 'ast/node/procarg0_node'
|
64
66
|
require_relative 'ast/node/range_node'
|
65
67
|
require_relative 'ast/node/regexp_node'
|
66
68
|
require_relative 'ast/node/rescue_node'
|
@@ -69,6 +71,7 @@ require_relative 'ast/node/return_node'
|
|
69
71
|
require_relative 'ast/node/self_class_node'
|
70
72
|
require_relative 'ast/node/send_node'
|
71
73
|
require_relative 'ast/node/str_node'
|
74
|
+
require_relative 'ast/node/dstr_node'
|
72
75
|
require_relative 'ast/node/super_node'
|
73
76
|
require_relative 'ast/node/symbol_node'
|
74
77
|
require_relative 'ast/node/until_node'
|
data/lib/rubocop/ast/builder.rb
CHANGED
@@ -14,12 +14,22 @@ module RuboCop
|
|
14
14
|
# parser = Parser::Ruby25.new(builder)
|
15
15
|
# root_node = parser.parse(buffer)
|
16
16
|
class Builder < Parser::Builders::Default
|
17
|
-
self.emit_forward_arg = true
|
17
|
+
self.emit_forward_arg = true if respond_to?(:emit_forward_arg=)
|
18
|
+
self.emit_match_pattern = true if respond_to?(:emit_match_pattern=)
|
18
19
|
|
19
20
|
# @api private
|
20
21
|
NODE_MAP = {
|
21
22
|
and: AndNode,
|
22
23
|
alias: AliasNode,
|
24
|
+
arg: ArgNode,
|
25
|
+
blockarg: ArgNode,
|
26
|
+
forward_arg: ArgNode,
|
27
|
+
kwarg: ArgNode,
|
28
|
+
kwoptarg: ArgNode,
|
29
|
+
kwrestarg: ArgNode,
|
30
|
+
optarg: ArgNode,
|
31
|
+
restarg: ArgNode,
|
32
|
+
shadowarg: ArgNode,
|
23
33
|
args: ArgsNode,
|
24
34
|
array: ArrayNode,
|
25
35
|
block: BlockNode,
|
@@ -32,6 +42,7 @@ module RuboCop
|
|
32
42
|
def: DefNode,
|
33
43
|
defined?: DefinedNode,
|
34
44
|
defs: DefNode,
|
45
|
+
dstr: DstrNode,
|
35
46
|
ensure: EnsureNode,
|
36
47
|
for: ForNode,
|
37
48
|
forward_args: ForwardArgsNode,
|
@@ -43,12 +54,14 @@ module RuboCop
|
|
43
54
|
indexasgn: IndexasgnNode,
|
44
55
|
irange: RangeNode,
|
45
56
|
erange: RangeNode,
|
57
|
+
kwargs: HashNode,
|
46
58
|
kwsplat: KeywordSplatNode,
|
47
59
|
lambda: LambdaNode,
|
48
60
|
module: ModuleNode,
|
49
61
|
next: NextNode,
|
50
62
|
or: OrNode,
|
51
63
|
pair: PairNode,
|
64
|
+
procarg0: Procarg0Node,
|
52
65
|
regexp: RegexpNode,
|
53
66
|
rescue: RescueNode,
|
54
67
|
resbody: ResbodyNode,
|
@@ -56,7 +69,6 @@ module RuboCop
|
|
56
69
|
csend: SendNode,
|
57
70
|
send: SendNode,
|
58
71
|
str: StrNode,
|
59
|
-
dstr: StrNode,
|
60
72
|
xstr: StrNode,
|
61
73
|
sclass: SelfClassNode,
|
62
74
|
super: SuperNode,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
module Ext
|
6
|
+
# Refinement to circumvent broken `Range#minmax` for infinity ranges in 2.6-
|
7
|
+
module RangeMinMax
|
8
|
+
if ::Range.instance_method(:minmax).owner != ::Range
|
9
|
+
refine ::Range do
|
10
|
+
def minmax
|
11
|
+
[min, max]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -48,7 +48,7 @@ module RuboCop
|
|
48
48
|
|
49
49
|
# @api private
|
50
50
|
EQUALS_ASSIGNMENTS = %i[lvasgn ivasgn cvasgn gvasgn
|
51
|
-
casgn masgn
|
51
|
+
casgn masgn].to_set.freeze
|
52
52
|
# @api private
|
53
53
|
SHORTHAND_ASSIGNMENTS = %i[op_asgn or_asgn and_asgn].to_set.freeze
|
54
54
|
# @api private
|
@@ -77,7 +77,8 @@ module RuboCop
|
|
77
77
|
# @api private
|
78
78
|
SPECIAL_KEYWORDS = %w[__FILE__ __LINE__ __ENCODING__].to_set.freeze
|
79
79
|
# @api private
|
80
|
-
ARGUMENT_TYPES = %i[arg optarg restarg kwarg kwoptarg kwrestarg
|
80
|
+
ARGUMENT_TYPES = %i[arg optarg restarg kwarg kwoptarg kwrestarg
|
81
|
+
blockarg forward_arg shadowarg].to_set.freeze
|
81
82
|
|
82
83
|
LITERAL_RECURSIVE_METHODS = (COMPARISON_OPERATORS + %i[* ! <=>]).freeze
|
83
84
|
LITERAL_RECURSIVE_TYPES = (OPERATOR_KEYWORDS + COMPOSITE_LITERALS + %i[begin pair]).freeze
|
@@ -222,7 +223,7 @@ module RuboCop
|
|
222
223
|
# @return [self] if a block is given
|
223
224
|
# @return [Enumerator] if no block is given
|
224
225
|
def each_ancestor(*types, &block)
|
225
|
-
return to_enum(__method__, *types) unless
|
226
|
+
return to_enum(__method__, *types) unless block
|
226
227
|
|
227
228
|
visit_ancestors(types, &block)
|
228
229
|
|
@@ -237,7 +238,7 @@ module RuboCop
|
|
237
238
|
each_ancestor.to_a
|
238
239
|
end
|
239
240
|
|
240
|
-
#
|
241
|
+
# NOTE: Some rare nodes may have no source, like `s(:args)` in `foo {}`
|
241
242
|
# @return [String, nil]
|
242
243
|
def source
|
243
244
|
loc.expression&.source
|
@@ -271,10 +272,12 @@ module RuboCop
|
|
271
272
|
|
272
273
|
## Destructuring
|
273
274
|
|
275
|
+
# @!method receiver(node = self)
|
274
276
|
def_node_matcher :receiver, <<~PATTERN
|
275
277
|
{(send $_ ...) ({block numblock} (send $_ ...) ...)}
|
276
278
|
PATTERN
|
277
279
|
|
280
|
+
# @!method str_content(node = self)
|
278
281
|
def_node_matcher :str_content, '(str $_)'
|
279
282
|
|
280
283
|
def const_name
|
@@ -288,6 +291,7 @@ module RuboCop
|
|
288
291
|
end
|
289
292
|
end
|
290
293
|
|
294
|
+
# @!method defined_module0(node = self)
|
291
295
|
def_node_matcher :defined_module0, <<~PATTERN
|
292
296
|
{(class (const $_ $_) ...)
|
293
297
|
(module (const $_ $_) ...)
|
@@ -333,6 +337,7 @@ module RuboCop
|
|
333
337
|
end
|
334
338
|
|
335
339
|
# Some cops treat the shovel operator as a kind of assignment.
|
340
|
+
# @!method assignment_or_similar?(node = self)
|
336
341
|
def_node_matcher :assignment_or_similar?, <<~PATTERN
|
337
342
|
{assignment? (send _recv :<< ...)}
|
338
343
|
PATTERN
|
@@ -410,7 +415,7 @@ module RuboCop
|
|
410
415
|
POST_CONDITION_LOOP_TYPES.include?(type)
|
411
416
|
end
|
412
417
|
|
413
|
-
#
|
418
|
+
# NOTE: `loop { }` is a normal method call and thus not a loop keyword.
|
414
419
|
def loop_keyword?
|
415
420
|
LOOP_TYPES.include?(type)
|
416
421
|
end
|
@@ -468,37 +473,47 @@ module RuboCop
|
|
468
473
|
node.match_guard_clause?
|
469
474
|
end
|
470
475
|
|
476
|
+
# @!method match_guard_clause?(node = self)
|
471
477
|
def_node_matcher :match_guard_clause?, <<~PATTERN
|
472
478
|
[${(send nil? {:raise :fail} ...) return break next} single_line?]
|
473
479
|
PATTERN
|
474
480
|
|
481
|
+
# @!method proc?(node = self)
|
475
482
|
def_node_matcher :proc?, <<~PATTERN
|
476
483
|
{(block (send nil? :proc) ...)
|
477
484
|
(block (send #global_const?(:Proc) :new) ...)
|
478
485
|
(send #global_const?(:Proc) :new)}
|
479
486
|
PATTERN
|
480
487
|
|
488
|
+
# @!method lambda?(node = self)
|
481
489
|
def_node_matcher :lambda?, '({block numblock} (send nil? :lambda) ...)'
|
490
|
+
|
491
|
+
# @!method lambda_or_proc?(node = self)
|
482
492
|
def_node_matcher :lambda_or_proc?, '{lambda? proc?}'
|
483
493
|
|
494
|
+
# @!method global_const?(node = self, name)
|
484
495
|
def_node_matcher :global_const?, '(const {nil? cbase} %1)'
|
485
496
|
|
497
|
+
# @!method class_constructor?(node = self)
|
486
498
|
def_node_matcher :class_constructor?, <<~PATTERN
|
487
499
|
{ (send #global_const?({:Class :Module :Struct}) :new ...)
|
488
500
|
(block (send #global_const?({:Class :Module :Struct}) :new ...) ...)}
|
489
501
|
PATTERN
|
490
502
|
|
491
503
|
# @deprecated Use `:class_constructor?`
|
504
|
+
# @!method struct_constructor?(node = self)
|
492
505
|
def_node_matcher :struct_constructor?, <<~PATTERN
|
493
506
|
(block (send #global_const?(:Struct) :new ...) _ $_)
|
494
507
|
PATTERN
|
495
508
|
|
509
|
+
# @!method class_definition?(node = self)
|
496
510
|
def_node_matcher :class_definition?, <<~PATTERN
|
497
511
|
{(class _ _ $_)
|
498
512
|
(sclass _ $_)
|
499
513
|
(block (send #global_const?({:Struct :Class}) :new ...) _ $_)}
|
500
514
|
PATTERN
|
501
515
|
|
516
|
+
# @!method module_definition?(node = self)
|
502
517
|
def_node_matcher :module_definition?, <<~PATTERN
|
503
518
|
{(module _ $_)
|
504
519
|
(block (send #global_const?(:Module) :new ...) _ $_)}
|
@@ -632,6 +647,7 @@ module RuboCop
|
|
632
647
|
end
|
633
648
|
end
|
634
649
|
|
650
|
+
# @!method new_class_or_module_block?(node = self)
|
635
651
|
def_node_matcher :new_class_or_module_block?, <<~PATTERN
|
636
652
|
^(casgn _ _ (block (send (const _ {:Class :Module}) :new) ...))
|
637
653
|
PATTERN
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
# A node extension for `arg`, `optarg`, `restarg`, `kwarg`, `kwoptarg`,
|
6
|
+
# `kwrestarg`, `blockarg`, `shadowarg` and `forward_arg` nodes.
|
7
|
+
# This will be used in place of a plain node when the builder constructs
|
8
|
+
# the AST, making its methods available to all `arg` nodes within RuboCop.
|
9
|
+
class ArgNode < Node
|
10
|
+
# Returns the name of an argument.
|
11
|
+
#
|
12
|
+
# @return [Symbol, nil] the name of the argument
|
13
|
+
def name
|
14
|
+
node_parts[0]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns the default value of the argument, if any.
|
18
|
+
#
|
19
|
+
# @return [Node, nil] the default value of the argument
|
20
|
+
def default_value
|
21
|
+
return unless default?
|
22
|
+
|
23
|
+
node_parts[1]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Checks whether the argument has a default value
|
27
|
+
#
|
28
|
+
# @return [Boolean] whether the argument has a default value
|
29
|
+
def default?
|
30
|
+
optarg_type? || kwoptarg_type?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -24,6 +24,16 @@ module RuboCop
|
|
24
24
|
def empty_and_without_delimiters?
|
25
25
|
loc.expression.nil?
|
26
26
|
end
|
27
|
+
|
28
|
+
# Yield each argument from the collection.
|
29
|
+
# Arguments can be inside `mlhs` nodes in the case of destructuring, so this
|
30
|
+
# flattens the collection to just `arg`, `optarg`, `restarg`, `kwarg`,
|
31
|
+
# `kwoptarg`, `kwrestarg`, `blockarg`, `forward_arg` and `shadowarg`.
|
32
|
+
#
|
33
|
+
# @return [Array<Node>] array of argument nodes.
|
34
|
+
def argument_list
|
35
|
+
each_descendant(*ARGUMENT_TYPES).to_a.freeze
|
36
|
+
end
|
27
37
|
end
|
28
38
|
end
|
29
39
|
end
|
@@ -22,6 +22,9 @@ module RuboCop
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# The arguments of this block.
|
25
|
+
# Note that if the block has destructured arguments, `arguments` will
|
26
|
+
# return a `mlhs` node, whereas `argument_list` will return only
|
27
|
+
# actual argument nodes.
|
25
28
|
#
|
26
29
|
# @return [Array<Node>]
|
27
30
|
def arguments
|
@@ -32,6 +35,18 @@ module RuboCop
|
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
38
|
+
# Returns a collection of all descendants of this node that are
|
39
|
+
# argument type nodes. See `ArgsNode#argument_list` for details.
|
40
|
+
#
|
41
|
+
# @return [Array<Node>]
|
42
|
+
def argument_list
|
43
|
+
if numblock_type?
|
44
|
+
numbered_arguments
|
45
|
+
else
|
46
|
+
arguments.argument_list
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
35
50
|
# The body of this block.
|
36
51
|
#
|
37
52
|
# @return [Node, nil] the body of the `block` node or `nil`
|
@@ -117,6 +132,18 @@ module RuboCop
|
|
117
132
|
def void_context?
|
118
133
|
VOID_CONTEXT_METHODS.include?(method_name)
|
119
134
|
end
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
# Numbered arguments of this `numblock`.
|
139
|
+
def numbered_arguments
|
140
|
+
return [].freeze unless numblock_type?
|
141
|
+
|
142
|
+
max_param = children[1]
|
143
|
+
1.upto(max_param).map do |i|
|
144
|
+
ArgNode.new(:arg, [:"_#{i}"])
|
145
|
+
end.freeze
|
146
|
+
end
|
120
147
|
end
|
121
148
|
end
|
122
149
|
end
|
@@ -17,7 +17,7 @@ module RuboCop
|
|
17
17
|
|
18
18
|
# @deprecated Use `in_pattern_branches.each`
|
19
19
|
def each_in_pattern(&block)
|
20
|
-
return in_pattern_branches.to_enum(__method__) unless
|
20
|
+
return in_pattern_branches.to_enum(__method__) unless block
|
21
21
|
|
22
22
|
in_pattern_branches.each(&block)
|
23
23
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
# A node extension for `dstr` nodes. This will be used
|
6
|
+
# in place of a plain node when the builder constructs the AST, making
|
7
|
+
# its methods available to all `dstr` nodes within RuboCop.
|
8
|
+
class DstrNode < StrNode
|
9
|
+
def value
|
10
|
+
child_nodes.map do |child|
|
11
|
+
child.respond_to?(:value) ? child.value : child.source
|
12
|
+
end.join
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -57,7 +57,7 @@ module RuboCop
|
|
57
57
|
# @return [self] if a block is given
|
58
58
|
# @return [Enumerator] if no block is given
|
59
59
|
def each_key(&block)
|
60
|
-
return pairs.map(&:key).to_enum unless
|
60
|
+
return pairs.map(&:key).to_enum unless block
|
61
61
|
|
62
62
|
pairs.map(&:key).each(&block)
|
63
63
|
|
@@ -81,7 +81,7 @@ module RuboCop
|
|
81
81
|
# @return [self] if a block is given
|
82
82
|
# @return [Enumerator] if no block is given
|
83
83
|
def each_value(&block)
|
84
|
-
return pairs.map(&:value).to_enum unless
|
84
|
+
return pairs.map(&:value).to_enum unless block
|
85
85
|
|
86
86
|
pairs.map(&:value).each(&block)
|
87
87
|
|
@@ -13,13 +13,9 @@ module RuboCop
|
|
13
13
|
#
|
14
14
|
# @overload each_child_node
|
15
15
|
# Yield all nodes.
|
16
|
-
# @overload each_child_node(type)
|
17
|
-
# Yield only nodes matching the type.
|
18
|
-
# @param [Symbol] type a node type
|
19
|
-
# @overload each_child_node(type_a, type_b, ...)
|
16
|
+
# @overload each_child_node(type, ...)
|
20
17
|
# Yield only nodes matching any of the types.
|
21
|
-
# @param [Symbol]
|
22
|
-
# @param [Symbol] type_b a node type
|
18
|
+
# @param [Symbol] type a node type
|
23
19
|
# @yieldparam [Node] node each child node
|
24
20
|
# @return [self] if a block is given
|
25
21
|
# @return [Enumerator] if no block is given
|
@@ -59,7 +55,7 @@ module RuboCop
|
|
59
55
|
# @return [self] if a block is given
|
60
56
|
# @return [Enumerator] if no block is given
|
61
57
|
def each_descendant(*types, &block)
|
62
|
-
return to_enum(__method__, *types) unless
|
58
|
+
return to_enum(__method__, *types) unless block
|
63
59
|
|
64
60
|
visit_descendants(types, &block)
|
65
61
|
|
@@ -94,7 +90,7 @@ module RuboCop
|
|
94
90
|
# @return [self] if a block is given
|
95
91
|
# @return [Enumerator] if no block is given
|
96
92
|
def each_node(*types, &block)
|
97
|
-
return to_enum(__method__, *types) unless
|
93
|
+
return to_enum(__method__, *types) unless block
|
98
94
|
|
99
95
|
yield self if types.empty? || types.include?(type)
|
100
96
|
|
@@ -224,6 +224,7 @@ module RuboCop
|
|
224
224
|
|
225
225
|
private
|
226
226
|
|
227
|
+
# @!method in_macro_scope?(node = self)
|
227
228
|
def_node_matcher :in_macro_scope?, <<~PATTERN
|
228
229
|
{
|
229
230
|
root? # Either a root node,
|
@@ -239,14 +240,17 @@ module RuboCop
|
|
239
240
|
}
|
240
241
|
PATTERN
|
241
242
|
|
243
|
+
# @!method adjacent_def_modifier?(node = self)
|
242
244
|
def_node_matcher :adjacent_def_modifier?, <<~PATTERN
|
243
245
|
(send nil? _ ({def defs} ...))
|
244
246
|
PATTERN
|
245
247
|
|
248
|
+
# @!method bare_access_modifier_declaration?(node = self)
|
246
249
|
def_node_matcher :bare_access_modifier_declaration?, <<~PATTERN
|
247
250
|
(send nil? {:public :protected :private :module_function})
|
248
251
|
PATTERN
|
249
252
|
|
253
|
+
# @!method non_bare_access_modifier_declaration?(node = self)
|
250
254
|
def_node_matcher :non_bare_access_modifier_declaration?, <<~PATTERN
|
251
255
|
(send nil? {:public :protected :private :module_function} _)
|
252
256
|
PATTERN
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
# A node extension for `procarg0` nodes.
|
6
|
+
# This will be used in place of a plain node when the builder constructs
|
7
|
+
# the AST, making its methods available to all `arg` nodes within RuboCop.
|
8
|
+
class Procarg0Node < ArgNode
|
9
|
+
# Returns the name of an argument.
|
10
|
+
#
|
11
|
+
# @return [Symbol, nil] the name of the argument
|
12
|
+
def name
|
13
|
+
node_parts[0].name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -9,6 +9,7 @@ module RuboCop
|
|
9
9
|
include ParameterizedNode::RestArguments
|
10
10
|
include MethodDispatchNode
|
11
11
|
|
12
|
+
# @!method attribute_accessor?(node = self)
|
12
13
|
def_node_matcher :attribute_accessor?, <<~PATTERN
|
13
14
|
[(send nil? ${:attr_reader :attr_writer :attr_accessor :attr} $...)
|
14
15
|
(_ _ _ _ ...)]
|
@@ -28,7 +28,7 @@ module RuboCop
|
|
28
28
|
module Macros
|
29
29
|
# Define a method which applies a pattern to an AST node
|
30
30
|
#
|
31
|
-
# The new method will return nil if the node does not match
|
31
|
+
# The new method will return nil if the node does not match.
|
32
32
|
# If the node matches, and a block is provided, the new method will
|
33
33
|
# yield to the block (passing any captures as block arguments).
|
34
34
|
# If the node matches, and no block is provided, the new method will
|
@@ -103,7 +103,7 @@ module RuboCop
|
|
103
103
|
# Yields its argument and any descendants, depth-first.
|
104
104
|
#
|
105
105
|
def self.descend(element, &block)
|
106
|
-
return to_enum(__method__, element) unless
|
106
|
+
return to_enum(__method__, element) unless block
|
107
107
|
|
108
108
|
yield element
|
109
109
|
|
@@ -33,7 +33,7 @@ module RuboCop
|
|
33
33
|
name
|
34
34
|
end
|
35
35
|
|
36
|
-
# Enumerates `enum` while keeping track of state
|
36
|
+
# Enumerates `enum` while keeping track of state across
|
37
37
|
# union branches (captures and unification).
|
38
38
|
def each_union(enum, &block)
|
39
39
|
enforce_same_captures(binding.union_bind(enum), &block)
|
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
# sequence head
|
41
41
|
# :variadic_mode : child index held by @cur_index_var
|
42
42
|
# >= 0 : when the current child index is known
|
43
|
-
# (from the
|
43
|
+
# (from the beginning)
|
44
44
|
# < 0 : when the index is known from the end,
|
45
45
|
# where -1 is *past the end*,
|
46
46
|
# -2 is the last child, etc...
|
@@ -328,7 +328,7 @@ module RuboCop
|
|
328
328
|
"#{@seq_var}.children.size - #{-(cur + DELTA)}"
|
329
329
|
end
|
330
330
|
|
331
|
-
#
|
331
|
+
# NOTE: assumes `@cur_index != :seq_head`. Node types using `within_loop` must
|
332
332
|
# have `def in_sequence_head; :raise; end`
|
333
333
|
def within_loop
|
334
334
|
sync do |sync_code|
|
@@ -13,7 +13,8 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
13
13
|
macros
|
14
14
|
CONST_NAME /[A-Z:][a-zA-Z_:]+/
|
15
15
|
SYMBOL_NAME /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
|
16
|
-
IDENTIFIER /[a-
|
16
|
+
IDENTIFIER /[a-z][a-zA-Z0-9_]*/
|
17
|
+
NODE_TYPE /[a-z][a-zA-Z0-9_-]*/ # Same as identifier but allows '-'
|
17
18
|
CALL /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
18
19
|
REGEXP_BODY /(?:[^\/]|\\\/)*/
|
19
20
|
REGEXP /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
|
@@ -27,14 +28,14 @@ rules
|
|
27
28
|
%w"( ) { | } [ ] < > $ ! ^ ` ... + * ? ,"
|
28
29
|
)}/o { emit ss.matched, &:to_sym }
|
29
30
|
/#{REGEXP}/o { emit_regexp }
|
30
|
-
|
31
|
+
/%?(#{CONST_NAME})/o { emit :tPARAM_CONST }
|
31
32
|
/%([a-z_]+)/ { emit :tPARAM_NAMED }
|
32
33
|
/%(\d*)/ { emit(:tPARAM_NUMBER) { |s| s.empty? ? 1 : s.to_i } } # Map `%` to `%1`
|
33
34
|
/_(#{IDENTIFIER})/o { emit :tUNIFY }
|
34
35
|
/_/o { emit :tWILDCARD }
|
35
36
|
/\#(#{CALL})/o { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
|
36
37
|
/#{IDENTIFIER}\?/o { @state = :ARG; emit :tPREDICATE, &:to_sym }
|
37
|
-
/#{
|
38
|
+
/#{NODE_TYPE}/o { emit :tNODE_TYPE, &:to_sym }
|
38
39
|
:ARG /\(/ { @state = nil; emit :tARG_LIST }
|
39
40
|
:ARG // { @state = nil }
|
40
41
|
/\#.*/ { emit_comment }
|
@@ -26,7 +26,8 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
26
26
|
# :stopdoc:
|
27
27
|
CONST_NAME = /[A-Z:][a-zA-Z_:]+/
|
28
28
|
SYMBOL_NAME = /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
|
29
|
-
IDENTIFIER = /[a-
|
29
|
+
IDENTIFIER = /[a-z][a-zA-Z0-9_]*/
|
30
|
+
NODE_TYPE = /[a-z][a-zA-Z0-9_-]*/
|
30
31
|
CALL = /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
31
32
|
REGEXP_BODY = /(?:[^\/]|\\\/)*/
|
32
33
|
REGEXP = /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
|
@@ -134,7 +135,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
134
135
|
action { emit ss.matched, &:to_sym }
|
135
136
|
when ss.skip(/#{REGEXP}/o) then
|
136
137
|
action { emit_regexp }
|
137
|
-
when ss.skip(
|
138
|
+
when ss.skip(/%?(#{CONST_NAME})/o) then
|
138
139
|
action { emit :tPARAM_CONST }
|
139
140
|
when ss.skip(/%([a-z_]+)/) then
|
140
141
|
action { emit :tPARAM_NAMED }
|
@@ -148,7 +149,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
148
149
|
action { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
|
149
150
|
when ss.skip(/#{IDENTIFIER}\?/o) then
|
150
151
|
action { @state = :ARG; emit :tPREDICATE, &:to_sym }
|
151
|
-
when ss.skip(/#{
|
152
|
+
when ss.skip(/#{NODE_TYPE}/o) then
|
152
153
|
action { emit :tNODE_TYPE, &:to_sym }
|
153
154
|
when ss.skip(/\#.*/) then
|
154
155
|
action { emit_comment }
|
@@ -7,12 +7,13 @@ module RuboCop
|
|
7
7
|
class Node < ::Parser::AST::Node
|
8
8
|
extend Forwardable
|
9
9
|
include ::RuboCop::AST::Descendence
|
10
|
+
using Ext::RangeMinMax
|
10
11
|
|
11
12
|
MATCHES_WITHIN_SET = %i[symbol number string].to_set.freeze
|
12
13
|
private_constant :MATCHES_WITHIN_SET
|
13
14
|
|
14
15
|
###
|
15
|
-
# To be
|
16
|
+
# To be overridden by subclasses
|
16
17
|
###
|
17
18
|
|
18
19
|
def rest?
|
@@ -59,7 +60,7 @@ module RuboCop
|
|
59
60
|
end
|
60
61
|
|
61
62
|
# @return [Boolean] returns true for nodes having a Ruby literal equivalent
|
62
|
-
# that matches
|
63
|
+
# that matches within a Set (e.g. `42`, `:sym` but not `/regexp/`)
|
63
64
|
def matches_within_set?
|
64
65
|
MATCHES_WITHIN_SET.include?(type)
|
65
66
|
end
|
@@ -197,27 +198,13 @@ module RuboCop
|
|
197
198
|
end
|
198
199
|
end
|
199
200
|
|
200
|
-
# Circumvent broken `Range#minmax` for infinity ranges in 2.6-
|
201
|
-
module MapMinMax
|
202
|
-
if RUBY_VERSION >= '2.7'
|
203
|
-
def map_min_max(enum)
|
204
|
-
enum.map(&:minmax)
|
205
|
-
end
|
206
|
-
else
|
207
|
-
def map_min_max(enum)
|
208
|
-
enum.map { |r| [r.min, r.max] } # rubocop:disable Style/MinMax
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
201
|
# A list (potentially empty) of nodes; part of a Union
|
214
202
|
class Subsequence < Node
|
215
203
|
include ForbidInSeqHead
|
216
|
-
include MapMinMax
|
217
204
|
|
218
205
|
def arity
|
219
|
-
min, max =
|
220
|
-
min == max ? min || 0 : min..max #
|
206
|
+
min, max = children.map(&:arity_range).map(&:minmax).transpose.map(&:sum)
|
207
|
+
min == max ? min || 0 : min..max # NOTE: || 0 for empty case, where min == max == nil.
|
221
208
|
end
|
222
209
|
|
223
210
|
def in_sequence_head
|
@@ -231,10 +218,8 @@ module RuboCop
|
|
231
218
|
|
232
219
|
# Node class for `{ ... }`
|
233
220
|
class Union < Node
|
234
|
-
include MapMinMax
|
235
|
-
|
236
221
|
def arity
|
237
|
-
minima, maxima =
|
222
|
+
minima, maxima = children.map(&:arity_range).map(&:minmax).transpose
|
238
223
|
min = minima.min
|
239
224
|
max = maxima.max
|
240
225
|
min == max ? min : min..max
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# DO NOT MODIFY!!!!
|
4
|
-
# This file is automatically generated by Racc 1.
|
4
|
+
# This file is automatically generated by Racc 1.5.1
|
5
5
|
# from Racc grammar file "".
|
6
6
|
#
|
7
7
|
|
@@ -14,15 +14,15 @@ module RuboCop
|
|
14
14
|
|
15
15
|
racc_action_table = [
|
16
16
|
14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
|
17
|
-
60, 22, 20, 4,
|
18
|
-
28, 23, 56, 50,
|
17
|
+
60, 22, 20, 4, 24, 5, 40, 6, 7, 8,
|
18
|
+
28, 23, 56, 50, 40, 61, 43, 66, 51, 51,
|
19
19
|
58, 14, 15, 16, 21, 18, 17, 19, 10, 11,
|
20
20
|
12, nil, 22, 20, 4, nil, 5, nil, 6, 7,
|
21
21
|
8, 28, 23, nil, nil, -34, 14, 15, 16, 21,
|
22
22
|
18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
|
23
23
|
nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
|
24
24
|
16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
|
25
|
-
20, 4, nil, 5, nil, 6, 7, 8,
|
25
|
+
20, 4, nil, 5, nil, 6, 7, 8, 28, 23,
|
26
26
|
14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
|
27
27
|
nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
|
28
28
|
9, 23, 14, 15, 16, 21, 18, 17, 19, 10,
|
@@ -33,7 +33,7 @@ racc_action_table = [
|
|
33
33
|
18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
|
34
34
|
nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
|
35
35
|
16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
|
36
|
-
20, 4, nil, 5, nil, 6, 7, 8,
|
36
|
+
20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
|
37
37
|
14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
|
38
38
|
nil, 22, 20, 4, 44, 5, nil, 6, 7, 8,
|
39
39
|
28, 23, 14, 15, 16, 21, 18, 17, 19, 10,
|
@@ -47,31 +47,31 @@ racc_action_table = [
|
|
47
47
|
20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
|
48
48
|
14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
|
49
49
|
nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
|
50
|
-
9, 23,
|
51
|
-
|
50
|
+
9, 23, -1, -1, -1, -2, -2, -2, 47, 48,
|
51
|
+
49 ]
|
52
52
|
|
53
53
|
racc_action_check = [
|
54
54
|
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
|
55
|
-
54, 42, 42, 42,
|
56
|
-
42, 42, 42, 30,
|
55
|
+
54, 42, 42, 42, 1, 42, 10, 42, 42, 42,
|
56
|
+
42, 42, 42, 30, 11, 54, 24, 62, 30, 63,
|
57
57
|
42, 59, 59, 59, 59, 59, 59, 59, 59, 59,
|
58
58
|
59, nil, 59, 59, 59, nil, 59, nil, 59, 59,
|
59
|
-
59, 59, 59, nil, nil, 59,
|
60
|
-
5, 5, 5, 5, 5, 5, nil, 5, 5, 5,
|
61
|
-
nil, 5, nil, 5, 5, 5, 5, 5, 6, 6,
|
62
|
-
6, 6, 6, 6, 6, 6, 6, 6, nil, 6,
|
63
|
-
6, 6, nil, 6, nil, 6, 6, 6, 6, 6,
|
64
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
65
|
-
nil, 7, 7, 7, nil, 7, nil, 7, 7, 7,
|
66
|
-
7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
|
67
|
-
8, 8, nil, 8, 8, 8, nil, 8, nil, 8,
|
68
|
-
8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
|
69
|
-
9, 9, 9, 9, nil, 9, 9, 9, nil, 9,
|
70
|
-
nil, 9, 9, 9, 9, 9, 0, 0, 0, 0,
|
59
|
+
59, 59, 59, nil, nil, 59, 0, 0, 0, 0,
|
71
60
|
0, 0, 0, 0, 0, 0, nil, 0, 0, 0,
|
72
61
|
nil, 0, nil, 0, 0, 0, 0, 0, 4, 4,
|
73
62
|
4, 4, 4, 4, 4, 4, 4, 4, nil, 4,
|
74
63
|
4, 4, nil, 4, nil, 4, 4, 4, 4, 4,
|
64
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
65
|
+
nil, 5, 5, 5, nil, 5, nil, 5, 5, 5,
|
66
|
+
5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
|
67
|
+
6, 6, nil, 6, 6, 6, nil, 6, nil, 6,
|
68
|
+
6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
|
69
|
+
7, 7, 7, 7, nil, 7, 7, 7, nil, 7,
|
70
|
+
nil, 7, 7, 7, 7, 7, 8, 8, 8, 8,
|
71
|
+
8, 8, 8, 8, 8, 8, nil, 8, 8, 8,
|
72
|
+
nil, 8, nil, 8, 8, 8, 8, 8, 9, 9,
|
73
|
+
9, 9, 9, 9, 9, 9, 9, 9, nil, 9,
|
74
|
+
9, 9, nil, 9, nil, 9, 9, 9, 9, 9,
|
75
75
|
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
76
76
|
nil, 27, 27, 27, 27, 27, nil, 27, 27, 27,
|
77
77
|
27, 27, 28, 28, 28, 28, 28, 28, 28, 28,
|
@@ -85,17 +85,17 @@ racc_action_check = [
|
|
85
85
|
50, 50, nil, 50, nil, 50, 50, 50, 50, 50,
|
86
86
|
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
|
87
87
|
nil, 61, 61, 61, nil, 61, nil, 61, 61, 61,
|
88
|
-
61, 61,
|
89
|
-
|
88
|
+
61, 61, 25, 25, 25, 26, 26, 26, 29, 29,
|
89
|
+
29 ]
|
90
90
|
|
91
91
|
racc_action_pointer = [
|
92
|
-
|
93
|
-
|
94
|
-
nil, nil, nil, nil,
|
92
|
+
54, 14, nil, nil, 76, 98, 120, 142, 164, 186,
|
93
|
+
4, 12, nil, nil, nil, nil, nil, nil, nil, nil,
|
94
|
+
nil, nil, nil, nil, 26, 315, 318, 208, 230, 321,
|
95
95
|
-2, nil, nil, 252, nil, nil, nil, nil, nil, nil,
|
96
96
|
274, nil, -2, nil, nil, nil, nil, nil, nil, nil,
|
97
97
|
296, nil, nil, nil, -6, nil, nil, nil, nil, 29,
|
98
|
-
nil, 318,
|
98
|
+
nil, 318, 1, -1, nil, nil, nil ]
|
99
99
|
|
100
100
|
racc_action_default = [
|
101
101
|
-47, -47, -1, -2, -31, -47, -47, -47, -47, -47,
|
@@ -107,26 +107,26 @@ racc_action_default = [
|
|
107
107
|
-37, -47, -47, -47, -35, -39, -26 ]
|
108
108
|
|
109
109
|
racc_goto_table = [
|
110
|
-
1, 33,
|
111
|
-
|
112
|
-
nil, nil, nil, nil, nil, nil,
|
113
|
-
nil, nil, nil, 53,
|
114
|
-
55,
|
110
|
+
1, 33, 27, 25, 26, 34, 35, 36, 37, 38,
|
111
|
+
42, 32, 39, 41, 46, 63, 62, 64, 54, nil,
|
112
|
+
nil, nil, nil, nil, nil, nil, 25, 26, 38, nil,
|
113
|
+
nil, nil, nil, 53, 45, nil, nil, nil, nil, nil,
|
114
|
+
55, 25, 26, nil, nil, nil, 59, nil, nil, 57,
|
115
115
|
34, nil, nil, nil, nil, nil, nil, nil, nil, 53,
|
116
116
|
nil, 65 ]
|
117
117
|
|
118
118
|
racc_goto_check = [
|
119
|
-
1, 5,
|
120
|
-
|
121
|
-
nil, nil, nil, nil, nil, nil,
|
122
|
-
nil, nil, nil, 1,
|
123
|
-
1,
|
119
|
+
1, 5, 4, 2, 3, 1, 1, 1, 1, 1,
|
120
|
+
8, 9, 6, 6, 10, 11, 12, 13, 14, nil,
|
121
|
+
nil, nil, nil, nil, nil, nil, 2, 3, 1, nil,
|
122
|
+
nil, nil, nil, 1, 9, nil, nil, nil, nil, nil,
|
123
|
+
1, 2, 3, nil, nil, nil, 5, nil, nil, 9,
|
124
124
|
1, nil, nil, nil, nil, nil, nil, nil, nil, 1,
|
125
125
|
nil, 1 ]
|
126
126
|
|
127
127
|
racc_goto_pointer = [
|
128
|
-
nil, 0, 0,
|
129
|
-
-
|
128
|
+
nil, 0, -1, 0, -2, -4, 2, nil, -13, 7,
|
129
|
+
-15, -44, -43, -42, -22 ]
|
130
130
|
|
131
131
|
racc_goto_default = [
|
132
132
|
nil, 29, 2, 3, nil, nil, nil, 13, nil, nil,
|
@@ -41,7 +41,7 @@ module RuboCop
|
|
41
41
|
def ast_with_comments
|
42
42
|
return if !ast || !comments
|
43
43
|
|
44
|
-
@ast_with_comments ||= Parser::Source::Comment.
|
44
|
+
@ast_with_comments ||= Parser::Source::Comment.associate_by_identity(ast, comments)
|
45
45
|
end
|
46
46
|
|
47
47
|
# Returns the source lines, line break characters removed, excluding a
|
@@ -114,9 +114,10 @@ module RuboCop
|
|
114
114
|
in_match match_alt break next
|
115
115
|
match_as array_pattern array_pattern_with_tail
|
116
116
|
hash_pattern const_pattern find_pattern
|
117
|
-
index indexasgn procarg0]
|
117
|
+
index indexasgn procarg0 kwargs]
|
118
118
|
many_opt_node_children = %i[case rescue resbody ensure for when
|
119
|
-
case_match in_pattern irange erange
|
119
|
+
case_match in_pattern irange erange
|
120
|
+
match_pattern match_pattern_p]
|
120
121
|
|
121
122
|
### Callbacks for above
|
122
123
|
def_callback no_children
|
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.4.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: 2021-05-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 3.0.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 3.0.1.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,10 +60,11 @@ files:
|
|
60
60
|
- lib/rubocop/ast.rb
|
61
61
|
- lib/rubocop/ast/builder.rb
|
62
62
|
- lib/rubocop/ast/ext/range.rb
|
63
|
-
- lib/rubocop/ast/ext/
|
63
|
+
- lib/rubocop/ast/ext/range_min_max.rb
|
64
64
|
- lib/rubocop/ast/node.rb
|
65
65
|
- lib/rubocop/ast/node/alias_node.rb
|
66
66
|
- lib/rubocop/ast/node/and_node.rb
|
67
|
+
- lib/rubocop/ast/node/arg_node.rb
|
67
68
|
- lib/rubocop/ast/node/args_node.rb
|
68
69
|
- lib/rubocop/ast/node/array_node.rb
|
69
70
|
- lib/rubocop/ast/node/block_node.rb
|
@@ -74,6 +75,7 @@ files:
|
|
74
75
|
- lib/rubocop/ast/node/const_node.rb
|
75
76
|
- lib/rubocop/ast/node/def_node.rb
|
76
77
|
- lib/rubocop/ast/node/defined_node.rb
|
78
|
+
- lib/rubocop/ast/node/dstr_node.rb
|
77
79
|
- lib/rubocop/ast/node/ensure_node.rb
|
78
80
|
- lib/rubocop/ast/node/float_node.rb
|
79
81
|
- lib/rubocop/ast/node/for_node.rb
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- lib/rubocop/ast/node/next_node.rb
|
102
104
|
- lib/rubocop/ast/node/or_node.rb
|
103
105
|
- lib/rubocop/ast/node/pair_node.rb
|
106
|
+
- lib/rubocop/ast/node/procarg0_node.rb
|
104
107
|
- lib/rubocop/ast/node/range_node.rb
|
105
108
|
- lib/rubocop/ast/node/regexp_node.rb
|
106
109
|
- lib/rubocop/ast/node/resbody_node.rb
|
@@ -158,14 +161,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
161
|
requirements:
|
159
162
|
- - ">="
|
160
163
|
- !ruby/object:Gem::Version
|
161
|
-
version: 2.
|
164
|
+
version: 2.5.0
|
162
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
166
|
requirements:
|
164
167
|
- - ">="
|
165
168
|
- !ruby/object:Gem::Version
|
166
169
|
version: '0'
|
167
170
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.2.3
|
169
172
|
signing_key:
|
170
173
|
specification_version: 4
|
171
174
|
summary: RuboCop tools to deal with Ruby code AST.
|