danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,4193 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rubocop-ast` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rubocop-ast`.
6
+
7
+ module RuboCop; end
8
+
9
+ # ...
10
+ module RuboCop::AST
11
+ extend ::RuboCop::AST::RuboCopCompatibility
12
+ end
13
+
14
+ # A node extension for `alias` nodes. This will be used in place of a plain
15
+ # node when the builder constructs the AST, making its methods available
16
+ # to all `alias` nodes within RuboCop.
17
+ class RuboCop::AST::AliasNode < ::RuboCop::AST::Node
18
+ # Returns the new identifier as specified by the `alias`.
19
+ #
20
+ # @return [SymbolNode] the new identifier
21
+ def new_identifier; end
22
+
23
+ # Returns the old identifier as specified by the `alias`.
24
+ #
25
+ # @return [SymbolNode] the old identifier
26
+ def old_identifier; end
27
+ end
28
+
29
+ # A node extension for `op_asgn` nodes.
30
+ # This will be used in place of a plain node when the builder constructs
31
+ # the AST, making its methods available to all assignment nodes within RuboCop.
32
+ class RuboCop::AST::AndAsgnNode < ::RuboCop::AST::OpAsgnNode
33
+ # The operator being used for assignment as a symbol.
34
+ #
35
+ # @return [Symbol] the assignment operator
36
+ def operator; end
37
+ end
38
+
39
+ # A node extension for `until` nodes. This will be used in place of a plain
40
+ # node when the builder constructs the AST, making its methods available
41
+ # to all `until` nodes within RuboCop.
42
+ class RuboCop::AST::AndNode < ::RuboCop::AST::Node
43
+ include ::RuboCop::AST::BinaryOperatorNode
44
+ include ::RuboCop::AST::PredicateOperatorNode
45
+
46
+ # Returns the alternate operator of the `and` as a string.
47
+ # Returns `and` for `&&` and vice versa.
48
+ #
49
+ # @return [String] the alternate of the `and` operator
50
+ def alternate_operator; end
51
+
52
+ # Returns the inverse keyword of the `and` node as a string.
53
+ # Returns `||` for `&&` and `or` for `and`.
54
+ #
55
+ # @return [String] the inverse of the `and` operator
56
+ def inverse_operator; end
57
+ end
58
+
59
+ # A node extension for `arg`, `optarg`, `restarg`, `kwarg`, `kwoptarg`,
60
+ # `kwrestarg`, `blockarg`, `shadowarg` and `forward_arg` nodes.
61
+ # This will be used in place of a plain node when the builder constructs
62
+ # the AST, making its methods available to all `arg` nodes within RuboCop.
63
+ class RuboCop::AST::ArgNode < ::RuboCop::AST::Node
64
+ # Checks whether the argument has a default value
65
+ #
66
+ # @return [Boolean] whether the argument has a default value
67
+ def default?; end
68
+
69
+ # Returns the default value of the argument, if any.
70
+ #
71
+ # @return [Node, nil] the default value of the argument
72
+ def default_value; end
73
+
74
+ # Returns the name of an argument.
75
+ #
76
+ # @return [Symbol, nil] the name of the argument
77
+ def name; end
78
+ end
79
+
80
+ # A node extension for `args` nodes. This will be used in place of a plain
81
+ # node when the builder constructs the AST, making its methods available
82
+ # to all `args` nodes within RuboCop.
83
+ class RuboCop::AST::ArgsNode < ::RuboCop::AST::Node
84
+ include ::RuboCop::AST::CollectionNode
85
+
86
+ # Yield each argument from the collection.
87
+ # Arguments can be inside `mlhs` nodes in the case of destructuring, so this
88
+ # flattens the collection to just `arg`, `optarg`, `restarg`, `kwarg`,
89
+ # `kwoptarg`, `kwrestarg`, `blockarg`, `forward_arg` and `shadowarg`.
90
+ #
91
+ # @return [Array<Node>] array of argument nodes.
92
+ def argument_list; end
93
+
94
+ # It returns true if arguments are empty and delimiters do not exist.
95
+ # @example:
96
+ # # true
97
+ # def x; end
98
+ # x { }
99
+ # -> {}
100
+ #
101
+ # # false
102
+ # def x(); end
103
+ # def x a; end
104
+ # x { || }
105
+ # -> () {}
106
+ # -> a {}
107
+ #
108
+ # @return [Boolean]
109
+ def empty_and_without_delimiters?; end
110
+ end
111
+
112
+ # A node extension for `array` nodes. This will be used in place of a plain
113
+ # node when the builder constructs the AST, making its methods available
114
+ # to all `array` nodes within RuboCop.
115
+ class RuboCop::AST::ArrayNode < ::RuboCop::AST::Node
116
+ # Checks whether the `array` literal is delimited by either percent or
117
+ # square brackets
118
+ #
119
+ # brackets
120
+ #
121
+ # @return [Boolean] whether the array is enclosed in percent or square
122
+ def bracketed?; end
123
+
124
+ # @deprecated Use `values.each` (a.k.a. `children.each`)
125
+ def each_value(&block); end
126
+
127
+ # Checks whether the `array` literal is delimited by percent brackets.
128
+ #
129
+ # @overload percent_literal?
130
+ # @overload percent_literal?
131
+ # @return [Boolean] whether the array is enclosed in percent brackets
132
+ def percent_literal?(type = T.unsafe(nil)); end
133
+
134
+ # Checks whether the `array` literal is delimited by square brackets.
135
+ #
136
+ # @return [Boolean] whether the array is enclosed in square brackets
137
+ def square_brackets?; end
138
+
139
+ # Returns an array of all value nodes in the `array` literal.
140
+ #
141
+ # @return [Array<Node>] an array of value nodes
142
+ def values; end
143
+ end
144
+
145
+ RuboCop::AST::ArrayNode::PERCENT_LITERAL_TYPES = T.let(T.unsafe(nil), Hash)
146
+
147
+ # A node extension for `lvasgn`, `ivasgn`, `cvasgn`, and `gvasgn` nodes.
148
+ # This will be used in place of a plain node when the builder constructs
149
+ # the AST, making its methods available to all assignment nodes within RuboCop.
150
+ class RuboCop::AST::AsgnNode < ::RuboCop::AST::Node
151
+ # The expression being assigned to the variable.
152
+ #
153
+ # @return [Node] the expression being assigned.
154
+ def expression; end
155
+
156
+ # The name of the variable being assigned as a symbol.
157
+ #
158
+ # @return [Symbol] the name of the variable being assigned
159
+ def name; end
160
+ end
161
+
162
+ # Common functionality for primitive literal nodes: `sym`, `str`,
163
+ # `int`, `float`, ...
164
+ module RuboCop::AST::BasicLiteralNode
165
+ # Returns the value of the literal.
166
+ #
167
+ # @return [mixed] the value of the literal
168
+ def value; end
169
+ end
170
+
171
+ # Common functionality for nodes that are binary operations:
172
+ # `or`, `and` ...
173
+ module RuboCop::AST::BinaryOperatorNode
174
+ # Returns all of the conditions, including nested conditions,
175
+ # of the binary operation.
176
+ #
177
+ # operation and the let and right hand side of any nested binary
178
+ # operators
179
+ #
180
+ # @return [Array<Node>] the left and right hand side of the binary
181
+ def conditions; end
182
+
183
+ # Returns the left hand side node of the binary operation.
184
+ #
185
+ # @return [Node] the left hand side of the binary operation
186
+ def lhs; end
187
+
188
+ # Returns the right hand side node of the binary operation.
189
+ #
190
+ # @return [Node] the right hand side of the binary operation
191
+ def rhs; end
192
+ end
193
+
194
+ # A node extension for `block` nodes. This will be used in place of a plain
195
+ # node when the builder constructs the AST, making its methods available
196
+ # to all `send` nodes within RuboCop.
197
+ #
198
+ # A `block` node is essentially a method send with a block. Parser nests
199
+ # the `send` node inside the `block` node.
200
+ class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
201
+ include ::RuboCop::AST::MethodIdentifierPredicates
202
+
203
+ # Returns a collection of all descendants of this node that are
204
+ # argument type nodes. See `ArgsNode#argument_list` for details.
205
+ #
206
+ # @return [Array<Node>]
207
+ def argument_list; end
208
+
209
+ # The arguments of this block.
210
+ # Note that if the block has destructured arguments, `arguments` will
211
+ # return a `mlhs` node, whereas `argument_list` will return only
212
+ # actual argument nodes.
213
+ #
214
+ # @return [Array<Node>]
215
+ def arguments; end
216
+
217
+ # Checks whether this block takes any arguments.
218
+ #
219
+ # @return [Boolean] whether this `block` node takes any arguments
220
+ def arguments?; end
221
+
222
+ # The body of this block.
223
+ #
224
+ # @return [Node, nil] the body of the `block` node or `nil`
225
+ def body; end
226
+
227
+ # Checks whether the `block` literal is delimited by curly braces.
228
+ #
229
+ # @return [Boolean] whether the `block` literal is enclosed in braces
230
+ def braces?; end
231
+
232
+ # The closing delimiter for this `block` literal.
233
+ #
234
+ # @return [String] the closing delimiter for the `block` literal
235
+ def closing_delimiter; end
236
+
237
+ # The delimiters for this `block` literal.
238
+ #
239
+ # @return [Array<String>] the delimiters for the `block` literal
240
+ def delimiters; end
241
+
242
+ # Checks whether the `block` literal is delimited by `do`-`end` keywords.
243
+ #
244
+ # @return [Boolean] whether the `block` literal is enclosed in `do`-`end`
245
+ def keywords?; end
246
+
247
+ # Checks whether this `block` literal belongs to a lambda.
248
+ #
249
+ # @return [Boolean] whether the `block` literal belongs to a lambda
250
+ def lambda?; end
251
+
252
+ # The name of the dispatched method as a symbol.
253
+ #
254
+ # @return [Symbol] the name of the dispatched method
255
+ def method_name; end
256
+
257
+ # Checks whether this is a multiline block. This is overridden here
258
+ # because the general version in `Node` does not work for `block` nodes.
259
+ #
260
+ # @return [Boolean] whether the `block` literal is on a several lines
261
+ def multiline?; end
262
+
263
+ # The opening delimiter for this `block` literal.
264
+ #
265
+ # @return [String] the opening delimiter for the `block` literal
266
+ def opening_delimiter; end
267
+
268
+ # The `send` node associated with this block.
269
+ #
270
+ # @return [SendNode] the `send` node associated with the `block` node
271
+ def send_node; end
272
+
273
+ # Checks whether this is a single line block. This is overridden here
274
+ # because the general version in `Node` does not work for `block` nodes.
275
+ #
276
+ # @return [Boolean] whether the `block` literal is on a single line
277
+ def single_line?; end
278
+
279
+ # Checks whether this node body is a void context.
280
+ #
281
+ # @return [Boolean] whether the `block` node body is a void context
282
+ def void_context?; end
283
+
284
+ private
285
+
286
+ # Numbered arguments of this `numblock`.
287
+ def numbered_arguments; end
288
+ end
289
+
290
+ RuboCop::AST::BlockNode::VOID_CONTEXT_METHODS = T.let(T.unsafe(nil), Array)
291
+
292
+ # A node extension for `break` nodes. This will be used in place of a
293
+ # plain node when the builder constructs the AST, making its methods
294
+ # available to all `break` nodes within RuboCop.
295
+ class RuboCop::AST::BreakNode < ::RuboCop::AST::Node
296
+ include ::RuboCop::AST::ParameterizedNode
297
+ include ::RuboCop::AST::ParameterizedNode::WrappedArguments
298
+ end
299
+
300
+ # `RuboCop::AST::Builder` is an AST builder that is utilized to let `Parser`
301
+ # generate ASTs with {RuboCop::AST::Node}.
302
+ #
303
+ # @example
304
+ # buffer = Parser::Source::Buffer.new('(string)')
305
+ # buffer.source = 'puts :foo'
306
+ #
307
+ # builder = RuboCop::AST::Builder.new
308
+ # require 'parser/ruby25'
309
+ # parser = Parser::Ruby25.new(builder)
310
+ # root_node = parser.parse(buffer)
311
+ class RuboCop::AST::Builder < ::Parser::Builders::Default
312
+ # Generates {Node} from the given information.
313
+ #
314
+ # @return [Node] the generated node
315
+ def n(type, children, source_map); end
316
+
317
+ # TODO: Figure out what to do about literal encoding handling...
318
+ # More details here https://github.com/whitequark/parser/issues/283
319
+ def string_value(token); end
320
+
321
+ private
322
+
323
+ def node_klass(type); end
324
+ end
325
+
326
+ # @api private
327
+ RuboCop::AST::Builder::NODE_MAP = T.let(T.unsafe(nil), Hash)
328
+
329
+ # A node extension for `case_match` nodes. This will be used in place of
330
+ # a plain node when the builder constructs the AST, making its methods
331
+ # available to all `case_match` nodes within RuboCop.
332
+ class RuboCop::AST::CaseMatchNode < ::RuboCop::AST::Node
333
+ include ::RuboCop::AST::ConditionalNode
334
+
335
+ # Returns an array of all the when branches in the `case` statement.
336
+ #
337
+ # and the `else` (if any). Note that these bodies could be nil.
338
+ #
339
+ # @return [Array<Node, nil>] an array of the bodies of the `in` branches
340
+ def branches; end
341
+
342
+ # @deprecated Use `in_pattern_branches.each`
343
+ def each_in_pattern(&block); end
344
+
345
+ # Checks whether this case statement has an `else` branch.
346
+ #
347
+ # @return [Boolean] whether the `case` statement has an `else` branch
348
+ def else?; end
349
+
350
+ # Returns the else branch of the `case` statement, if any.
351
+ #
352
+ # @return [Node] the else branch node of the `case` statement
353
+ # @return [EmptyElse] the empty else branch node of the `case` statement
354
+ # @return [nil] if the case statement does not have an else branch.
355
+ def else_branch; end
356
+
357
+ # Returns an array of all the `in` pattern branches in the `case` statement.
358
+ #
359
+ # @return [Array<InPatternNode>] an array of `in_pattern` nodes
360
+ def in_pattern_branches; end
361
+
362
+ # Returns the keyword of the `case` statement as a string.
363
+ #
364
+ # @return [String] the keyword of the `case` statement
365
+ def keyword; end
366
+ end
367
+
368
+ # A node extension for `case` nodes. This will be used in place of a plain
369
+ # node when the builder constructs the AST, making its methods available
370
+ # to all `case` nodes within RuboCop.
371
+ class RuboCop::AST::CaseNode < ::RuboCop::AST::Node
372
+ include ::RuboCop::AST::ConditionalNode
373
+
374
+ # Returns an array of all the when branches in the `case` statement.
375
+ #
376
+ # and the else (if any). Note that these bodies could be nil.
377
+ #
378
+ # @return [Array<Node, nil>] an array of the bodies of the when branches
379
+ def branches; end
380
+
381
+ # @deprecated Use `when_branches.each`
382
+ def each_when(&block); end
383
+
384
+ # Checks whether this case statement has an `else` branch.
385
+ #
386
+ # @return [Boolean] whether the `case` statement has an `else` branch
387
+ def else?; end
388
+
389
+ # Returns the else branch of the `case` statement, if any.
390
+ #
391
+ # @return [Node] the else branch node of the `case` statement
392
+ # @return [nil] if the case statement does not have an else branch.
393
+ def else_branch; end
394
+
395
+ # Returns the keyword of the `case` statement as a string.
396
+ #
397
+ # @return [String] the keyword of the `case` statement
398
+ def keyword; end
399
+
400
+ # Returns an array of all the when branches in the `case` statement.
401
+ #
402
+ # @return [Array<WhenNode>] an array of `when` nodes
403
+ def when_branches; end
404
+ end
405
+
406
+ # A node extension for `casgn` nodes.
407
+ # This will be used in place of a plain node when the builder constructs
408
+ # the AST, making its methods available to all assignment nodes within RuboCop.
409
+ class RuboCop::AST::CasgnNode < ::RuboCop::AST::Node
410
+ # The expression being assigned to the variable.
411
+ #
412
+ # @return [Node] the expression being assigned.
413
+ def expression; end
414
+
415
+ # The name of the variable being assigned as a symbol.
416
+ #
417
+ # @return [Symbol] the name of the variable being assigned
418
+ def name; end
419
+
420
+ # The namespace of the constant being assigned.
421
+ #
422
+ # @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
423
+ def namespace; end
424
+ end
425
+
426
+ # A node extension for `class` nodes. This will be used in place of a plain
427
+ # node when the builder constructs the AST, making its methods available
428
+ # to all `class` nodes within RuboCop.
429
+ class RuboCop::AST::ClassNode < ::RuboCop::AST::Node
430
+ # The body of this `class` node.
431
+ #
432
+ # @return [Node, nil] the body of the class
433
+ def body; end
434
+
435
+ # The identifier for this `class` node.
436
+ #
437
+ # @return [Node] the identifier of the class
438
+ def identifier; end
439
+
440
+ # The parent class for this `class` node.
441
+ #
442
+ # @return [Node, nil] the parent class of the class
443
+ def parent_class; end
444
+ end
445
+
446
+ # A mixin that helps give collection nodes array polymorphism.
447
+ module RuboCop::AST::CollectionNode
448
+ extend ::Forwardable
449
+
450
+ def &(*args, &block); end
451
+ def *(*args, &block); end
452
+ def +(*args, &block); end
453
+ def -(*args, &block); end
454
+ def <<(*args, &block); end
455
+ def [](*args, &block); end
456
+ def []=(*args, &block); end
457
+ def all?(*args, &block); end
458
+ def any?(*args, &block); end
459
+ def append(*args, &block); end
460
+ def assoc(*args, &block); end
461
+ def at(*args, &block); end
462
+ def bsearch(*args, &block); end
463
+ def bsearch_index(*args, &block); end
464
+ def chain(*args, &block); end
465
+ def chunk(*args, &block); end
466
+ def chunk_while(*args, &block); end
467
+ def clear(*args, &block); end
468
+ def collect(*args, &block); end
469
+ def collect!(*args, &block); end
470
+ def collect_concat(*args, &block); end
471
+ def combination(*args, &block); end
472
+ def compact(*args, &block); end
473
+ def compact!(*args, &block); end
474
+ def concat(*args, &block); end
475
+ def count(*args, &block); end
476
+ def cycle(*args, &block); end
477
+ def deconstruct(*args, &block); end
478
+ def delete(*args, &block); end
479
+ def delete_at(*args, &block); end
480
+ def delete_if(*args, &block); end
481
+ def detect(*args, &block); end
482
+ def difference(*args, &block); end
483
+ def dig(*args, &block); end
484
+ def drop(*args, &block); end
485
+ def drop_while(*args, &block); end
486
+ def each(*args, &block); end
487
+ def each_cons(*args, &block); end
488
+ def each_entry(*args, &block); end
489
+ def each_index(*args, &block); end
490
+ def each_slice(*args, &block); end
491
+ def each_with_index(*args, &block); end
492
+ def each_with_object(*args, &block); end
493
+ def empty?(*args, &block); end
494
+ def entries(*args, &block); end
495
+ def fetch(*args, &block); end
496
+ def fill(*args, &block); end
497
+ def filter(*args, &block); end
498
+ def filter!(*args, &block); end
499
+ def filter_map(*args, &block); end
500
+ def find(*args, &block); end
501
+ def find_all(*args, &block); end
502
+ def find_index(*args, &block); end
503
+ def first(*args, &block); end
504
+ def flat_map(*args, &block); end
505
+ def flatten(*args, &block); end
506
+ def flatten!(*args, &block); end
507
+ def grep(*args, &block); end
508
+ def grep_v(*args, &block); end
509
+ def group_by(*args, &block); end
510
+ def include?(*args, &block); end
511
+ def index(*args, &block); end
512
+ def inject(*args, &block); end
513
+ def insert(*args, &block); end
514
+ def intersection(*args, &block); end
515
+ def join(*args, &block); end
516
+ def keep_if(*args, &block); end
517
+ def last(*args, &block); end
518
+ def lazy(*args, &block); end
519
+ def length(*args, &block); end
520
+ def map(*args, &block); end
521
+ def map!(*args, &block); end
522
+ def max(*args, &block); end
523
+ def max_by(*args, &block); end
524
+ def member?(*args, &block); end
525
+ def min(*args, &block); end
526
+ def min_by(*args, &block); end
527
+ def minmax(*args, &block); end
528
+ def minmax_by(*args, &block); end
529
+ def none?(*args, &block); end
530
+ def one?(*args, &block); end
531
+ def pack(*args, &block); end
532
+ def partition(*args, &block); end
533
+ def permutation(*args, &block); end
534
+ def place(*args, &block); end
535
+ def pop(*args, &block); end
536
+ def prepend(*args, &block); end
537
+ def product(*args, &block); end
538
+ def push(*args, &block); end
539
+ def rassoc(*args, &block); end
540
+ def reduce(*args, &block); end
541
+ def reject(*args, &block); end
542
+ def reject!(*args, &block); end
543
+ def repeated_combination(*args, &block); end
544
+ def repeated_permutation(*args, &block); end
545
+ def replace(*args, &block); end
546
+ def reverse(*args, &block); end
547
+ def reverse!(*args, &block); end
548
+ def reverse_each(*args, &block); end
549
+ def rindex(*args, &block); end
550
+ def rotate(*args, &block); end
551
+ def rotate!(*args, &block); end
552
+ def sample(*args, &block); end
553
+ def select(*args, &block); end
554
+ def select!(*args, &block); end
555
+ def shelljoin(*args, &block); end
556
+ def shift(*args, &block); end
557
+ def shuffle(*args, &block); end
558
+ def shuffle!(*args, &block); end
559
+ def size(*args, &block); end
560
+ def slice(*args, &block); end
561
+ def slice!(*args, &block); end
562
+ def slice_after(*args, &block); end
563
+ def slice_before(*args, &block); end
564
+ def slice_when(*args, &block); end
565
+ def sort(*args, &block); end
566
+ def sort!(*args, &block); end
567
+ def sort_by(*args, &block); end
568
+ def sort_by!(*args, &block); end
569
+ def sum(*args, &block); end
570
+ def take(*args, &block); end
571
+ def take_while(*args, &block); end
572
+ def tally(*args, &block); end
573
+ def to_ary(*args, &block); end
574
+ def to_default_s(*args, &block); end
575
+ def to_formatted_s(*args, &block); end
576
+ def to_fs(*args, &block); end
577
+ def to_h(*args, &block); end
578
+ def to_sentence(*args, &block); end
579
+ def to_set(*args, &block); end
580
+ def to_xml(*args, &block); end
581
+ def transpose(*args, &block); end
582
+ def union(*args, &block); end
583
+ def uniq(*args, &block); end
584
+ def uniq!(*args, &block); end
585
+ def unshift(*args, &block); end
586
+ def values_at(*args, &block); end
587
+ def zip(*args, &block); end
588
+ def |(*args, &block); end
589
+ end
590
+
591
+ RuboCop::AST::CollectionNode::ARRAY_METHODS = T.let(T.unsafe(nil), Array)
592
+
593
+ # Common functionality for nodes that have conditions:
594
+ # `if`, `while`, `until`, `case`.
595
+ # This currently doesn't include `when` nodes, because they have multiple
596
+ # conditions, and need to be checked for that.
597
+ module RuboCop::AST::ConditionalNode
598
+ # Returns the body associated with the condition. This works together with
599
+ # each node's custom destructuring method to select the correct part of
600
+ # the node.
601
+ #
602
+ # @note For `if` nodes, this is the truthy branch.
603
+ # @return [Node, nil] the body of the node
604
+ def body; end
605
+
606
+ # Returns the condition of the node. This works together with each node's
607
+ # custom destructuring method to select the correct part of the node.
608
+ #
609
+ # @return [Node, nil] the condition of the node
610
+ def condition; end
611
+
612
+ # Checks whether the condition of the node is written on more than
613
+ # one line.
614
+ #
615
+ # @return [Boolean] whether the condition is on more than one line
616
+ def multiline_condition?; end
617
+
618
+ # Checks whether the condition of the node is written on a single line.
619
+ #
620
+ # @return [Boolean] whether the condition is on a single line
621
+ def single_line_condition?; end
622
+ end
623
+
624
+ # A node extension for `const` nodes.
625
+ class RuboCop::AST::ConstNode < ::RuboCop::AST::Node
626
+ # @return [Boolean] if the constant starts with `::` (aka s(:cbase))
627
+ def absolute?; end
628
+
629
+ # @return [Boolean] if the constant is a Module / Class, according to the standard convention.
630
+ # Note: some classes might have uppercase in which case this method
631
+ # returns false
632
+ def class_name?; end
633
+
634
+ # Yield nodes for the namespace
635
+ #
636
+ # For `::Foo::Bar::BAZ` => yields:
637
+ # s(:cbase), then
638
+ # s(:const, :Foo), then
639
+ # s(:const, s(:const, :Foo), :Bar)
640
+ def each_path(&block); end
641
+
642
+ # @return [Boolean] if the constant is a Module / Class, according to the standard convention.
643
+ # Note: some classes might have uppercase in which case this method
644
+ # returns false
645
+ def module_name?; end
646
+
647
+ # @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
648
+ def namespace; end
649
+
650
+ # @return [Boolean] if the constant does not start with `::` (aka s(:cbase))
651
+ def relative?; end
652
+
653
+ # @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => :Bar
654
+ def short_name; end
655
+ end
656
+
657
+ # A node extension for `def` nodes. This will be used in place of a plain
658
+ # node when the builder constructs the AST, making its methods available
659
+ # to all `def` nodes within RuboCop.
660
+ class RuboCop::AST::DefNode < ::RuboCop::AST::Node
661
+ include ::RuboCop::AST::ParameterizedNode
662
+ include ::RuboCop::AST::MethodIdentifierPredicates
663
+
664
+ # Checks whether this method definition node forwards its arguments
665
+ # as per the feature added in Ruby 2.7.
666
+ #
667
+ # @note This is written in a way that may support lead arguments
668
+ # which are rumored to be added in a later version of Ruby.
669
+ # @return [Boolean] whether the `def` node uses argument forwarding
670
+ def argument_forwarding?; end
671
+
672
+ # An array containing the arguments of the method definition.
673
+ #
674
+ # @return [Array<Node>] the arguments of the method definition
675
+ def arguments; end
676
+
677
+ # The body of the method definition.
678
+ #
679
+ # @note this can be either a `begin` node, if the method body contains
680
+ # multiple expressions, or any other node, if it contains a single
681
+ # expression.
682
+ # @return [Node] the body of the method definition
683
+ def body; end
684
+
685
+ # @return [Boolean] if the definition is without an `end` or not.
686
+ def endless?; end
687
+
688
+ # The name of the defined method as a symbol.
689
+ #
690
+ # @return [Symbol] the name of the defined method
691
+ def method_name; end
692
+
693
+ # The receiver of the method definition, if any.
694
+ #
695
+ # @return [Node, nil] the receiver of the method definition, or `nil`.
696
+ def receiver; end
697
+
698
+ # Checks whether this node body is a void context.
699
+ #
700
+ # @return [Boolean] whether the `def` node body is a void context
701
+ def void_context?; end
702
+ end
703
+
704
+ # A node extension for `defined?` nodes. This will be used in place of a
705
+ # plain node when the builder constructs the AST, making its methods
706
+ # available to all `send` nodes within RuboCop.
707
+ class RuboCop::AST::DefinedNode < ::RuboCop::AST::Node
708
+ include ::RuboCop::AST::ParameterizedNode
709
+ include ::RuboCop::AST::MethodIdentifierPredicates
710
+ include ::RuboCop::AST::MethodDispatchNode
711
+
712
+ def arguments; end
713
+ def node_parts; end
714
+ end
715
+
716
+ # Common functionality for primitive literal nodes: `sym`, `str`,
717
+ # `int`, `float`, ...
718
+ module RuboCop::AST::Descendence
719
+ # Returns an array of child nodes.
720
+ # This is a shorthand for `node.each_child_node.to_a`.
721
+ #
722
+ # @return [Array<Node>] an array of child nodes
723
+ def child_nodes; end
724
+
725
+ # Returns an array of descendant nodes.
726
+ # This is a shorthand for `node.each_descendant.to_a`.
727
+ #
728
+ # @return [Array<Node>] an array of descendant nodes
729
+ def descendants; end
730
+
731
+ # Calls the given block for each child node.
732
+ # If no block is given, an `Enumerator` is returned.
733
+ #
734
+ # Note that this is different from `node.children.each { |child| ... }`
735
+ # which yields all children including non-node elements.
736
+ #
737
+ # @overload each_child_node
738
+ # @overload each_child_node
739
+ # @return [self] if a block is given
740
+ # @return [Enumerator] if no block is given
741
+ # @yieldparam node [Node] each child node
742
+ def each_child_node(*types); end
743
+
744
+ # Calls the given block for each descendant node with depth first order.
745
+ # If no block is given, an `Enumerator` is returned.
746
+ #
747
+ # @overload each_descendant
748
+ # @overload each_descendant
749
+ # @overload each_descendant
750
+ # @return [self] if a block is given
751
+ # @return [Enumerator] if no block is given
752
+ # @yieldparam node [Node] each descendant node
753
+ def each_descendant(*types, &block); end
754
+
755
+ # Calls the given block for the receiver and each descendant node in
756
+ # depth-first order.
757
+ # If no block is given, an `Enumerator` is returned.
758
+ #
759
+ # This method would be useful when you treat the receiver node as the root
760
+ # of a tree and want to iterate over all nodes in the tree.
761
+ #
762
+ # @overload each_node
763
+ # @overload each_node
764
+ # @overload each_node
765
+ # @return [self] if a block is given
766
+ # @return [Enumerator] if no block is given
767
+ # @yieldparam node [Node] each node
768
+ def each_node(*types, &block); end
769
+
770
+ protected
771
+
772
+ def visit_descendants(types, &block); end
773
+ end
774
+
775
+ # A node extension for `dstr` nodes. This will be used
776
+ # in place of a plain node when the builder constructs the AST, making
777
+ # its methods available to all `dstr` nodes within RuboCop.
778
+ class RuboCop::AST::DstrNode < ::RuboCop::AST::StrNode
779
+ def value; end
780
+ end
781
+
782
+ # A node extension for `ensure` nodes. This will be used in place of a plain
783
+ # node when the builder constructs the AST, making its methods available
784
+ # to all `ensure` nodes within RuboCop.
785
+ class RuboCop::AST::EnsureNode < ::RuboCop::AST::Node
786
+ # Returns the body of the `ensure` clause.
787
+ #
788
+ # @return [Node, nil] The body of the `ensure`.
789
+ def body; end
790
+ end
791
+
792
+ module RuboCop::AST::Ext; end
793
+
794
+ # Extensions to Parser::AST::Range
795
+ module RuboCop::AST::Ext::Range
796
+ # If `exclude_end` is `true`, then the range will be exclusive.
797
+ #
798
+ # Assume that `node` corresponds to the following array literal:
799
+ #
800
+ # [
801
+ # :foo,
802
+ # :bar
803
+ # ]
804
+ #
805
+ # node.loc.begin.line_span # => 1..1
806
+ # node.loc.expression.line_span(exclude_end: true) # => 1...4
807
+ #
808
+ # @return [Range] the range of line numbers for the node
809
+ def line_span(exclude_end: T.unsafe(nil)); end
810
+ end
811
+
812
+ # Refinement to circumvent broken `Range#minmax` for infinity ranges in 2.6-
813
+ module RuboCop::AST::Ext::RangeMinMax; end
814
+
815
+ # A node extension for `float` nodes. This will be used in place of a plain
816
+ # node when the builder constructs the AST, making its methods available to
817
+ # all `float` nodes within RuboCop.
818
+ class RuboCop::AST::FloatNode < ::RuboCop::AST::Node
819
+ include ::RuboCop::AST::BasicLiteralNode
820
+ include ::RuboCop::AST::NumericNode
821
+ end
822
+
823
+ # A node extension for `for` nodes. This will be used in place of a plain
824
+ # node when the builder constructs the AST, making its methods available
825
+ # to all `for` nodes within RuboCop.
826
+ class RuboCop::AST::ForNode < ::RuboCop::AST::Node
827
+ # Returns the body of the `for` loop.
828
+ #
829
+ # @return [Node, nil] The body of the `for` loop.
830
+ def body; end
831
+
832
+ # Returns the collection the `for` loop is iterating over.
833
+ #
834
+ # @return [Node] The collection the `for` loop is iterating over
835
+ def collection; end
836
+
837
+ # Checks whether the `for` node has a `do` keyword.
838
+ #
839
+ # @return [Boolean] whether the `for` node has a `do` keyword
840
+ def do?; end
841
+
842
+ # Returns the keyword of the `for` statement as a string.
843
+ #
844
+ # @return [String] the keyword of the `until` statement
845
+ def keyword; end
846
+
847
+ # Returns the iteration variable of the `for` loop.
848
+ #
849
+ # @return [Node] The iteration variable of the `for` loop
850
+ def variable; end
851
+
852
+ # Checks whether this node body is a void context.
853
+ # Always `true` for `for`.
854
+ #
855
+ # @return [true] whether the `for` node body is a void context
856
+ def void_context?; end
857
+ end
858
+
859
+ # A node extension for `forward-args` nodes. This will be used in place
860
+ # of a plain node when the builder constructs the AST, making its methods
861
+ # available to all `forward-args` nodes within RuboCop.
862
+ #
863
+ # Not used with modern emitters:
864
+ #
865
+ # $ ruby-parse -e "def foo(...); end"
866
+ # (def :foo
867
+ # (args
868
+ # (forward-arg)) nil)
869
+ # $ ruby-parse --legacy -e "->(foo) { bar }"
870
+ # (def :foo
871
+ # (forward-args) nil)
872
+ #
873
+ # Note the extra 's' with legacy form.
874
+ #
875
+ # The main RuboCop runs in legacy mode; this node is only used
876
+ # if user `AST::Builder.modernize` or `AST::Builder.emit_lambda=true`
877
+ class RuboCop::AST::ForwardArgsNode < ::RuboCop::AST::Node
878
+ include ::RuboCop::AST::CollectionNode
879
+
880
+ # Node wraps itself in an array to be compatible with other
881
+ # enumerable argument types.
882
+ def to_a; end
883
+ end
884
+
885
+ # Common functionality for nodes that can be used as hash elements:
886
+ # `pair`, `kwsplat`
887
+ module RuboCop::AST::HashElementNode
888
+ # Returns the delta between this element's delimiter and the argument's.
889
+ #
890
+ # @note Pairs with different delimiter styles return a delta of 0
891
+ # @return [Integer] the delta between the two delimiters
892
+ def delimiter_delta(other); end
893
+
894
+ # Returns the key of this `hash` element.
895
+ #
896
+ # @note For keyword splats, this returns the whole node
897
+ # @return [Node] the key of the hash element
898
+ def key; end
899
+
900
+ # Returns the delta between this pair's key and the argument pair's.
901
+ #
902
+ # @note Keys on the same line always return a delta of 0
903
+ # @note Keyword splats always return a delta of 0 for right alignment
904
+ # @param alignment [Symbol] whether to check the left or right side
905
+ # @return [Integer] the delta between the two keys
906
+ def key_delta(other, alignment = T.unsafe(nil)); end
907
+
908
+ # Checks whether this `hash` element is on the same line as `other`.
909
+ #
910
+ # @note A multiline element is considered to be on the same line if it
911
+ # shares any of its lines with `other`
912
+ # @return [Boolean] whether this element is on the same line as `other`
913
+ def same_line?(other); end
914
+
915
+ # Returns the value of this `hash` element.
916
+ #
917
+ # @note For keyword splats, this returns the whole node
918
+ # @return [Node] the value of the hash element
919
+ def value; end
920
+
921
+ # Returns the delta between this element's value and the argument's.
922
+ #
923
+ # @note Keyword splats always return a delta of 0
924
+ # @return [Integer] the delta between the two values
925
+ def value_delta(other); end
926
+ end
927
+
928
+ # A helper class for comparing the positions of different parts of a
929
+ # `pair` node.
930
+ class RuboCop::AST::HashElementNode::HashElementDelta
931
+ # @raise [ArgumentError]
932
+ # @return [HashElementDelta] a new instance of HashElementDelta
933
+ def initialize(first, second); end
934
+
935
+ def delimiter_delta; end
936
+ def key_delta(alignment = T.unsafe(nil)); end
937
+ def value_delta; end
938
+
939
+ private
940
+
941
+ def delta(first, second, alignment = T.unsafe(nil)); end
942
+
943
+ # Returns the value of attribute first.
944
+ def first; end
945
+
946
+ # @return [Boolean]
947
+ def keyword_splat?; end
948
+
949
+ # Returns the value of attribute second.
950
+ def second; end
951
+
952
+ # @return [Boolean]
953
+ def valid_argument_types?; end
954
+ end
955
+
956
+ # A node extension for `hash` nodes. This will be used in place of a plain
957
+ # node when the builder constructs the AST, making its methods available
958
+ # to all `hash` nodes within RuboCop.
959
+ class RuboCop::AST::HashNode < ::RuboCop::AST::Node
960
+ # Checks whether the `hash` literal is delimited by curly braces.
961
+ #
962
+ # @return [Boolean] whether the `hash` literal is enclosed in braces
963
+ def braces?; end
964
+
965
+ # Calls the given block for each `key` node in the `hash` literal.
966
+ # If no block is given, an `Enumerator` is returned.
967
+ #
968
+ # @note `kwsplat` nodes are ignored.
969
+ # @return [self] if a block is given
970
+ # @return [Enumerator] if no block is given
971
+ def each_key(&block); end
972
+
973
+ # Calls the given block for each `pair` node in the `hash` literal.
974
+ # If no block is given, an `Enumerator` is returned.
975
+ #
976
+ # @note `kwsplat` nodes are ignored.
977
+ # @return [self] if a block is given
978
+ # @return [Enumerator] if no block is given
979
+ def each_pair; end
980
+
981
+ # Calls the given block for each `value` node in the `hash` literal.
982
+ # If no block is given, an `Enumerator` is returned.
983
+ #
984
+ # @note `kwsplat` nodes are ignored.
985
+ # @return [self] if a block is given
986
+ # @return [Enumerator] if no block is given
987
+ def each_value(&block); end
988
+
989
+ # Checks whether the `hash` node contains any `pair`- or `kwsplat` nodes.
990
+ #
991
+ # @return[Boolean] whether the `hash` is empty
992
+ #
993
+ # @return [Boolean]
994
+ def empty?; end
995
+
996
+ # Returns an array of all the keys in the `hash` literal.
997
+ #
998
+ # @note `kwsplat` nodes are ignored.
999
+ # @return [Array<Node>] an array of keys in the `hash` literal
1000
+ def keys; end
1001
+
1002
+ # Checks whether this `hash` uses a mix of hash rocket and colon
1003
+ # delimiters for its pairs.
1004
+ #
1005
+ # @note `kwsplat` nodes are ignored.
1006
+ # @return [Boolean] whether the `hash` uses mixed delimiters
1007
+ def mixed_delimiters?; end
1008
+
1009
+ # Returns an array of all the key value pairs in the `hash` literal.
1010
+ #
1011
+ # ignored.
1012
+ #
1013
+ # @note this may be different from children as `kwsplat` nodes are
1014
+ # @return [Array<PairNode>] an array of `pair` nodes
1015
+ def pairs; end
1016
+
1017
+ # Checks whether any of the key value pairs in the `hash` literal are on
1018
+ # the same line.
1019
+ #
1020
+ # @note A multiline `pair` is considered to be on the same line if it
1021
+ # shares any of its lines with another `pair`
1022
+ # @note `kwsplat` nodes are ignored.
1023
+ # @return [Boolean] whether any `pair` nodes are on the same line
1024
+ def pairs_on_same_line?; end
1025
+
1026
+ # Returns an array of all the values in the `hash` literal.
1027
+ #
1028
+ # @note `kwsplat` nodes are ignored.
1029
+ # @return [Array<Node>] an array of values in the `hash` literal
1030
+ def values; end
1031
+ end
1032
+
1033
+ # A node extension for `if` nodes. This will be used in place of a plain
1034
+ # node when the builder constructs the AST, making its methods available
1035
+ # to all `if` nodes within RuboCop.
1036
+ class RuboCop::AST::IfNode < ::RuboCop::AST::Node
1037
+ include ::RuboCop::AST::ConditionalNode
1038
+ include ::RuboCop::AST::ModifierNode
1039
+
1040
+ # Returns an array of all the branches in the conditional statement.
1041
+ #
1042
+ # @return [Array<Node>] an array of branch nodes
1043
+ def branches; end
1044
+
1045
+ # @deprecated Use `branches.each`
1046
+ def each_branch(&block); end
1047
+
1048
+ # Checks whether the `if` node has an `else` clause.
1049
+ #
1050
+ # @note This returns `true` for nodes containing an `elsif` clause.
1051
+ # This is legacy behavior, and many cops rely on it.
1052
+ # @return [Boolean] whether the node has an `else` clause
1053
+ def else?; end
1054
+
1055
+ # Returns the branch of the `if` node that gets evaluated when its
1056
+ # condition is falsey.
1057
+ #
1058
+ # @note This is normalized for `unless` nodes.
1059
+ # @return [Node] the falsey branch node of the `if` node
1060
+ # @return [nil] when there is no else branch
1061
+ def else_branch; end
1062
+
1063
+ # Checks whether the `if` is an `elsif`. Parser handles these by nesting
1064
+ # `if` nodes in the `else` branch.
1065
+ #
1066
+ # @return [Boolean] whether the node is an `elsif`
1067
+ def elsif?; end
1068
+
1069
+ # Checks whether the `if` node has at least one `elsif` branch. Returns
1070
+ # true if this `if` node itself is an `elsif`.
1071
+ #
1072
+ # @return [Boolean] whether the `if` node has at least one `elsif` branch
1073
+ def elsif_conditional?; end
1074
+
1075
+ # Checks whether this node is an `if` statement. (This is not true of
1076
+ # ternary operators and `unless` statements.)
1077
+ #
1078
+ # @return [Boolean] whether the node is an `if` statement
1079
+ def if?; end
1080
+
1081
+ # Returns the branch of the `if` node that gets evaluated when its
1082
+ # condition is truthy.
1083
+ #
1084
+ # @note This is normalized for `unless` nodes.
1085
+ # @return [Node] the truthy branch node of the `if` node
1086
+ # @return [nil] if the truthy branch is empty
1087
+ def if_branch; end
1088
+
1089
+ # Returns the inverse keyword of the `if` node as a string. Returns `if`
1090
+ # for `unless` nodes and vice versa. Returns an empty string for ternary
1091
+ # operators.
1092
+ #
1093
+ # @return [String] the inverse keyword of the `if` statement
1094
+ def inverse_keyword; end
1095
+
1096
+ # Returns the keyword of the `if` statement as a string. Returns an empty
1097
+ # string for ternary operators.
1098
+ #
1099
+ # @return [String] the keyword of the `if` statement
1100
+ def keyword; end
1101
+
1102
+ # Checks whether the `if` node is in a modifier form, i.e. a condition
1103
+ # trailing behind an expression. Only `if` and `unless` nodes without
1104
+ # other branches can be modifiers.
1105
+ #
1106
+ # @return [Boolean] whether the `if` node is a modifier
1107
+ def modifier_form?; end
1108
+
1109
+ # Chacks whether the `if` node has nested `if` nodes in any of its
1110
+ # branches.
1111
+ #
1112
+ # @note This performs a shallow search.
1113
+ # @return [Boolean] whether the `if` node contains nested conditionals
1114
+ def nested_conditional?; end
1115
+
1116
+ # Custom destructuring method. This is used to normalize the branches
1117
+ # for `if` and `unless` nodes, to aid comparisons and conversions.
1118
+ #
1119
+ # @return [Array<Node>] the different parts of the `if` statement
1120
+ def node_parts; end
1121
+
1122
+ # Checks whether the `if` node is a ternary operator.
1123
+ #
1124
+ # @return [Boolean] whether the `if` node is a ternary operator
1125
+ def ternary?; end
1126
+
1127
+ # Checks whether this node is an `unless` statement. (This is not true
1128
+ # of ternary operators and `if` statements.)
1129
+ #
1130
+ # @return [Boolean] whether the node is an `unless` statement
1131
+ def unless?; end
1132
+ end
1133
+
1134
+ # A node extension for `in` nodes. This will be used in place of a plain
1135
+ # node when the builder constructs the AST, making its methods available
1136
+ # to all `in` nodes within RuboCop.
1137
+ class RuboCop::AST::InPatternNode < ::RuboCop::AST::Node
1138
+ # Returns the body of the `in` node.
1139
+ #
1140
+ # @return [Node, nil] the body of the `in` node
1141
+ def body; end
1142
+
1143
+ # Returns the index of the `in` branch within the `case` statement.
1144
+ #
1145
+ # @return [Integer] the index of the `in` branch
1146
+ def branch_index; end
1147
+
1148
+ # Returns a node of the pattern in the `in` branch.
1149
+ #
1150
+ # @return [Node] a pattern node
1151
+ def pattern; end
1152
+
1153
+ # Checks whether the `in` node has a `then` keyword.
1154
+ #
1155
+ # @return [Boolean] whether the `in` node has a `then` keyword
1156
+ def then?; end
1157
+ end
1158
+
1159
+ # Used for modern support only!
1160
+ # Not as thoroughly tested as legacy equivalent
1161
+ #
1162
+ # $ ruby-parse -e "foo[:bar]"
1163
+ # (index
1164
+ # (send nil :foo)
1165
+ # (sym :bar))
1166
+ # $ ruby-parse --legacy -e "foo[:bar]"
1167
+ # (send
1168
+ # (send nil :foo) :[]
1169
+ # (sym :bar))
1170
+ #
1171
+ # The main RuboCop runs in legacy mode; this node is only used
1172
+ # if user `AST::Builder.modernize` or `AST::Builder.emit_index=true`
1173
+ class RuboCop::AST::IndexNode < ::RuboCop::AST::Node
1174
+ include ::RuboCop::AST::ParameterizedNode
1175
+ include ::RuboCop::AST::ParameterizedNode::RestArguments
1176
+ include ::RuboCop::AST::MethodIdentifierPredicates
1177
+ include ::RuboCop::AST::MethodDispatchNode
1178
+
1179
+ # For similarity with legacy mode
1180
+ #
1181
+ # @return [Boolean]
1182
+ def assignment_method?; end
1183
+
1184
+ # For similarity with legacy mode
1185
+ #
1186
+ # @return [Boolean]
1187
+ def attribute_accessor?; end
1188
+
1189
+ # For similarity with legacy mode
1190
+ def method_name; end
1191
+
1192
+ private
1193
+
1194
+ # An array containing the arguments of the dispatched method.
1195
+ #
1196
+ # @return [Array<Node>] the arguments of the dispatched method
1197
+ def first_argument_index; end
1198
+ end
1199
+
1200
+ # Used for modern support only!
1201
+ # Not as thoroughly tested as legacy equivalent
1202
+ #
1203
+ # $ ruby-parse -e "foo[:bar] = :baz"
1204
+ # (indexasgn
1205
+ # (send nil :foo)
1206
+ # (sym :bar)
1207
+ # (sym :baz))
1208
+ # $ ruby-parse --legacy -e "foo[:bar] = :baz"
1209
+ # (send
1210
+ # (send nil :foo) :[]=
1211
+ # (sym :bar)
1212
+ # (sym :baz))
1213
+ #
1214
+ # The main RuboCop runs in legacy mode; this node is only used
1215
+ # if user `AST::Builder.modernize` or `AST::Builder.emit_index=true`
1216
+ class RuboCop::AST::IndexasgnNode < ::RuboCop::AST::Node
1217
+ include ::RuboCop::AST::ParameterizedNode
1218
+ include ::RuboCop::AST::ParameterizedNode::RestArguments
1219
+ include ::RuboCop::AST::MethodIdentifierPredicates
1220
+ include ::RuboCop::AST::MethodDispatchNode
1221
+
1222
+ # For similarity with legacy mode
1223
+ #
1224
+ # @return [Boolean]
1225
+ def assignment_method?; end
1226
+
1227
+ # For similarity with legacy mode
1228
+ #
1229
+ # @return [Boolean]
1230
+ def attribute_accessor?; end
1231
+
1232
+ # For similarity with legacy mode
1233
+ def method_name; end
1234
+
1235
+ private
1236
+
1237
+ # An array containing the arguments of the dispatched method.
1238
+ #
1239
+ # @return [Array<Node>] the arguments of the dispatched method
1240
+ def first_argument_index; end
1241
+ end
1242
+
1243
+ # A node extension for `int` nodes. This will be used in place of a plain
1244
+ # node when the builder constructs the AST, making its methods available to
1245
+ # all `int` nodes within RuboCop.
1246
+ class RuboCop::AST::IntNode < ::RuboCop::AST::Node
1247
+ include ::RuboCop::AST::BasicLiteralNode
1248
+ include ::RuboCop::AST::NumericNode
1249
+ end
1250
+
1251
+ # A node extension for `kwsplat` nodes. This will be used in place of a
1252
+ # plain node when the builder constructs the AST, making its methods
1253
+ # available to all `kwsplat` nodes within RuboCop.
1254
+ class RuboCop::AST::KeywordSplatNode < ::RuboCop::AST::Node
1255
+ include ::RuboCop::AST::HashElementNode
1256
+
1257
+ # This is used for duck typing with `pair` nodes which also appear as
1258
+ # `hash` elements.
1259
+ #
1260
+ # @return [false]
1261
+ def colon?; end
1262
+
1263
+ # This is used for duck typing with `pair` nodes which also appear as
1264
+ # `hash` elements.
1265
+ #
1266
+ # @return [false]
1267
+ def hash_rocket?; end
1268
+
1269
+ # Custom destructuring method. This is used to normalize the branches
1270
+ # for `pair` and `kwsplat` nodes, to add duck typing to `hash` elements.
1271
+ #
1272
+ # @return [Array<KeywordSplatNode>] the different parts of the `kwsplat`
1273
+ def node_parts; end
1274
+
1275
+ # Returns the operator for the `kwsplat` as a string.
1276
+ #
1277
+ # @return [String] the double splat operator
1278
+ def operator; end
1279
+ end
1280
+
1281
+ RuboCop::AST::KeywordSplatNode::DOUBLE_SPLAT = T.let(T.unsafe(nil), String)
1282
+
1283
+ # Used for modern support only:
1284
+ # Not as thoroughly tested as legacy equivalent
1285
+ #
1286
+ # $ ruby-parse -e "->(foo) { bar }"
1287
+ # (block
1288
+ # (lambda)
1289
+ # (args
1290
+ # (arg :foo))
1291
+ # (send nil :bar))
1292
+ # $ ruby-parse --legacy -e "->(foo) { bar }"
1293
+ # (block
1294
+ # (send nil :lambda)
1295
+ # (args
1296
+ # (arg :foo))
1297
+ # (send nil :bar))
1298
+ #
1299
+ # The main RuboCop runs in legacy mode; this node is only used
1300
+ # if user `AST::Builder.modernize` or `AST::Builder.emit_lambda=true`
1301
+ class RuboCop::AST::LambdaNode < ::RuboCop::AST::Node
1302
+ include ::RuboCop::AST::ParameterizedNode
1303
+ include ::RuboCop::AST::ParameterizedNode::RestArguments
1304
+ include ::RuboCop::AST::MethodIdentifierPredicates
1305
+ include ::RuboCop::AST::MethodDispatchNode
1306
+
1307
+ # For similarity with legacy mode
1308
+ #
1309
+ # @return [Boolean]
1310
+ def assignment_method?; end
1311
+
1312
+ # For similarity with legacy mode
1313
+ #
1314
+ # @return [Boolean]
1315
+ def attribute_accessor?; end
1316
+
1317
+ # For similarity with legacy mode
1318
+ #
1319
+ # @return [Boolean]
1320
+ def lambda?; end
1321
+
1322
+ # For similarity with legacy mode
1323
+ #
1324
+ # @return [Boolean]
1325
+ def lambda_literal?; end
1326
+
1327
+ # For similarity with legacy mode
1328
+ def method_name; end
1329
+
1330
+ # For similarity with legacy mode
1331
+ def receiver; end
1332
+
1333
+ private
1334
+
1335
+ # For similarity with legacy mode
1336
+ def first_argument_index; end
1337
+ end
1338
+
1339
+ # Common functionality for nodes that are a kind of method dispatch:
1340
+ # `send`, `csend`, `super`, `zsuper`, `yield`, `defined?`,
1341
+ # and (modern only): `index`, `indexasgn`, `lambda`
1342
+ module RuboCop::AST::MethodDispatchNode
1343
+ include ::RuboCop::AST::MethodIdentifierPredicates
1344
+ extend ::RuboCop::AST::NodePattern::Macros
1345
+
1346
+ # Checks whether the dispatched method is an access modifier.
1347
+ #
1348
+ # @return [Boolean] whether the dispatched method is an access modifier
1349
+ def access_modifier?; end
1350
+
1351
+ def adjacent_def_modifier?(param0 = T.unsafe(nil)); end
1352
+
1353
+ # Checks whether this node is an arithmetic operation
1354
+ #
1355
+ # @return [Boolean] whether the dispatched method is an arithmetic
1356
+ # operation
1357
+ def arithmetic_operation?; end
1358
+
1359
+ # Checks whether the dispatched method is a setter method.
1360
+ #
1361
+ # @return [Boolean] whether the dispatched method is a setter
1362
+ def assignment?; end
1363
+
1364
+ # Checks whether the dispatched method is a bare access modifier that
1365
+ # affects all methods defined after the macro.
1366
+ #
1367
+ # @return [Boolean] whether the dispatched method is a bare
1368
+ # access modifier
1369
+ def bare_access_modifier?; end
1370
+
1371
+ def bare_access_modifier_declaration?(param0 = T.unsafe(nil)); end
1372
+
1373
+ # Checks whether this is a binary operation.
1374
+ #
1375
+ # @example
1376
+ #
1377
+ # foo + bar
1378
+ # @return [Bookean] whether this method is a binary operation
1379
+ def binary_operation?; end
1380
+
1381
+ # Whether this method dispatch has an explicit block.
1382
+ #
1383
+ # @return [Boolean] whether the dispatched method has a block
1384
+ def block_literal?; end
1385
+
1386
+ # The `block` or `numblock` node associated with this method dispatch, if any.
1387
+ #
1388
+ # @return [BlockNode, nil] the `block` or `numblock` node associated with this method
1389
+ # call or `nil`
1390
+ def block_node; end
1391
+
1392
+ # Checks whether the name of the dispatched method matches the argument
1393
+ # and has an implicit receiver.
1394
+ #
1395
+ # @param name [Symbol, String] the method name to check for
1396
+ # @return [Boolean] whether the method name matches the argument
1397
+ def command?(name); end
1398
+
1399
+ # Checks whether the *explicit* receiver of this method dispatch is a
1400
+ # `const` node.
1401
+ #
1402
+ # @return [Boolean] whether the receiver of this method dispatch
1403
+ # is a `const` node
1404
+ def const_receiver?; end
1405
+
1406
+ # Checks if this node is part of a chain of `def` or `defs` modifiers.
1407
+ #
1408
+ # or `nil` if it isn't a def modifier
1409
+ #
1410
+ # @example
1411
+ #
1412
+ # private def foo; end
1413
+ # @return [Node | nil] returns the `def|defs` node this is a modifier for,
1414
+ def def_modifier(node = T.unsafe(nil)); end
1415
+
1416
+ # Checks if this node is part of a chain of `def` or `defs` modifiers.
1417
+ #
1418
+ # See also `def_modifier` that returns the node or `nil`
1419
+ #
1420
+ # @example
1421
+ #
1422
+ # private def foo; end
1423
+ # @return [Boolean] whether the `def|defs` node is a modifier or not.
1424
+ def def_modifier?(node = T.unsafe(nil)); end
1425
+
1426
+ # Checks whether the dispatched method uses a dot to connect the
1427
+ # receiver and the method name.
1428
+ #
1429
+ # This is useful for comparison operators, which can be called either
1430
+ # with or without a dot, i.e. `foo == bar` or `foo.== bar`.
1431
+ #
1432
+ # @return [Boolean] whether the method was called with a connecting dot
1433
+ def dot?; end
1434
+
1435
+ # Checks whether the dispatched method uses a double colon to connect the
1436
+ # receiver and the method name.
1437
+ #
1438
+ # @return [Boolean] whether the method was called with a connecting dot
1439
+ def double_colon?; end
1440
+
1441
+ # Checks whether the method dispatch is the implicit form of `#call`,
1442
+ # e.g. `foo.(bar)`.
1443
+ #
1444
+ # @return [Boolean] whether the method is the implicit form of `#call`
1445
+ def implicit_call?; end
1446
+
1447
+ def in_macro_scope?(param0 = T.unsafe(nil)); end
1448
+
1449
+ # Checks whether this is a lambda. Some versions of parser parses
1450
+ # non-literal lambdas as a method send.
1451
+ #
1452
+ # @return [Boolean] whether this method is a lambda
1453
+ def lambda?; end
1454
+
1455
+ # Checks whether this is a lambda literal (stabby lambda.)
1456
+ #
1457
+ # @example
1458
+ #
1459
+ # -> (foo) { bar }
1460
+ # @return [Boolean] whether this method is a lambda literal
1461
+ def lambda_literal?; end
1462
+
1463
+ # Checks whether the dispatched method is a macro method. A macro method
1464
+ # is defined as a method that sits in a class, module, or block body and
1465
+ # has an implicit receiver.
1466
+ #
1467
+ # @note This does not include DSLs that use nested blocks, like RSpec
1468
+ # @return [Boolean] whether the dispatched method is a macro method
1469
+ def macro?; end
1470
+
1471
+ # The name of the dispatched method as a symbol.
1472
+ #
1473
+ # @return [Symbol] the name of the dispatched method
1474
+ def method_name; end
1475
+
1476
+ # Checks whether the dispatched method is a non-bare access modifier that
1477
+ # affects only the method it receives.
1478
+ #
1479
+ # @return [Boolean] whether the dispatched method is a non-bare
1480
+ # access modifier
1481
+ def non_bare_access_modifier?; end
1482
+
1483
+ def non_bare_access_modifier_declaration?(param0 = T.unsafe(nil)); end
1484
+
1485
+ # The receiving node of the method dispatch.
1486
+ #
1487
+ # @return [Node, nil] the receiver of the dispatched method or `nil`
1488
+ def receiver; end
1489
+
1490
+ # Checks whether the dispatched method uses a safe navigation operator to
1491
+ # connect the receiver and the method name.
1492
+ #
1493
+ # @return [Boolean] whether the method was called with a connecting dot
1494
+ def safe_navigation?; end
1495
+
1496
+ # Checks whether the *explicit* receiver of this method dispatch is
1497
+ # `self`.
1498
+ #
1499
+ # @return [Boolean] whether the receiver of this method dispatch is `self`
1500
+ def self_receiver?; end
1501
+
1502
+ # Checks whether the dispatched method is a setter method.
1503
+ #
1504
+ # @return [Boolean] whether the dispatched method is a setter
1505
+ def setter_method?; end
1506
+
1507
+ # Checks whether the dispatched method is a bare `private` or `protected`
1508
+ # access modifier that affects all methods defined after the macro.
1509
+ #
1510
+ # @return [Boolean] whether the dispatched method is a bare
1511
+ # `private` or `protected` access modifier
1512
+ def special_modifier?; end
1513
+
1514
+ # Checks whether this is a unary operation.
1515
+ #
1516
+ # @example
1517
+ #
1518
+ # -foo
1519
+ # @return [Boolean] whether this method is a unary operation
1520
+ def unary_operation?; end
1521
+ end
1522
+
1523
+ RuboCop::AST::MethodDispatchNode::ARITHMETIC_OPERATORS = T.let(T.unsafe(nil), Array)
1524
+ RuboCop::AST::MethodDispatchNode::SPECIAL_MODIFIERS = T.let(T.unsafe(nil), Array)
1525
+
1526
+ # Common predicates for nodes that reference method identifiers:
1527
+ # `send`, `csend`, `def`, `defs`, `super`, `zsuper`
1528
+ #
1529
+ # @note this mixin expects `#method_name` and `#receiver` to be implemented
1530
+ module RuboCop::AST::MethodIdentifierPredicates
1531
+ # Checks whether the method is an assignment method.
1532
+ #
1533
+ # @return [Boolean] whether the method is an assignment
1534
+ def assignment_method?; end
1535
+
1536
+ # Checks whether the method is a bang method.
1537
+ #
1538
+ # @return [Boolean] whether the method is a bang method
1539
+ def bang_method?; end
1540
+
1541
+ # Checks whether the method is a camel case method,
1542
+ # e.g. `Integer()`.
1543
+ #
1544
+ # @return [Boolean] whether the method is a camel case method
1545
+ def camel_case_method?; end
1546
+
1547
+ # Checks whether the method is a comparison method.
1548
+ #
1549
+ # @return [Boolean] whether the method is a comparison
1550
+ def comparison_method?; end
1551
+
1552
+ # Checks whether the *explicit* receiver of node is a `const` node.
1553
+ #
1554
+ # @return [Boolean] whether the receiver of this node is a `const` node
1555
+ def const_receiver?; end
1556
+
1557
+ # Checks whether the method is an Enumerable method.
1558
+ #
1559
+ # @return [Boolean] whether the method is an Enumerable method
1560
+ def enumerable_method?; end
1561
+
1562
+ # Checks whether the method is an enumerator method.
1563
+ #
1564
+ # @return [Boolean] whether the method is an enumerator
1565
+ def enumerator_method?; end
1566
+
1567
+ # Checks whether the method name matches the argument.
1568
+ #
1569
+ # @param name [Symbol, String] the method name to check for
1570
+ # @return [Boolean] whether the method name matches the argument
1571
+ def method?(name); end
1572
+
1573
+ # Checks whether this is a negation method, i.e. `!` or keyword `not`.
1574
+ #
1575
+ # @return [Boolean] whether this method is a negation method
1576
+ def negation_method?; end
1577
+
1578
+ # Checks whether the method is a nonmutating Array method.
1579
+ #
1580
+ # @return [Boolean] whether the method is a nonmutating Array method
1581
+ def nonmutating_array_method?; end
1582
+
1583
+ # Checks whether the method is a nonmutating binary operator method.
1584
+ #
1585
+ # @return [Boolean] whether the method is a nonmutating binary operator method
1586
+ def nonmutating_binary_operator_method?; end
1587
+
1588
+ # Checks whether the method is a nonmutating Hash method.
1589
+ #
1590
+ # @return [Boolean] whether the method is a nonmutating Hash method
1591
+ def nonmutating_hash_method?; end
1592
+
1593
+ # Checks whether the method is a nonmutating operator method.
1594
+ #
1595
+ # @return [Boolean] whether the method is a nonmutating operator method
1596
+ def nonmutating_operator_method?; end
1597
+
1598
+ # Checks whether the method is a nonmutating String method.
1599
+ #
1600
+ # @return [Boolean] whether the method is a nonmutating String method
1601
+ def nonmutating_string_method?; end
1602
+
1603
+ # Checks whether the method is a nonmutating unary operator method.
1604
+ #
1605
+ # @return [Boolean] whether the method is a nonmutating unary operator method
1606
+ def nonmutating_unary_operator_method?; end
1607
+
1608
+ # Checks whether the method is an operator method.
1609
+ #
1610
+ # @return [Boolean] whether the method is an operator
1611
+ def operator_method?; end
1612
+
1613
+ # Checks whether the method is a predicate method.
1614
+ #
1615
+ # @return [Boolean] whether the method is a predicate method
1616
+ def predicate_method?; end
1617
+
1618
+ # Checks whether this is a prefix bang method, e.g. `!foo`.
1619
+ #
1620
+ # @return [Boolean] whether this method is a prefix bang
1621
+ def prefix_bang?; end
1622
+
1623
+ # Checks whether this is a prefix not method, e.g. `not foo`.
1624
+ #
1625
+ # @return [Boolean] whether this method is a prefix not
1626
+ def prefix_not?; end
1627
+
1628
+ # Checks whether the *explicit* receiver of this node is `self`.
1629
+ #
1630
+ # @return [Boolean] whether the receiver of this node is `self`
1631
+ def self_receiver?; end
1632
+ end
1633
+
1634
+ RuboCop::AST::MethodIdentifierPredicates::ENUMERABLE_METHODS = T.let(T.unsafe(nil), Set)
1635
+ RuboCop::AST::MethodIdentifierPredicates::ENUMERATOR_METHODS = T.let(T.unsafe(nil), Set)
1636
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_ARRAY_METHODS = T.let(T.unsafe(nil), Set)
1637
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_BINARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
1638
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_HASH_METHODS = T.let(T.unsafe(nil), Set)
1639
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
1640
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_STRING_METHODS = T.let(T.unsafe(nil), Set)
1641
+ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_UNARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
1642
+
1643
+ # http://phrogz.net/programmingruby/language.html#table_18.4
1644
+ RuboCop::AST::MethodIdentifierPredicates::OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
1645
+
1646
+ # Common functionality for nodes that can be used as modifiers:
1647
+ # `if`, `while`, `until`
1648
+ module RuboCop::AST::ModifierNode
1649
+ # Checks whether the node is in a modifier form, i.e. a condition
1650
+ # trailing behind an expression.
1651
+ #
1652
+ # @return [Boolean] whether the node is a modifier
1653
+ def modifier_form?; end
1654
+ end
1655
+
1656
+ # A node extension for `module` nodes. This will be used in place of a
1657
+ # plain node when the builder constructs the AST, making its methods
1658
+ # available to all `module` nodes within RuboCop.
1659
+ class RuboCop::AST::ModuleNode < ::RuboCop::AST::Node
1660
+ # The body of this `module` node.
1661
+ #
1662
+ # @return [Node, nil] the body of the module
1663
+ def body; end
1664
+
1665
+ # The identifier for this `module` node.
1666
+ #
1667
+ # @return [Node] the identifier of the module
1668
+ def identifier; end
1669
+ end
1670
+
1671
+ # A node extension for `next` nodes. This will be used in place of a
1672
+ # plain node when the builder constructs the AST, making its methods
1673
+ # available to all `next` nodes within RuboCop.
1674
+ class RuboCop::AST::NextNode < ::RuboCop::AST::Node
1675
+ include ::RuboCop::AST::ParameterizedNode
1676
+ include ::RuboCop::AST::ParameterizedNode::WrappedArguments
1677
+ end
1678
+
1679
+ # `RuboCop::AST::Node` is a subclass of `Parser::AST::Node`. It provides
1680
+ # access to parent nodes and an object-oriented way to traverse an AST with
1681
+ # the power of `Enumerable`.
1682
+ #
1683
+ # It has predicate methods for every node type, like this:
1684
+ #
1685
+ # @example
1686
+ # node.send_type? # Equivalent to: `node.type == :send`
1687
+ # node.op_asgn_type? # Equivalent to: `node.type == :op_asgn`
1688
+ #
1689
+ # # Non-word characters (other than a-zA-Z0-9_) in type names are omitted.
1690
+ # node.defined_type? # Equivalent to: `node.type == :defined?`
1691
+ #
1692
+ # # Find the first lvar node under the receiver node.
1693
+ # lvar_node = node.each_descendant.find(&:lvar_type?)
1694
+ class RuboCop::AST::Node < ::Parser::AST::Node
1695
+ include ::RuboCop::AST::Sexp
1696
+ include ::RuboCop::AST::Descendence
1697
+ extend ::RuboCop::AST::NodePattern::Macros
1698
+
1699
+ # @return [Node] a new instance of Node
1700
+ # @see https://www.rubydoc.info/gems/ast/AST/Node:initialize
1701
+ def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
1702
+
1703
+ def __ENCODING___type?; end
1704
+ def __FILE___type?; end
1705
+ def __LINE___type?; end
1706
+ def alias_type?; end
1707
+
1708
+ # Returns an array of ancestor nodes.
1709
+ # This is a shorthand for `node.each_ancestor.to_a`.
1710
+ #
1711
+ # @return [Array<Node>] an array of ancestor nodes
1712
+ def ancestors; end
1713
+
1714
+ def and_asgn_type?; end
1715
+ def and_type?; end
1716
+ def arg_expr_type?; end
1717
+ def arg_type?; end
1718
+ def args_type?; end
1719
+
1720
+ # @return [Boolean]
1721
+ def argument?; end
1722
+
1723
+ # @return [Boolean]
1724
+ def argument_type?; end
1725
+
1726
+ def array_pattern_type?; end
1727
+ def array_pattern_with_tail_type?; end
1728
+ def array_type?; end
1729
+
1730
+ # @return [Boolean]
1731
+ def assignment?; end
1732
+
1733
+ # Some cops treat the shovel operator as a kind of assignment.
1734
+ def assignment_or_similar?(param0 = T.unsafe(nil)); end
1735
+
1736
+ def back_ref_type?; end
1737
+
1738
+ # @return [Boolean]
1739
+ def basic_conditional?; end
1740
+
1741
+ # @return [Boolean]
1742
+ def basic_literal?; end
1743
+
1744
+ def begin_type?; end
1745
+ def block_pass_type?; end
1746
+ def block_type?; end
1747
+ def blockarg_expr_type?; end
1748
+ def blockarg_type?; end
1749
+
1750
+ # @return [Boolean]
1751
+ def boolean_type?; end
1752
+
1753
+ def break_type?; end
1754
+
1755
+ # @return [Boolean]
1756
+ def call_type?; end
1757
+
1758
+ def case_match_type?; end
1759
+ def case_type?; end
1760
+ def casgn_type?; end
1761
+ def cbase_type?; end
1762
+
1763
+ # @return [Boolean]
1764
+ def chained?; end
1765
+
1766
+ def class_constructor?(param0 = T.unsafe(nil)); end
1767
+ def class_definition?(param0 = T.unsafe(nil)); end
1768
+ def class_type?; end
1769
+ def complete!; end
1770
+
1771
+ # @return [Boolean]
1772
+ def complete?; end
1773
+
1774
+ def complex_type?; end
1775
+
1776
+ # @return [Boolean]
1777
+ def conditional?; end
1778
+
1779
+ def const_name; end
1780
+ def const_pattern_type?; end
1781
+ def const_type?; end
1782
+ def csend_type?; end
1783
+ def cvar_type?; end
1784
+ def cvasgn_type?; end
1785
+ def def_type?; end
1786
+ def defined_module; end
1787
+ def defined_module_name; end
1788
+ def defined_type?; end
1789
+ def defs_type?; end
1790
+ def dstr_type?; end
1791
+ def dsym_type?; end
1792
+
1793
+ # Calls the given block for each ancestor node from parent to root.
1794
+ # If no block is given, an `Enumerator` is returned.
1795
+ #
1796
+ # @overload each_ancestor
1797
+ # @overload each_ancestor
1798
+ # @overload each_ancestor
1799
+ # @return [self] if a block is given
1800
+ # @return [Enumerator] if no block is given
1801
+ # @yieldparam node [Node] each ancestor node
1802
+ def each_ancestor(*types, &block); end
1803
+
1804
+ def eflipflop_type?; end
1805
+ def empty_else_type?; end
1806
+
1807
+ # @return [Boolean]
1808
+ def empty_source?; end
1809
+
1810
+ def ensure_type?; end
1811
+
1812
+ # @return [Boolean]
1813
+ def equals_asgn?; end
1814
+
1815
+ def erange_type?; end
1816
+ def false_type?; end
1817
+
1818
+ # @return [Boolean]
1819
+ def falsey_literal?; end
1820
+
1821
+ def find_pattern_type?; end
1822
+ def first_line; end
1823
+ def float_type?; end
1824
+ def for_type?; end
1825
+ def forward_arg_type?; end
1826
+ def forward_args_type?; end
1827
+ def forwarded_args_type?; end
1828
+ def global_const?(param0 = T.unsafe(nil), param1); end
1829
+
1830
+ # @return [Boolean]
1831
+ def guard_clause?; end
1832
+
1833
+ def gvar_type?; end
1834
+ def gvasgn_type?; end
1835
+ def hash_pattern_type?; end
1836
+ def hash_type?; end
1837
+ def ident_type?; end
1838
+ def if_guard_type?; end
1839
+ def if_type?; end
1840
+ def iflipflop_type?; end
1841
+
1842
+ # @return [Boolean]
1843
+ def immutable_literal?; end
1844
+
1845
+ def in_match_type?; end
1846
+ def in_pattern_type?; end
1847
+ def index_type?; end
1848
+ def indexasgn_type?; end
1849
+ def int_type?; end
1850
+ def irange_type?; end
1851
+ def ivar_type?; end
1852
+ def ivasgn_type?; end
1853
+
1854
+ # @return [Boolean]
1855
+ def keyword?; end
1856
+
1857
+ def kwarg_type?; end
1858
+ def kwargs_type?; end
1859
+ def kwbegin_type?; end
1860
+ def kwnilarg_type?; end
1861
+ def kwoptarg_type?; end
1862
+ def kwrestarg_type?; end
1863
+ def kwsplat_type?; end
1864
+ def lambda?(param0 = T.unsafe(nil)); end
1865
+ def lambda_or_proc?(param0 = T.unsafe(nil)); end
1866
+ def lambda_type?; end
1867
+ def last_line; end
1868
+
1869
+ # Use is discouraged, this is a potentially slow method and can lead
1870
+ # to even slower algorithms
1871
+ #
1872
+ # @return [Node, nil] the left (aka previous) sibling
1873
+ def left_sibling; end
1874
+
1875
+ # Use is discouraged, this is a potentially slow method and can lead
1876
+ # to even slower algorithms
1877
+ #
1878
+ # @return [Array<Node>] the left (aka previous) siblings
1879
+ def left_siblings; end
1880
+
1881
+ def line_count; end
1882
+
1883
+ # @return [Boolean]
1884
+ def literal?; end
1885
+
1886
+ # NOTE: `loop { }` is a normal method call and thus not a loop keyword.
1887
+ #
1888
+ # @return [Boolean]
1889
+ def loop_keyword?; end
1890
+
1891
+ def lvar_type?; end
1892
+ def lvasgn_type?; end
1893
+ def masgn_type?; end
1894
+ def match_alt_type?; end
1895
+ def match_as_type?; end
1896
+ def match_current_line_type?; end
1897
+ def match_guard_clause?(param0 = T.unsafe(nil)); end
1898
+ def match_nil_pattern_type?; end
1899
+ def match_pattern_p_type?; end
1900
+ def match_pattern_type?; end
1901
+ def match_rest_type?; end
1902
+ def match_var_type?; end
1903
+ def match_with_lvasgn_type?; end
1904
+ def match_with_trailing_comma_type?; end
1905
+ def mlhs_type?; end
1906
+ def module_definition?(param0 = T.unsafe(nil)); end
1907
+ def module_type?; end
1908
+
1909
+ # Predicates
1910
+ #
1911
+ # @return [Boolean]
1912
+ def multiline?; end
1913
+
1914
+ # @return [Boolean]
1915
+ def mutable_literal?; end
1916
+
1917
+ def new_class_or_module_block?(param0 = T.unsafe(nil)); end
1918
+ def next_type?; end
1919
+ def nil_type?; end
1920
+
1921
+ # Common destructuring method. This can be used to normalize
1922
+ # destructuring for different variations of the node.
1923
+ # Some node types override this with their own custom
1924
+ # destructuring method.
1925
+ #
1926
+ # @return [Array<Node>] the different parts of the ndde
1927
+ def node_parts; end
1928
+
1929
+ def nonempty_line_count; end
1930
+ def not_type?; end
1931
+ def nth_ref_type?; end
1932
+ def numargs_type?; end
1933
+ def numblock_type?; end
1934
+
1935
+ # @return [Boolean]
1936
+ def numeric_type?; end
1937
+
1938
+ def objc_kwarg_type?; end
1939
+ def objc_restarg_type?; end
1940
+ def objc_varargs_type?; end
1941
+ def op_asgn_type?; end
1942
+
1943
+ # @return [Boolean]
1944
+ def operator_keyword?; end
1945
+
1946
+ def optarg_type?; end
1947
+ def or_asgn_type?; end
1948
+ def or_type?; end
1949
+ def pair_type?; end
1950
+
1951
+ # Returns the parent node, or `nil` if the receiver is a root node.
1952
+ #
1953
+ # @return [Node, nil] the parent node or `nil`
1954
+ def parent; end
1955
+
1956
+ # @return [Boolean]
1957
+ def parent?; end
1958
+
1959
+ # Searching the AST
1960
+ def parent_module_name; end
1961
+
1962
+ # @return [Boolean]
1963
+ def parenthesized_call?; end
1964
+
1965
+ def pin_type?; end
1966
+
1967
+ # @return [Boolean]
1968
+ def post_condition_loop?; end
1969
+
1970
+ def postexe_type?; end
1971
+ def preexe_type?; end
1972
+ def proc?(param0 = T.unsafe(nil)); end
1973
+ def procarg0_type?; end
1974
+
1975
+ # Some expressions are evaluated for their value, some for their side
1976
+ # effects, and some for both.
1977
+ # If we know that expressions are useful only for their return values,
1978
+ # and have no side effects, that means we can reorder them, change the
1979
+ # number of times they are evaluated, or replace them with other
1980
+ # expressions which are equivalent in value.
1981
+ # So, is evaluation of this node free of side effects?
1982
+ #
1983
+ # @return [Boolean]
1984
+ def pure?; end
1985
+
1986
+ # @return [Boolean]
1987
+ def range_type?; end
1988
+
1989
+ def rational_type?; end
1990
+ def receiver(param0 = T.unsafe(nil)); end
1991
+ def recursive_basic_literal?; end
1992
+ def recursive_literal?; end
1993
+ def redo_type?; end
1994
+
1995
+ # @return [Boolean]
1996
+ def reference?; end
1997
+
1998
+ def regexp_type?; end
1999
+ def regopt_type?; end
2000
+ def resbody_type?; end
2001
+ def rescue_type?; end
2002
+ def restarg_expr_type?; end
2003
+ def restarg_type?; end
2004
+ def retry_type?; end
2005
+ def return_type?; end
2006
+
2007
+ # Use is discouraged, this is a potentially slow method and can lead
2008
+ # to even slower algorithms
2009
+ #
2010
+ # @return [Node, nil] the right (aka next) sibling
2011
+ def right_sibling; end
2012
+
2013
+ # Use is discouraged, this is a potentially slow method and can lead
2014
+ # to even slower algorithms
2015
+ #
2016
+ # @return [Array<Node>] the right (aka next) siblings
2017
+ def right_siblings; end
2018
+
2019
+ # @return [Boolean]
2020
+ def root?; end
2021
+
2022
+ def sclass_type?; end
2023
+ def self_type?; end
2024
+ def send_type?; end
2025
+ def shadowarg_type?; end
2026
+
2027
+ # @return [Boolean]
2028
+ def shorthand_asgn?; end
2029
+
2030
+ # Returns the index of the receiver node in its siblings. (Sibling index
2031
+ # uses zero based numbering.)
2032
+ # Use is discouraged, this is a potentially slow method.
2033
+ #
2034
+ # @return [Integer, nil] the index of the receiver node in its siblings
2035
+ def sibling_index; end
2036
+
2037
+ # @return [Boolean]
2038
+ def single_line?; end
2039
+
2040
+ # NOTE: Some rare nodes may have no source, like `s(:args)` in `foo {}`
2041
+ #
2042
+ # @return [String, nil]
2043
+ def source; end
2044
+
2045
+ def source_length; end
2046
+ def source_range; end
2047
+
2048
+ # @return [Boolean]
2049
+ def special_keyword?; end
2050
+
2051
+ def splat_type?; end
2052
+ def str_content(param0 = T.unsafe(nil)); end
2053
+ def str_type?; end
2054
+
2055
+ # @deprecated Use `:class_constructor?`
2056
+ def struct_constructor?(param0 = T.unsafe(nil)); end
2057
+
2058
+ def super_type?; end
2059
+ def sym_type?; end
2060
+ def true_type?; end
2061
+
2062
+ # @return [Boolean]
2063
+ def truthy_literal?; end
2064
+
2065
+ def undef_type?; end
2066
+ def unless_guard_type?; end
2067
+ def until_post_type?; end
2068
+ def until_type?; end
2069
+
2070
+ # Override `AST::Node#updated` so that `AST::Processor` does not try to
2071
+ # mutate our ASTs. Since we keep references from children to parents and
2072
+ # not just the other way around, we cannot update an AST and share
2073
+ # identical subtrees. Rather, the entire AST must be copied any time any
2074
+ # part of it is changed.
2075
+ def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end
2076
+
2077
+ # Some expressions are evaluated for their value, some for their side
2078
+ # effects, and some for both
2079
+ # If we know that an expression is useful only for its side effects, that
2080
+ # means we can transform it in ways which preserve the side effects, but
2081
+ # change the return value
2082
+ # So, does the return value of this node matter? If we changed it to
2083
+ # `(...; nil)`, might that affect anything?
2084
+ #
2085
+ #
2086
+ # @return [Boolean]
2087
+ def value_used?; end
2088
+
2089
+ # @return [Boolean]
2090
+ def variable?; end
2091
+
2092
+ def when_type?; end
2093
+ def while_post_type?; end
2094
+ def while_type?; end
2095
+ def xstr_type?; end
2096
+ def yield_type?; end
2097
+ def zsuper_type?; end
2098
+
2099
+ protected
2100
+
2101
+ def parent=(node); end
2102
+
2103
+ private
2104
+
2105
+ # @return [Boolean]
2106
+ def begin_value_used?; end
2107
+
2108
+ # @return [Boolean]
2109
+ def case_if_value_used?; end
2110
+
2111
+ def defined_module0(param0 = T.unsafe(nil)); end
2112
+
2113
+ # @return [Boolean]
2114
+ def for_value_used?; end
2115
+
2116
+ def parent_module_name_for_block(ancestor); end
2117
+ def parent_module_name_for_sclass(sclass_node); end
2118
+ def parent_module_name_part(node); end
2119
+ def visit_ancestors(types); end
2120
+
2121
+ # @return [Boolean]
2122
+ def while_until_value_used?; end
2123
+ end
2124
+
2125
+ # @api private
2126
+ RuboCop::AST::Node::ARGUMENT_TYPES = T.let(T.unsafe(nil), Set)
2127
+
2128
+ # @api private
2129
+ RuboCop::AST::Node::ASSIGNMENTS = T.let(T.unsafe(nil), Set)
2130
+
2131
+ # @api private
2132
+ RuboCop::AST::Node::BASIC_CONDITIONALS = T.let(T.unsafe(nil), Set)
2133
+
2134
+ # @api private
2135
+ RuboCop::AST::Node::BASIC_LITERALS = T.let(T.unsafe(nil), Set)
2136
+
2137
+ # <=> isn't included here, because it doesn't return a boolean.
2138
+ #
2139
+ # @api private
2140
+ RuboCop::AST::Node::COMPARISON_OPERATORS = T.let(T.unsafe(nil), Set)
2141
+
2142
+ # @api private
2143
+ RuboCop::AST::Node::COMPOSITE_LITERALS = T.let(T.unsafe(nil), Set)
2144
+
2145
+ # @api private
2146
+ RuboCop::AST::Node::CONDITIONALS = T.let(T.unsafe(nil), Set)
2147
+
2148
+ # @api private
2149
+ RuboCop::AST::Node::EQUALS_ASSIGNMENTS = T.let(T.unsafe(nil), Set)
2150
+
2151
+ # @api private
2152
+ RuboCop::AST::Node::FALSEY_LITERALS = T.let(T.unsafe(nil), Set)
2153
+
2154
+ # @api private
2155
+ RuboCop::AST::Node::IMMUTABLE_LITERALS = T.let(T.unsafe(nil), Set)
2156
+
2157
+ # @api private
2158
+ RuboCop::AST::Node::KEYWORDS = T.let(T.unsafe(nil), Set)
2159
+
2160
+ # @api private
2161
+ RuboCop::AST::Node::LITERALS = T.let(T.unsafe(nil), Set)
2162
+
2163
+ RuboCop::AST::Node::LITERAL_RECURSIVE_METHODS = T.let(T.unsafe(nil), Set)
2164
+ RuboCop::AST::Node::LITERAL_RECURSIVE_TYPES = T.let(T.unsafe(nil), Set)
2165
+
2166
+ # @api private
2167
+ RuboCop::AST::Node::LOOP_TYPES = T.let(T.unsafe(nil), Set)
2168
+
2169
+ # @api private
2170
+ RuboCop::AST::Node::MUTABLE_LITERALS = T.let(T.unsafe(nil), Set)
2171
+
2172
+ # @api private
2173
+ RuboCop::AST::Node::OPERATOR_KEYWORDS = T.let(T.unsafe(nil), Set)
2174
+
2175
+ # @api private
2176
+ RuboCop::AST::Node::POST_CONDITION_LOOP_TYPES = T.let(T.unsafe(nil), Set)
2177
+
2178
+ # @api private
2179
+ RuboCop::AST::Node::REFERENCES = T.let(T.unsafe(nil), Set)
2180
+
2181
+ # @api private
2182
+ RuboCop::AST::Node::SHORTHAND_ASSIGNMENTS = T.let(T.unsafe(nil), Set)
2183
+
2184
+ # @api private
2185
+ RuboCop::AST::Node::SPECIAL_KEYWORDS = T.let(T.unsafe(nil), Set)
2186
+
2187
+ # @api private
2188
+ RuboCop::AST::Node::TRUTHY_LITERALS = T.let(T.unsafe(nil), Set)
2189
+
2190
+ # @api private
2191
+ RuboCop::AST::Node::VARIABLES = T.let(T.unsafe(nil), Set)
2192
+
2193
+ # This class performs a pattern-matching operation on an AST node.
2194
+ #
2195
+ # Detailed syntax: /docs/modules/ROOT/pages/node_pattern.adoc
2196
+ #
2197
+ # Initialize a new `NodePattern` with `NodePattern.new(pattern_string)`, then
2198
+ # pass an AST node to `NodePattern#match`. Alternatively, use one of the class
2199
+ # macros in `NodePattern::Macros` to define your own pattern-matching method.
2200
+ #
2201
+ # If the match fails, `nil` will be returned. If the match succeeds, the
2202
+ # return value depends on whether a block was provided to `#match`, and
2203
+ # whether the pattern contained any "captures" (values which are extracted
2204
+ # from a matching AST.)
2205
+ #
2206
+ # - With block: #match yields the captures (if any) and passes the return
2207
+ # value of the block through.
2208
+ # - With no block, but one capture: the capture is returned.
2209
+ # - With no block, but multiple captures: captures are returned as an array.
2210
+ # - With no block and no captures: #match returns `true`.
2211
+ class RuboCop::AST::NodePattern
2212
+ include ::RuboCop::AST::NodePattern::MethodDefiner
2213
+ extend ::Forwardable
2214
+
2215
+ # @return [NodePattern] a new instance of NodePattern
2216
+ def initialize(str, compiler: T.unsafe(nil)); end
2217
+
2218
+ def ==(other); end
2219
+ def as_json(_options = T.unsafe(nil)); end
2220
+
2221
+ # Returns the value of attribute ast.
2222
+ def ast; end
2223
+
2224
+ def captures(*args, &block); end
2225
+ def encode_with(coder); end
2226
+ def eql?(other); end
2227
+ def freeze; end
2228
+ def init_with(coder); end
2229
+ def marshal_dump; end
2230
+ def marshal_load(pattern); end
2231
+ def match(*args, **rest, &block); end
2232
+
2233
+ # Returns the value of attribute match_code.
2234
+ def match_code; end
2235
+
2236
+ def named_parameters(*args, &block); end
2237
+
2238
+ # Returns the value of attribute pattern.
2239
+ def pattern; end
2240
+
2241
+ def positional_parameters(*args, &block); end
2242
+ def to_s; end
2243
+
2244
+ class << self
2245
+ # Yields its argument and any descendants, depth-first.
2246
+ #
2247
+ # @yield [element]
2248
+ def descend(element, &block); end
2249
+ end
2250
+ end
2251
+
2252
+ # Responsible to build the AST nodes for `NodePattern`
2253
+ #
2254
+ # Doc on how this fits in the compiling process:
2255
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2256
+ class RuboCop::AST::NodePattern::Builder
2257
+ def emit_atom(type, value); end
2258
+ def emit_call(type, selector, args = T.unsafe(nil)); end
2259
+ def emit_capture(capture_token, node); end
2260
+ def emit_list(type, _begin, children, _end); end
2261
+ def emit_subsequence(node_list); end
2262
+ def emit_unary_op(type, _operator = T.unsafe(nil), *children); end
2263
+ def emit_union(begin_t, pattern_lists, end_t); end
2264
+
2265
+ private
2266
+
2267
+ def n(type, *args); end
2268
+
2269
+ # @return [Boolean]
2270
+ def optimizable_as_set?(children); end
2271
+
2272
+ def union_children(pattern_lists); end
2273
+ end
2274
+
2275
+ # A NodePattern comment, simplified version of ::Parser::Source::Comment
2276
+ class RuboCop::AST::NodePattern::Comment
2277
+ # @param range [Parser::Source::Range]
2278
+ # @return [Comment] a new instance of Comment
2279
+ def initialize(range); end
2280
+
2281
+ # Compares comments. Two comments are equal if they
2282
+ # correspond to the same source range.
2283
+ #
2284
+ # @param other [Object]
2285
+ # @return [Boolean]
2286
+ def ==(other); end
2287
+
2288
+ # @return [String] a human-readable representation of this comment
2289
+ def inspect; end
2290
+
2291
+ # Returns the value of attribute location.
2292
+ def loc; end
2293
+
2294
+ # Returns the value of attribute location.
2295
+ def location; end
2296
+
2297
+ # @return [String]
2298
+ def text; end
2299
+ end
2300
+
2301
+ # The top-level compiler holding the global state
2302
+ # Defers work to its subcompilers
2303
+ #
2304
+ # Doc on how this fits in the compiling process:
2305
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2306
+ class RuboCop::AST::NodePattern::Compiler
2307
+ extend ::Forwardable
2308
+
2309
+ # @return [Compiler] a new instance of Compiler
2310
+ def initialize; end
2311
+
2312
+ def bind(*args, &block); end
2313
+
2314
+ # Returns the value of attribute binding.
2315
+ def binding; end
2316
+
2317
+ # Returns the value of attribute captures.
2318
+ def captures; end
2319
+
2320
+ def compile_as_atom(node); end
2321
+ def compile_as_node_pattern(node, **options); end
2322
+ def compile_sequence(sequence, var:); end
2323
+
2324
+ # Enumerates `enum` while keeping track of state across
2325
+ # union branches (captures and unification).
2326
+ def each_union(enum, &block); end
2327
+
2328
+ def freeze; end
2329
+ def named_parameter(name); end
2330
+
2331
+ # Returns the value of attribute named_parameters.
2332
+ def named_parameters; end
2333
+
2334
+ def next_capture; end
2335
+ def parser; end
2336
+ def positional_parameter(number); end
2337
+
2338
+ # Returns the value of attribute positional_parameters.
2339
+ def positional_parameters; end
2340
+
2341
+ # Utilities
2342
+ def with_temp_variables(*names, &block); end
2343
+
2344
+ private
2345
+
2346
+ def enforce_same_captures(enum); end
2347
+ def new_capture; end
2348
+ end
2349
+
2350
+ # Generates code that evaluates to a value (Ruby object)
2351
+ # This value responds to `===`.
2352
+ #
2353
+ # Doc on how this fits in the compiling process:
2354
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2355
+ class RuboCop::AST::NodePattern::Compiler::AtomSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
2356
+ private
2357
+
2358
+ def visit_const; end
2359
+ def visit_named_parameter; end
2360
+ def visit_number; end
2361
+
2362
+ # Assumes other types are node patterns.
2363
+ def visit_other_type; end
2364
+
2365
+ def visit_positional_parameter; end
2366
+ def visit_regexp; end
2367
+ def visit_set; end
2368
+ def visit_string; end
2369
+ def visit_symbol; end
2370
+ def visit_unify; end
2371
+ end
2372
+
2373
+ # Holds the list of bound variable names
2374
+ class RuboCop::AST::NodePattern::Compiler::Binding
2375
+ # @return [Binding] a new instance of Binding
2376
+ def initialize; end
2377
+
2378
+ # Yields the first time a given name is bound
2379
+ #
2380
+ # @return [String] bound variable name
2381
+ def bind(name); end
2382
+
2383
+ def union_bind(enum); end
2384
+
2385
+ private
2386
+
2387
+ def forbid(names); end
2388
+ end
2389
+
2390
+ # Variant of the Compiler with tracing information for nodes
2391
+ class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern::Compiler
2392
+ # @return [Debug] a new instance of Debug
2393
+ def initialize; end
2394
+
2395
+ def comments(*args, &block); end
2396
+ def named_parameters; end
2397
+
2398
+ # Returns the value of attribute node_ids.
2399
+ def node_ids; end
2400
+
2401
+ def parser; end
2402
+ def tokens(*args, &block); end
2403
+ end
2404
+
2405
+ # @api private
2406
+ class RuboCop::AST::NodePattern::Compiler::Debug::Colorizer
2407
+ # @api private
2408
+ # @return [Colorizer] a new instance of Colorizer
2409
+ def initialize(pattern, compiler: T.unsafe(nil)); end
2410
+
2411
+ # @api private
2412
+ def compiler; end
2413
+
2414
+ # @api private
2415
+ def node_pattern; end
2416
+
2417
+ # @api private
2418
+ def pattern; end
2419
+
2420
+ # @api private
2421
+ # @return [Node] the Ruby AST
2422
+ def test(ruby, trace: T.unsafe(nil)); end
2423
+
2424
+ private
2425
+
2426
+ # @api private
2427
+ def ruby_ast(ruby); end
2428
+
2429
+ # @api private
2430
+ def ruby_parser; end
2431
+ end
2432
+
2433
+ # @api private
2434
+ RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::COLOR_SCHEME = T.let(T.unsafe(nil), Hash)
2435
+
2436
+ # @api private
2437
+ RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::Compiler = RuboCop::AST::NodePattern::Compiler::Debug
2438
+
2439
+ # Result of a NodePattern run against a particular AST
2440
+ # Consider constructor is private
2441
+ #
2442
+ # @api private
2443
+ class RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::Result < ::Struct
2444
+ # @api private
2445
+ # @return [Hash] a map for {character_position => color}
2446
+ def color_map(color_scheme = T.unsafe(nil)); end
2447
+
2448
+ # @api private
2449
+ # @return [String] a Rainbow colorized version of ruby
2450
+ def colorize(color_scheme = T.unsafe(nil)); end
2451
+
2452
+ # Returns the value of attribute colorizer
2453
+ #
2454
+ # @return [Object] the current value of colorizer
2455
+ def colorizer; end
2456
+
2457
+ # Sets the attribute colorizer
2458
+ #
2459
+ # @param value [Object] the value to set the attribute colorizer to.
2460
+ # @return [Object] the newly set value
2461
+ def colorizer=(_); end
2462
+
2463
+ # @api private
2464
+ # @return [Hash] a map for {node => matched?}, depth-first
2465
+ def match_map; end
2466
+
2467
+ # @api private
2468
+ # @return [Boolean] a value of `Trace#matched?` or `:not_visitable`
2469
+ def matched?(node); end
2470
+
2471
+ # Returns the value of attribute returned
2472
+ #
2473
+ # @return [Object] the current value of returned
2474
+ def returned; end
2475
+
2476
+ # Sets the attribute returned
2477
+ #
2478
+ # @param value [Object] the value to set the attribute returned to.
2479
+ # @return [Object] the newly set value
2480
+ def returned=(_); end
2481
+
2482
+ # Returns the value of attribute ruby_ast
2483
+ #
2484
+ # @return [Object] the current value of ruby_ast
2485
+ def ruby_ast; end
2486
+
2487
+ # Sets the attribute ruby_ast
2488
+ #
2489
+ # @param value [Object] the value to set the attribute ruby_ast to.
2490
+ # @return [Object] the newly set value
2491
+ def ruby_ast=(_); end
2492
+
2493
+ # Returns the value of attribute trace
2494
+ #
2495
+ # @return [Object] the current value of trace
2496
+ def trace; end
2497
+
2498
+ # Sets the attribute trace
2499
+ #
2500
+ # @param value [Object] the value to set the attribute trace to.
2501
+ # @return [Object] the newly set value
2502
+ def trace=(_); end
2503
+
2504
+ private
2505
+
2506
+ # @api private
2507
+ def ast; end
2508
+
2509
+ # @api private
2510
+ def color_map_for(node, color); end
2511
+
2512
+ class << self
2513
+ def [](*_arg0); end
2514
+ def inspect; end
2515
+ def members; end
2516
+ def new(*_arg0); end
2517
+ end
2518
+ end
2519
+
2520
+ # @api private
2521
+ module RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
2522
+ # @api private
2523
+ def do_compile; end
2524
+
2525
+ private
2526
+
2527
+ # @api private
2528
+ def node_id; end
2529
+
2530
+ # @api private
2531
+ def tracer(kind); end
2532
+ end
2533
+
2534
+ # @api private
2535
+ class RuboCop::AST::NodePattern::Compiler::Debug::NodePatternSubcompiler < ::RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler
2536
+ include ::RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
2537
+ end
2538
+
2539
+ # @api private
2540
+ class RuboCop::AST::NodePattern::Compiler::Debug::SequenceSubcompiler < ::RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler
2541
+ include ::RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
2542
+ end
2543
+
2544
+ # Compiled node pattern requires a named parameter `trace`,
2545
+ # which should be an instance of this class
2546
+ class RuboCop::AST::NodePattern::Compiler::Debug::Trace
2547
+ # @return [Trace] a new instance of Trace
2548
+ def initialize; end
2549
+
2550
+ def enter(node_id); end
2551
+
2552
+ # return nil (not visited), false (not matched) or true (matched)
2553
+ #
2554
+ # @return [Boolean]
2555
+ def matched?(node_id); end
2556
+
2557
+ def success(node_id); end
2558
+ end
2559
+
2560
+ # Compiles code that evalues to true or false
2561
+ # for a given value `var` (typically a RuboCop::AST::Node)
2562
+ # or it's `node.type` if `seq_head` is true
2563
+ #
2564
+ # Doc on how this fits in the compiling process:
2565
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2566
+ class RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
2567
+ # @return [NodePatternSubcompiler] a new instance of NodePatternSubcompiler
2568
+ def initialize(compiler, var: T.unsafe(nil), access: T.unsafe(nil), seq_head: T.unsafe(nil)); end
2569
+
2570
+ # Returns the value of attribute access.
2571
+ def access; end
2572
+
2573
+ # Returns the value of attribute seq_head.
2574
+ def seq_head; end
2575
+
2576
+ private
2577
+
2578
+ def access_element; end
2579
+ def access_node; end
2580
+
2581
+ # @param [Array<Node>, nil]
2582
+ # @return [String, nil]
2583
+ def compile_args(arg_list, first: T.unsafe(nil)); end
2584
+
2585
+ def compile_guard_clause; end
2586
+
2587
+ # Compiling helpers
2588
+ def compile_value_match(value); end
2589
+
2590
+ def multiple_access(kind); end
2591
+ def visit_ascend; end
2592
+ def visit_capture; end
2593
+ def visit_descend; end
2594
+ def visit_function_call; end
2595
+ def visit_intersection; end
2596
+ def visit_negation; end
2597
+ def visit_node_type; end
2598
+
2599
+ # Assumes other types are atoms.
2600
+ def visit_other_type; end
2601
+
2602
+ def visit_predicate; end
2603
+ def visit_sequence; end
2604
+ def visit_unify; end
2605
+
2606
+ # Lists
2607
+ def visit_union; end
2608
+
2609
+ def visit_wildcard; end
2610
+ end
2611
+
2612
+ # Compiles terms within a sequence to code that evalues to true or false.
2613
+ # Compilation of the nodes that can match only a single term is deferred to
2614
+ # `NodePatternSubcompiler`; only nodes that can match multiple terms are
2615
+ # compiled here.
2616
+ # Assumes the given `var` is a `::RuboCop::AST::Node`
2617
+ #
2618
+ # Doc on how this fits in the compiling process:
2619
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2620
+ #
2621
+ class RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
2622
+ # Calls `compile_sequence`; the actual `compile` method
2623
+ # will be used for the different terms of the sequence.
2624
+ # The only case of re-entrant call to `compile` is `visit_capture`
2625
+ #
2626
+ # @return [SequenceSubcompiler] a new instance of SequenceSubcompiler
2627
+ def initialize(compiler, sequence:, var:); end
2628
+
2629
+ def compile_sequence; end
2630
+
2631
+ # @api private
2632
+ def in_sync; end
2633
+
2634
+ protected
2635
+
2636
+ def compile_terms(children = T.unsafe(nil), last_arity = T.unsafe(nil)); end
2637
+
2638
+ # @api private
2639
+ def cur_index; end
2640
+
2641
+ # yield `sync_code` iff not already in sync
2642
+ #
2643
+ # @yield [code]
2644
+ def sync; end
2645
+
2646
+ private
2647
+
2648
+ # Compilation helpers
2649
+ def compile_and_advance(term); end
2650
+
2651
+ def compile_any_order_branches(matched_var); end
2652
+
2653
+ # @return [Array<String>] Else code, and init code (if any)
2654
+ def compile_any_order_else; end
2655
+
2656
+ def compile_captured_repetition(child_code, child_captures); end
2657
+ def compile_case(when_branches, else_code); end
2658
+ def compile_child_nb_guard(arity_range); end
2659
+ def compile_cur_index; end
2660
+ def compile_index(cur = T.unsafe(nil)); end
2661
+ def compile_loop(term); end
2662
+ def compile_loop_advance(to = T.unsafe(nil)); end
2663
+
2664
+ # Assumes `@cur_index` is already updated
2665
+ def compile_matched(kind); end
2666
+
2667
+ def compile_max_matched; end
2668
+
2669
+ # @return [String] code that evaluates to `false` if the matched arity is too small
2670
+ def compile_min_check; end
2671
+
2672
+ def compile_remaining; end
2673
+
2674
+ # @return [Hash] of {subcompiler => code}
2675
+ def compile_union_forks; end
2676
+
2677
+ def empty_loop; end
2678
+ def handle_prev; end
2679
+
2680
+ # Modifies in place `forks`
2681
+ # Syncs our state
2682
+ def merge_forks!(forks); end
2683
+
2684
+ # Modifies in place `forks` to insure that `cur_{child|index}_var` are ok
2685
+ def preserve_union_start(forks); end
2686
+
2687
+ # E.g. For sequence `(_ _? <_ _>)`, arities are: 1, 0..1, 2
2688
+ # and remaining arities are: 3..4, 2..3, 2..2, 0..0
2689
+ #
2690
+ # @return [Array<Range>] total arities (as Ranges) of remaining children nodes
2691
+ def remaining_arities(children, last_arity); end
2692
+
2693
+ # returns truthy iff `@cur_index` switched to relative from end mode (i.e. < 0)
2694
+ def use_index_from_end; end
2695
+
2696
+ def visit_any_order; end
2697
+ def visit_capture; end
2698
+
2699
+ # Single node patterns are all handled here
2700
+ def visit_other_type; end
2701
+
2702
+ def visit_repetition; end
2703
+ def visit_rest; end
2704
+ def visit_union; end
2705
+
2706
+ # NOTE: assumes `@cur_index != :seq_head`. Node types using `within_loop` must
2707
+ # have `def in_sequence_head; :raise; end`
2708
+ def within_loop; end
2709
+ end
2710
+
2711
+ RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler::DELTA = T.let(T.unsafe(nil), Integer)
2712
+ RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler::POSITIVE = T.let(T.unsafe(nil), Proc)
2713
+
2714
+ # Base class for subcompilers
2715
+ # Implements visitor pattern
2716
+ #
2717
+ # Doc on how this fits in the compiling process:
2718
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2719
+ class RuboCop::AST::NodePattern::Compiler::Subcompiler
2720
+ # @return [Subcompiler] a new instance of Subcompiler
2721
+ def initialize(compiler); end
2722
+
2723
+ def compile(node); end
2724
+
2725
+ # Returns the value of attribute compiler.
2726
+ def compiler; end
2727
+
2728
+ private
2729
+
2730
+ def do_compile; end
2731
+
2732
+ # Returns the value of attribute node.
2733
+ def node; end
2734
+
2735
+ class << self
2736
+ # @private
2737
+ def inherited(base); end
2738
+
2739
+ # @private
2740
+ def method_added(method); end
2741
+
2742
+ # Returns the value of attribute registry.
2743
+ def registry; end
2744
+ end
2745
+ end
2746
+
2747
+ class RuboCop::AST::NodePattern::Invalid < ::StandardError; end
2748
+
2749
+ # Lexer class for `NodePattern`
2750
+ #
2751
+ # Doc on how this fits in the compiling process:
2752
+ # /docs/modules/ROOT/pages/node_pattern.adoc
2753
+ class RuboCop::AST::NodePattern::Lexer < ::RuboCop::AST::NodePattern::LexerRex
2754
+ # @return [Lexer] a new instance of Lexer
2755
+ def initialize(source); end
2756
+
2757
+ # Returns the value of attribute comments.
2758
+ def comments; end
2759
+
2760
+ # Returns the value of attribute source_buffer.
2761
+ def source_buffer; end
2762
+
2763
+ # Returns the value of attribute tokens.
2764
+ def tokens; end
2765
+
2766
+ private
2767
+
2768
+ def do_parse; end
2769
+
2770
+ # @return [token]
2771
+ def emit(type); end
2772
+
2773
+ def emit_comment; end
2774
+ def emit_regexp; end
2775
+ def token(type, value); end
2776
+ end
2777
+
2778
+ RuboCop::AST::NodePattern::Lexer::Error = RuboCop::AST::NodePattern::LexerRex::ScanError
2779
+ RuboCop::AST::NodePattern::Lexer::REGEXP_OPTIONS = T.let(T.unsafe(nil), Hash)
2780
+
2781
+ # The generated lexer RuboCop::AST::NodePattern::LexerRex
2782
+ class RuboCop::AST::NodePattern::LexerRex
2783
+ # Yields on the current action.
2784
+ def action; end
2785
+
2786
+ # The file name / path
2787
+ def filename; end
2788
+
2789
+ # The file name / path
2790
+ def filename=(_arg0); end
2791
+
2792
+ # The current location in the parse.
2793
+ def location; end
2794
+
2795
+ # The StringScanner for this lexer.
2796
+ def match; end
2797
+
2798
+ # The match groups for the current scan.
2799
+ def matches; end
2800
+
2801
+ # Lex the next token.
2802
+ def next_token; end
2803
+
2804
+ # Parse the given string.
2805
+ def parse(str); end
2806
+
2807
+ # Read in and parse the file at +path+.
2808
+ def parse_file(path); end
2809
+
2810
+ # The current scanner class. Must be overridden in subclasses.
2811
+ def scanner_class; end
2812
+
2813
+ # The StringScanner for this lexer.
2814
+ def ss; end
2815
+
2816
+ # The StringScanner for this lexer.
2817
+ def ss=(_arg0); end
2818
+
2819
+ # The current lexical state.
2820
+ def state; end
2821
+
2822
+ # The current lexical state.
2823
+ def state=(_arg0); end
2824
+ end
2825
+
2826
+ RuboCop::AST::NodePattern::LexerRex::CALL = T.let(T.unsafe(nil), Regexp)
2827
+
2828
+ # :stopdoc:
2829
+ RuboCop::AST::NodePattern::LexerRex::CONST_NAME = T.let(T.unsafe(nil), Regexp)
2830
+
2831
+ RuboCop::AST::NodePattern::LexerRex::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
2832
+
2833
+ # :startdoc:
2834
+ # :stopdoc:
2835
+ class RuboCop::AST::NodePattern::LexerRex::LexerError < ::StandardError; end
2836
+
2837
+ RuboCop::AST::NodePattern::LexerRex::NODE_TYPE = T.let(T.unsafe(nil), Regexp)
2838
+ RuboCop::AST::NodePattern::LexerRex::REGEXP = T.let(T.unsafe(nil), Regexp)
2839
+ RuboCop::AST::NodePattern::LexerRex::REGEXP_BODY = T.let(T.unsafe(nil), Regexp)
2840
+ RuboCop::AST::NodePattern::LexerRex::SYMBOL_NAME = T.let(T.unsafe(nil), Regexp)
2841
+ class RuboCop::AST::NodePattern::LexerRex::ScanError < ::RuboCop::AST::NodePattern::LexerRex::LexerError; end
2842
+
2843
+ # Helpers for defining methods based on a pattern string
2844
+ module RuboCop::AST::NodePattern::Macros
2845
+ # Define a method which applies a pattern to an AST node
2846
+ #
2847
+ # The new method will return nil if the node does not match.
2848
+ # If the node matches, and a block is provided, the new method will
2849
+ # yield to the block (passing any captures as block arguments).
2850
+ # If the node matches, and no block is provided, the new method will
2851
+ # return the captures, or `true` if there were none.
2852
+ def def_node_matcher(method_name, pattern_str, **keyword_defaults); end
2853
+
2854
+ # Define a method which recurses over the descendants of an AST node,
2855
+ # checking whether any of them match the provided pattern
2856
+ #
2857
+ # If the method name ends with '?', the new method will return `true`
2858
+ # as soon as it finds a descendant which matches. Otherwise, it will
2859
+ # yield all descendants which match.
2860
+ def def_node_search(method_name, pattern_str, **keyword_defaults); end
2861
+ end
2862
+
2863
+ # Functionality to turn `match_code` into methods/lambda
2864
+ module RuboCop::AST::NodePattern::MethodDefiner
2865
+ def as_lambda; end
2866
+ def compile_as_lambda; end
2867
+ def def_node_matcher(base, method_name, **defaults); end
2868
+ def def_node_search(base, method_name, **defaults); end
2869
+
2870
+ private
2871
+
2872
+ def compile_init; end
2873
+ def def_helper(base, method_name, **defaults); end
2874
+ def emit_keyword_list(forwarding: T.unsafe(nil)); end
2875
+ def emit_lambda_code; end
2876
+ def emit_method_code; end
2877
+ def emit_node_search(method_name); end
2878
+ def emit_node_search_body(method_name, prelude:, on_match:); end
2879
+ def emit_param_list; end
2880
+ def emit_params(*first, forwarding: T.unsafe(nil)); end
2881
+ def emit_retval; end
2882
+ def emit_yield_capture(when_no_capture = T.unsafe(nil), yield_with: T.unsafe(nil)); end
2883
+
2884
+ # This method minimizes the closure for our method
2885
+ def wrapping_block(method_name, **defaults); end
2886
+ end
2887
+
2888
+ # Base class for AST Nodes of a `NodePattern`
2889
+ class RuboCop::AST::NodePattern::Node < ::Parser::AST::Node
2890
+ include ::RuboCop::AST::Descendence
2891
+ extend ::Forwardable
2892
+
2893
+ # Note: `arity.end` may be `Float::INFINITY`
2894
+ #
2895
+ # @return [Integer, Range] An Integer for fixed length terms, otherwise a Range.
2896
+ def arity; end
2897
+
2898
+ # @return [Range] arity as a Range
2899
+ def arity_range; end
2900
+
2901
+ # @return [Boolean]
2902
+ def capture?; end
2903
+
2904
+ # @return [Node] most nodes have only one child
2905
+ def child; end
2906
+
2907
+ # @return [Array<Node>]
2908
+ def children_nodes; end
2909
+
2910
+ # @return [Array<Node>, nil] replace node with result, or `nil` if no change requested.
2911
+ def in_sequence_head; end
2912
+
2913
+ # that matches within a Set (e.g. `42`, `:sym` but not `/regexp/`)
2914
+ #
2915
+ # @return [Boolean] returns true for nodes having a Ruby literal equivalent
2916
+ def matches_within_set?; end
2917
+
2918
+ # @return [Integer] nb of captures of that node and its descendants
2919
+ def nb_captures; end
2920
+
2921
+ # To be overridden by subclasses
2922
+ #
2923
+ # @return [Boolean]
2924
+ def rest?; end
2925
+
2926
+ # @return [Boolean] returns whether it matches a variable number of elements
2927
+ def variadic?; end
2928
+
2929
+ def with(type: T.unsafe(nil), children: T.unsafe(nil), location: T.unsafe(nil)); end
2930
+ end
2931
+
2932
+ # Node class for `<int str ...>`
2933
+ class RuboCop::AST::NodePattern::Node::AnyOrder < ::RuboCop::AST::NodePattern::Node
2934
+ include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
2935
+
2936
+ def arity; end
2937
+
2938
+ # @return [Boolean]
2939
+ def ends_with_rest?; end
2940
+
2941
+ def rest_node; end
2942
+ def term_nodes; end
2943
+ end
2944
+
2945
+ RuboCop::AST::NodePattern::Node::AnyOrder::ARITIES = T.let(T.unsafe(nil), Hash)
2946
+
2947
+ # Node class for `$something`
2948
+ class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::Node
2949
+ def arity(*args, &block); end
2950
+
2951
+ # @return [Boolean]
2952
+ def capture?; end
2953
+
2954
+ def in_sequence_head; end
2955
+ def nb_captures; end
2956
+ def rest?(*args, &block); end
2957
+ end
2958
+
2959
+ module RuboCop::AST::NodePattern::Node::ForbidInSeqHead
2960
+ # @raise [NodePattern::Invalid]
2961
+ def in_sequence_head; end
2962
+ end
2963
+
2964
+ RuboCop::AST::NodePattern::Node::FunctionCall = RuboCop::AST::NodePattern::Node::Predicate
2965
+ RuboCop::AST::NodePattern::Node::INT_TO_RANGE = T.let(T.unsafe(nil), Hash)
2966
+
2967
+ # Registry
2968
+ RuboCop::AST::NodePattern::Node::MAP = T.let(T.unsafe(nil), Hash)
2969
+
2970
+ RuboCop::AST::NodePattern::Node::MATCHES_WITHIN_SET = T.let(T.unsafe(nil), Set)
2971
+
2972
+ # Node class for `predicate?(:arg, :list)`
2973
+ class RuboCop::AST::NodePattern::Node::Predicate < ::RuboCop::AST::NodePattern::Node
2974
+ def arg_list; end
2975
+ def method_name; end
2976
+ end
2977
+
2978
+ # Node class for `int+`
2979
+ class RuboCop::AST::NodePattern::Node::Repetition < ::RuboCop::AST::NodePattern::Node
2980
+ include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
2981
+
2982
+ def arity; end
2983
+ def operator; end
2984
+ end
2985
+
2986
+ RuboCop::AST::NodePattern::Node::Repetition::ARITIES = T.let(T.unsafe(nil), Hash)
2987
+
2988
+ # Node class for `...`
2989
+ class RuboCop::AST::NodePattern::Node::Rest < ::RuboCop::AST::NodePattern::Node
2990
+ def arity; end
2991
+ def in_sequence_head; end
2992
+
2993
+ # @return [Boolean]
2994
+ def rest?; end
2995
+ end
2996
+
2997
+ RuboCop::AST::NodePattern::Node::Rest::ARITY = T.let(T.unsafe(nil), Range)
2998
+
2999
+ # Node class for `(type first second ...)`
3000
+ class RuboCop::AST::NodePattern::Node::Sequence < ::RuboCop::AST::NodePattern::Node
3001
+ include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
3002
+
3003
+ # @return [Sequence] a new instance of Sequence
3004
+ def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
3005
+ end
3006
+
3007
+ # A list (potentially empty) of nodes; part of a Union
3008
+ class RuboCop::AST::NodePattern::Node::Subsequence < ::RuboCop::AST::NodePattern::Node
3009
+ include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
3010
+
3011
+ def arity; end
3012
+ def in_sequence_head; end
3013
+ end
3014
+
3015
+ # Node class for `{ ... }`
3016
+ class RuboCop::AST::NodePattern::Node::Union < ::RuboCop::AST::NodePattern::Node
3017
+ def arity; end
3018
+ def in_sequence_head; end
3019
+ end
3020
+
3021
+ # Parser for NodePattern
3022
+ # Note: class reopened in `parser.racc`
3023
+ #
3024
+ # Doc on how this fits in the compiling process:
3025
+ # /docs/modules/ROOT/pages/node_pattern.adoc
3026
+ class RuboCop::AST::NodePattern::Parser < ::Racc::Parser
3027
+ extend ::Forwardable
3028
+
3029
+ # @return [Parser] a new instance of Parser
3030
+ def initialize(builder = T.unsafe(nil)); end
3031
+
3032
+ def _reduce_10(val, _values); end
3033
+ def _reduce_11(val, _values); end
3034
+
3035
+ # reduce 12 omitted
3036
+ def _reduce_13(val, _values); end
3037
+
3038
+ def _reduce_14(val, _values); end
3039
+ def _reduce_15(val, _values); end
3040
+ def _reduce_16(val, _values); end
3041
+ def _reduce_17(val, _values); end
3042
+ def _reduce_18(val, _values); end
3043
+ def _reduce_19(val, _values); end
3044
+
3045
+ # reduce 1 omitted
3046
+ def _reduce_2(val, _values); end
3047
+
3048
+ def _reduce_20(val, _values); end
3049
+ def _reduce_21(val, _values); end
3050
+ def _reduce_22(val, _values); end
3051
+
3052
+ # reduce 24 omitted
3053
+ def _reduce_25(val, _values); end
3054
+
3055
+ def _reduce_26(val, _values); end
3056
+ def _reduce_3(val, _values); end
3057
+
3058
+ # reduce 32 omitted
3059
+ def _reduce_33(val, _values); end
3060
+
3061
+ # reduce 36 omitted
3062
+ def _reduce_37(val, _values); end
3063
+
3064
+ def _reduce_38(val, _values); end
3065
+ def _reduce_39(val, _values); end
3066
+ def _reduce_4(val, _values); end
3067
+ def _reduce_40(val, _values); end
3068
+ def _reduce_41(val, _values); end
3069
+ def _reduce_42(val, _values); end
3070
+ def _reduce_43(val, _values); end
3071
+ def _reduce_44(val, _values); end
3072
+ def _reduce_45(val, _values); end
3073
+ def _reduce_46(val, _values); end
3074
+ def _reduce_5(val, _values); end
3075
+ def _reduce_6(val, _values); end
3076
+ def _reduce_7(val, _values); end
3077
+ def _reduce_8(val, _values); end
3078
+ def _reduce_9(val, _values); end
3079
+ def _reduce_none(val, _values); end
3080
+ def emit_atom(*args, &block); end
3081
+ def emit_call(*args, &block); end
3082
+ def emit_capture(*args, &block); end
3083
+ def emit_list(*args, &block); end
3084
+ def emit_unary_op(*args, &block); end
3085
+ def emit_union(*args, &block); end
3086
+ def inspect; end
3087
+ def next_token(*args, &block); end
3088
+
3089
+ # (Similar API to `parser` gem)
3090
+ # Parses a source and returns the AST.
3091
+ #
3092
+ # @param source_buffer [Parser::Source::Buffer, String] The source buffer to parse.
3093
+ # @return [NodePattern::Node]
3094
+ def parse(source); end
3095
+
3096
+ private
3097
+
3098
+ # @raise [NodePattern::Invalid]
3099
+ def enforce_unary(node); end
3100
+
3101
+ # Overrides Racc::Parser's method:
3102
+ #
3103
+ # @raise [NodePattern::Invalid]
3104
+ def on_error(token, val, _vstack); end
3105
+ end
3106
+
3107
+ RuboCop::AST::NodePattern::Parser::Builder = RuboCop::AST::NodePattern::Builder
3108
+ RuboCop::AST::NodePattern::Parser::Lexer = RuboCop::AST::NodePattern::Lexer
3109
+ RuboCop::AST::NodePattern::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
3110
+ RuboCop::AST::NodePattern::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
3111
+
3112
+ # Overrides Parser to use `WithMeta` variants and provide additional methods
3113
+ class RuboCop::AST::NodePattern::Parser::WithMeta < ::RuboCop::AST::NodePattern::Parser
3114
+ # Returns the value of attribute comments.
3115
+ def comments; end
3116
+
3117
+ def do_parse; end
3118
+
3119
+ # Returns the value of attribute tokens.
3120
+ def tokens; end
3121
+ end
3122
+
3123
+ # Overrides Builder to emit nodes with locations
3124
+ class RuboCop::AST::NodePattern::Parser::WithMeta::Builder < ::RuboCop::AST::NodePattern::Builder
3125
+ def emit_atom(type, token); end
3126
+ def emit_call(type, selector_t, args = T.unsafe(nil)); end
3127
+ def emit_list(type, begin_t, children, end_t); end
3128
+ def emit_unary_op(type, operator_t = T.unsafe(nil), *children); end
3129
+
3130
+ private
3131
+
3132
+ def join_exprs(left_expr, right_expr); end
3133
+ def loc(token_or_range); end
3134
+ def n(type, children, source_map); end
3135
+ def source_map(token_or_range, begin_t: T.unsafe(nil), end_t: T.unsafe(nil), operator_t: T.unsafe(nil), selector_t: T.unsafe(nil)); end
3136
+ end
3137
+
3138
+ # Overrides Lexer to token locations and comments
3139
+ class RuboCop::AST::NodePattern::Parser::WithMeta::Lexer < ::RuboCop::AST::NodePattern::Lexer
3140
+ # @return [Lexer] a new instance of Lexer
3141
+ def initialize(str_or_buffer); end
3142
+
3143
+ def emit_comment; end
3144
+
3145
+ # @return [::Parser::Source::Range] last match's position
3146
+ def pos; end
3147
+
3148
+ # Returns the value of attribute source_buffer.
3149
+ def source_buffer; end
3150
+
3151
+ def token(type, value); end
3152
+ end
3153
+
3154
+ # Utility to assign a set of values to a constant
3155
+ module RuboCop::AST::NodePattern::Sets
3156
+ class << self
3157
+ def [](set); end
3158
+ def name(set); end
3159
+ def uniq(name); end
3160
+ end
3161
+ end
3162
+
3163
+ RuboCop::AST::NodePattern::Sets::MAX = T.let(T.unsafe(nil), Integer)
3164
+ RuboCop::AST::NodePattern::Sets::REGISTRY = T.let(T.unsafe(nil), Hash)
3165
+ RuboCop::AST::NodePattern::Sets::SET_0_1 = T.let(T.unsafe(nil), Set)
3166
+ RuboCop::AST::NodePattern::Sets::SET_10_10 = T.let(T.unsafe(nil), Set)
3167
+ RuboCop::AST::NodePattern::Sets::SET_1_1 = T.let(T.unsafe(nil), Set)
3168
+ RuboCop::AST::NodePattern::Sets::SET_ABSTRACT_OVERRIDE_OVERRIDABLE_ETC = T.let(T.unsafe(nil), Set)
3169
+ RuboCop::AST::NodePattern::Sets::SET_ADD_DEPENDENCY_ADD_RUNTIME_DEPENDENCY_ADD_DEVELOPMENT_DEPENDENCY = T.let(T.unsafe(nil), Set)
3170
+ RuboCop::AST::NodePattern::Sets::SET_ANY_ALL_NORETURN_ETC = T.let(T.unsafe(nil), Set)
3171
+ RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR = T.let(T.unsafe(nil), Set)
3172
+ RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR_ATTR = T.let(T.unsafe(nil), Set)
3173
+ RuboCop::AST::NodePattern::Sets::SET_BRANCH_REF_TAG = T.let(T.unsafe(nil), Set)
3174
+ RuboCop::AST::NodePattern::Sets::SET_CAPTURE2_CAPTURE2E_CAPTURE3_ETC = T.let(T.unsafe(nil), Set)
3175
+ RuboCop::AST::NodePattern::Sets::SET_CIPHER_DIGEST = T.let(T.unsafe(nil), Set)
3176
+ RuboCop::AST::NodePattern::Sets::SET_CLASS_EVAL_INSTANCE_EVAL = T.let(T.unsafe(nil), Set)
3177
+ RuboCop::AST::NodePattern::Sets::SET_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
3178
+ RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE = T.let(T.unsafe(nil), Set)
3179
+ RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE_STRUCT = T.let(T.unsafe(nil), Set)
3180
+ RuboCop::AST::NodePattern::Sets::SET_CONSTANTIZE_CONSTANTS_CONST_GET = T.let(T.unsafe(nil), Set)
3181
+ RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
3182
+ RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD = T.let(T.unsafe(nil), Set)
3183
+ RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD_DEFINE_SINGLETON_METHOD = T.let(T.unsafe(nil), Set)
3184
+ RuboCop::AST::NodePattern::Sets::SET_EACH_WITH_INDEX_WITH_INDEX = T.let(T.unsafe(nil), Set)
3185
+ RuboCop::AST::NodePattern::Sets::SET_EACH_WITH_OBJECT_WITH_OBJECT = T.let(T.unsafe(nil), Set)
3186
+ RuboCop::AST::NodePattern::Sets::SET_ENUMERATOR_RATIONAL_COMPLEX_THREAD = T.let(T.unsafe(nil), Set)
3187
+ RuboCop::AST::NodePattern::Sets::SET_ESCAPE_ENCODE_UNESCAPE_DECODE = T.let(T.unsafe(nil), Set)
3188
+ RuboCop::AST::NodePattern::Sets::SET_EXIST_EXISTS = T.let(T.unsafe(nil), Set)
3189
+ RuboCop::AST::NodePattern::Sets::SET_FILETEST_FILE_DIR_SHELL = T.let(T.unsafe(nil), Set)
3190
+ RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST__ETC = T.let(T.unsafe(nil), Set)
3191
+ RuboCop::AST::NodePattern::Sets::SET_FIXNUM_BIGNUM = T.let(T.unsafe(nil), Set)
3192
+ RuboCop::AST::NodePattern::Sets::SET_FORMAT_SPRINTF_PRINTF = T.let(T.unsafe(nil), Set)
3193
+ RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB = T.let(T.unsafe(nil), Set)
3194
+ RuboCop::AST::NodePattern::Sets::SET_INCLUDE_EXTEND_PREPEND = T.let(T.unsafe(nil), Set)
3195
+ RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EVAL_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
3196
+ RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EXEC_CLASS_EXEC_MODULE_EXEC = T.let(T.unsafe(nil), Set)
3197
+ RuboCop::AST::NodePattern::Sets::SET_KEYS_VALUES = T.let(T.unsafe(nil), Set)
3198
+ RuboCop::AST::NodePattern::Sets::SET_KEY_HAS_KEY_FETCH_ETC = T.let(T.unsafe(nil), Set)
3199
+ RuboCop::AST::NodePattern::Sets::SET_LAST_FIRST = T.let(T.unsafe(nil), Set)
3200
+ RuboCop::AST::NodePattern::Sets::SET_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
3201
+ RuboCop::AST::NodePattern::Sets::SET_LOAD_RESTORE = T.let(T.unsafe(nil), Set)
3202
+ RuboCop::AST::NodePattern::Sets::SET_MAP_COLLECT = T.let(T.unsafe(nil), Set)
3203
+ RuboCop::AST::NodePattern::Sets::SET_NEW_ = T.let(T.unsafe(nil), Set)
3204
+ RuboCop::AST::NodePattern::Sets::SET_NEW_OPEN = T.let(T.unsafe(nil), Set)
3205
+ RuboCop::AST::NodePattern::Sets::SET_NIL_ = T.let(T.unsafe(nil), Set)
3206
+ RuboCop::AST::NodePattern::Sets::SET_PIPELINE_PIPELINE_R_PIPELINE_RW_ETC = T.let(T.unsafe(nil), Set)
3207
+ RuboCop::AST::NodePattern::Sets::SET_PRIVATE_PROTECTED = T.let(T.unsafe(nil), Set)
3208
+ RuboCop::AST::NodePattern::Sets::SET_PRIVATE_PROTECTED_PUBLIC = T.let(T.unsafe(nil), Set)
3209
+ RuboCop::AST::NodePattern::Sets::SET_PROP_CONST = T.let(T.unsafe(nil), Set)
3210
+ RuboCop::AST::NodePattern::Sets::SET_PUBLIC_CONSTANT_PRIVATE_CONSTANT = T.let(T.unsafe(nil), Set)
3211
+ RuboCop::AST::NodePattern::Sets::SET_PUBLIC_PROTECTED_PRIVATE_MODULE_FUNCTION = T.let(T.unsafe(nil), Set)
3212
+ RuboCop::AST::NodePattern::Sets::SET_RAISE_FAIL = T.let(T.unsafe(nil), Set)
3213
+ RuboCop::AST::NodePattern::Sets::SET_RAISE_FAIL_THROW_ETC = T.let(T.unsafe(nil), Set)
3214
+ RuboCop::AST::NodePattern::Sets::SET_REDUCE_INJECT = T.let(T.unsafe(nil), Set)
3215
+ RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
3216
+ RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
3217
+ RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
3218
+ RuboCop::AST::NodePattern::Sets::SET_SEND_PUBLIC_SEND___SEND__ = T.let(T.unsafe(nil), Set)
3219
+ RuboCop::AST::NodePattern::Sets::SET_SORT_BY_SORT = T.let(T.unsafe(nil), Set)
3220
+ RuboCop::AST::NodePattern::Sets::SET_SPAWN_SYSTEM = T.let(T.unsafe(nil), Set)
3221
+ RuboCop::AST::NodePattern::Sets::SET_SPRINTF_FORMAT = T.let(T.unsafe(nil), Set)
3222
+ RuboCop::AST::NodePattern::Sets::SET_STRUCT_CLASS = T.let(T.unsafe(nil), Set)
3223
+ RuboCop::AST::NodePattern::Sets::SET_SUCC_PRED_NEXT = T.let(T.unsafe(nil), Set)
3224
+ RuboCop::AST::NodePattern::Sets::SET_TEMPFILE_STRINGIO = T.let(T.unsafe(nil), Set)
3225
+ RuboCop::AST::NodePattern::Sets::SET_TO_ENUM_ENUM_FOR = T.let(T.unsafe(nil), Set)
3226
+ RuboCop::AST::NodePattern::Sets::SET_TO_H_TO_HASH = T.let(T.unsafe(nil), Set)
3227
+ RuboCop::AST::NodePattern::Sets::SET_TO_I_TO_F_TO_C_TO_R = T.let(T.unsafe(nil), Set)
3228
+ RuboCop::AST::NodePattern::Sets::SET_TRUE_FALSE = T.let(T.unsafe(nil), Set)
3229
+ RuboCop::AST::NodePattern::Sets::SET_TYPE_TEMPLATE_TYPE_MEMBER = T.let(T.unsafe(nil), Set)
3230
+ RuboCop::AST::NodePattern::Sets::SET_ZERO_POSITIVE_NEGATIVE = T.let(T.unsafe(nil), Set)
3231
+ RuboCop::AST::NodePattern::Sets::SET__ = T.let(T.unsafe(nil), Set)
3232
+ RuboCop::AST::NodePattern::Sets::SET__AT_SLICE = T.let(T.unsafe(nil), Set)
3233
+ RuboCop::AST::NodePattern::Sets::SET__EQUAL_EQL = T.let(T.unsafe(nil), Set)
3234
+ RuboCop::AST::NodePattern::Sets::SET__FETCH = T.let(T.unsafe(nil), Set)
3235
+ RuboCop::AST::NodePattern::Sets::SET__GLOB = T.let(T.unsafe(nil), Set)
3236
+ RuboCop::AST::NodePattern::Sets::SET___ = T.let(T.unsafe(nil), Set)
3237
+ RuboCop::AST::NodePattern::Sets::SET___2 = T.let(T.unsafe(nil), Set)
3238
+ RuboCop::AST::NodePattern::Sets::SET___3 = T.let(T.unsafe(nil), Set)
3239
+ RuboCop::AST::NodePattern::Sets::SET___4 = T.let(T.unsafe(nil), Set)
3240
+ RuboCop::AST::NodePattern::Sets::SET___5 = T.let(T.unsafe(nil), Set)
3241
+ RuboCop::AST::NodePattern::Sets::SET___6 = T.let(T.unsafe(nil), Set)
3242
+ RuboCop::AST::NodePattern::Sets::SET___7 = T.let(T.unsafe(nil), Set)
3243
+ RuboCop::AST::NodePattern::Sets::SET___EQL_ETC = T.let(T.unsafe(nil), Set)
3244
+ RuboCop::AST::NodePattern::Sets::SET___EQL_INCLUDE = T.let(T.unsafe(nil), Set)
3245
+ RuboCop::AST::NodePattern::Sets::SET___METHOD_____CALLEE__ = T.let(T.unsafe(nil), Set)
3246
+ RuboCop::AST::NodePattern::Sets::SET____ = T.let(T.unsafe(nil), Set)
3247
+ RuboCop::AST::NodePattern::Sets::SET____ETC = T.let(T.unsafe(nil), Set)
3248
+ RuboCop::AST::NodePattern::Sets::SET____ETC_2 = T.let(T.unsafe(nil), Set)
3249
+ RuboCop::AST::NodePattern::Sets::SET____ETC_3 = T.let(T.unsafe(nil), Set)
3250
+ RuboCop::AST::NodePattern::Sets::SET_____2 = T.let(T.unsafe(nil), Set)
3251
+ RuboCop::AST::NodePattern::VAR = T.let(T.unsafe(nil), String)
3252
+
3253
+ # Common functionality for primitive numeric nodes: `int`, `float`, ...
3254
+ module RuboCop::AST::NumericNode
3255
+ # Checks whether this is literal has a sign.
3256
+ #
3257
+ # @example
3258
+ #
3259
+ # +42
3260
+ # @return [Boolean] whether this literal has a sign.
3261
+ def sign?; end
3262
+ end
3263
+
3264
+ RuboCop::AST::NumericNode::SIGN_REGEX = T.let(T.unsafe(nil), Regexp)
3265
+
3266
+ # A node extension for `op_asgn` nodes.
3267
+ # This will be used in place of a plain node when the builder constructs
3268
+ # the AST, making its methods available to all assignment nodes within RuboCop.
3269
+ class RuboCop::AST::OpAsgnNode < ::RuboCop::AST::Node
3270
+ # @return [AsgnNode] the assignment node
3271
+ def assignment_node; end
3272
+
3273
+ # The expression being assigned to the variable.
3274
+ #
3275
+ # @return [Node] the expression being assigned.
3276
+ def expression; end
3277
+
3278
+ # The name of the variable being assigned as a symbol.
3279
+ #
3280
+ # @return [Symbol] the name of the variable being assigned
3281
+ def name; end
3282
+
3283
+ # The operator being used for assignment as a symbol.
3284
+ #
3285
+ # @return [Symbol] the assignment operator
3286
+ def operator; end
3287
+ end
3288
+
3289
+ # A node extension for `op_asgn` nodes.
3290
+ # This will be used in place of a plain node when the builder constructs
3291
+ # the AST, making its methods available to all assignment nodes within RuboCop.
3292
+ class RuboCop::AST::OrAsgnNode < ::RuboCop::AST::OpAsgnNode
3293
+ # The operator being used for assignment as a symbol.
3294
+ #
3295
+ # @return [Symbol] the assignment operator
3296
+ def operator; end
3297
+ end
3298
+
3299
+ # A node extension for `or` nodes. This will be used in place of a plain
3300
+ # node when the builder constructs the AST, making its methods available
3301
+ # to all `or` nodes within RuboCop.
3302
+ class RuboCop::AST::OrNode < ::RuboCop::AST::Node
3303
+ include ::RuboCop::AST::BinaryOperatorNode
3304
+ include ::RuboCop::AST::PredicateOperatorNode
3305
+
3306
+ # Returns the alternate operator of the `or` as a string.
3307
+ # Returns `or` for `||` and vice versa.
3308
+ #
3309
+ # @return [String] the alternate of the `or` operator
3310
+ def alternate_operator; end
3311
+
3312
+ # Returns the inverse keyword of the `or` node as a string.
3313
+ # Returns `and` for `or` and `&&` for `||`.
3314
+ #
3315
+ # @return [String] the inverse of the `or` operator
3316
+ def inverse_operator; end
3317
+ end
3318
+
3319
+ # A node extension for `pair` nodes. This will be used in place of a plain
3320
+ # node when the builder constructs the AST, making its methods available
3321
+ # to all `pair` nodes within RuboCop.
3322
+ class RuboCop::AST::PairNode < ::RuboCop::AST::Node
3323
+ include ::RuboCop::AST::HashElementNode
3324
+
3325
+ # Checks whether the `pair` uses a colon delimiter.
3326
+ #
3327
+ # @return [Boolean] whether this `pair` uses a colon delimiter
3328
+ def colon?; end
3329
+
3330
+ # Returns the delimiter of the `pair` as a string. Returns `=>` for a
3331
+ # colon delimited `pair` and `:` for a hash rocket delimited `pair`.
3332
+ #
3333
+ # @param with_spacing [Boolean] whether to include spacing
3334
+ # @return [String] the delimiter of the `pair`
3335
+ def delimiter(*deprecated, with_spacing: T.unsafe(nil)); end
3336
+
3337
+ # Checks whether the `pair` uses a hash rocket delimiter.
3338
+ #
3339
+ # @return [Boolean] whether this `pair` uses a hash rocket delimiter
3340
+ def hash_rocket?; end
3341
+
3342
+ # Returns the inverse delimiter of the `pair` as a string.
3343
+ #
3344
+ # @param with_spacing [Boolean] whether to include spacing
3345
+ # @return [String] the inverse delimiter of the `pair`
3346
+ def inverse_delimiter(*deprecated, with_spacing: T.unsafe(nil)); end
3347
+
3348
+ # Checks whether the `pair` uses hash value omission.
3349
+ #
3350
+ # @return [Boolean] whether this `pair` uses hash value omission
3351
+ def value_omission?; end
3352
+
3353
+ # Checks whether the value starts on its own line.
3354
+ #
3355
+ # @return [Boolean] whether the value in the `pair` starts its own line
3356
+ def value_on_new_line?; end
3357
+ end
3358
+
3359
+ RuboCop::AST::PairNode::COLON = T.let(T.unsafe(nil), String)
3360
+ RuboCop::AST::PairNode::HASH_ROCKET = T.let(T.unsafe(nil), String)
3361
+ RuboCop::AST::PairNode::SPACED_COLON = T.let(T.unsafe(nil), String)
3362
+ RuboCop::AST::PairNode::SPACED_HASH_ROCKET = T.let(T.unsafe(nil), String)
3363
+
3364
+ # Requires implementing `arguments`.
3365
+ #
3366
+ # Common functionality for nodes that are parameterized:
3367
+ # `send`, `super`, `zsuper`, `def`, `defs`
3368
+ # and (modern only): `index`, `indexasgn`, `lambda`
3369
+ module RuboCop::AST::ParameterizedNode
3370
+ # Checks whether this node has any arguments.
3371
+ #
3372
+ # @return [Boolean] whether this node has any arguments
3373
+ def arguments?; end
3374
+
3375
+ # Whether the last argument of the node is a block pass,
3376
+ # i.e. `&block`.
3377
+ #
3378
+ # @return [Boolean] whether the last argument of the node is a block pass
3379
+ def block_argument?; end
3380
+
3381
+ # A shorthand for getting the first argument of the node.
3382
+ # Equivalent to `arguments.first`.
3383
+ #
3384
+ # @return [Node, nil] the first argument of the node,
3385
+ # or `nil` if there are no arguments
3386
+ def first_argument; end
3387
+
3388
+ # A shorthand for getting the last argument of the node.
3389
+ # Equivalent to `arguments.last`.
3390
+ #
3391
+ # @return [Node, nil] the last argument of the node,
3392
+ # or `nil` if there are no arguments
3393
+ def last_argument; end
3394
+
3395
+ # Checks whether this node's arguments are wrapped in parentheses.
3396
+ #
3397
+ # @return [Boolean] whether this node's arguments are
3398
+ # wrapped in parentheses
3399
+ def parenthesized?; end
3400
+
3401
+ # Checks whether any argument of the node is a splat
3402
+ # argument, i.e. `*splat`.
3403
+ #
3404
+ # @return [Boolean] whether the node is a splat argument
3405
+ def rest_argument?; end
3406
+
3407
+ # Checks whether any argument of the node is a splat
3408
+ # argument, i.e. `*splat`.
3409
+ #
3410
+ # @return [Boolean] whether the node is a splat argument
3411
+ def splat_argument?; end
3412
+ end
3413
+
3414
+ # A specialized `ParameterizedNode`.
3415
+ # Requires implementing `first_argument_index`
3416
+ # Implements `arguments` as `children[first_argument_index..-1]`
3417
+ # and optimizes other calls
3418
+ module RuboCop::AST::ParameterizedNode::RestArguments
3419
+ include ::RuboCop::AST::ParameterizedNode
3420
+
3421
+ # @return [Array<Node>] arguments, if any
3422
+ def arguments; end
3423
+
3424
+ # Checks whether this node has any arguments.
3425
+ #
3426
+ # @return [Boolean] whether this node has any arguments
3427
+ def arguments?; end
3428
+
3429
+ # A shorthand for getting the first argument of the node.
3430
+ # Equivalent to `arguments.first`.
3431
+ #
3432
+ # @return [Node, nil] the first argument of the node,
3433
+ # or `nil` if there are no arguments
3434
+ def first_argument; end
3435
+
3436
+ # A shorthand for getting the last argument of the node.
3437
+ # Equivalent to `arguments.last`.
3438
+ #
3439
+ # @return [Node, nil] the last argument of the node,
3440
+ # or `nil` if there are no arguments
3441
+ def last_argument; end
3442
+ end
3443
+
3444
+ # A specialized `ParameterizedNode` for node that have a single child
3445
+ # containing either `nil`, an argument, or a `begin` node with all the
3446
+ # arguments
3447
+ module RuboCop::AST::ParameterizedNode::WrappedArguments
3448
+ include ::RuboCop::AST::ParameterizedNode
3449
+
3450
+ # @return [Array] The arguments of the node.
3451
+ def arguments; end
3452
+ end
3453
+
3454
+ # Common functionality for nodes that are predicates:
3455
+ # `or`, `and` ...
3456
+ module RuboCop::AST::PredicateOperatorNode
3457
+ # Checks whether this is a logical operator.
3458
+ #
3459
+ # @return [Boolean] whether this is a logical operator
3460
+ def logical_operator?; end
3461
+
3462
+ # Returns the operator as a string.
3463
+ #
3464
+ # @return [String] the operator
3465
+ def operator; end
3466
+
3467
+ # Checks whether this is a semantic operator.
3468
+ #
3469
+ # @return [Boolean] whether this is a semantic operator
3470
+ def semantic_operator?; end
3471
+ end
3472
+
3473
+ RuboCop::AST::PredicateOperatorNode::LOGICAL_AND = T.let(T.unsafe(nil), String)
3474
+ RuboCop::AST::PredicateOperatorNode::LOGICAL_OR = T.let(T.unsafe(nil), String)
3475
+ RuboCop::AST::PredicateOperatorNode::SEMANTIC_AND = T.let(T.unsafe(nil), String)
3476
+ RuboCop::AST::PredicateOperatorNode::SEMANTIC_OR = T.let(T.unsafe(nil), String)
3477
+
3478
+ # A node extension for `procarg0` nodes.
3479
+ # This will be used in place of a plain node when the builder constructs
3480
+ # the AST, making its methods available to all `arg` nodes within RuboCop.
3481
+ class RuboCop::AST::Procarg0Node < ::RuboCop::AST::ArgNode
3482
+ # Returns the name of an argument.
3483
+ #
3484
+ # @return [Symbol, nil] the name of the argument
3485
+ def name; end
3486
+ end
3487
+
3488
+ # ProcessedSource contains objects which are generated by Parser
3489
+ # and other information such as disabled lines for cops.
3490
+ # It also provides a convenient way to access source lines.
3491
+ class RuboCop::AST::ProcessedSource
3492
+ include ::RuboCop::Ext::ProcessedSource
3493
+
3494
+ # @return [ProcessedSource] a new instance of ProcessedSource
3495
+ def initialize(source, ruby_version, path = T.unsafe(nil)); end
3496
+
3497
+ def [](*args); end
3498
+
3499
+ # Returns the value of attribute ast.
3500
+ def ast; end
3501
+
3502
+ def ast_with_comments; end
3503
+
3504
+ # @return [Boolean]
3505
+ def blank?; end
3506
+
3507
+ # Returns the value of attribute buffer.
3508
+ def buffer; end
3509
+
3510
+ # Raw source checksum for tracking infinite loops.
3511
+ def checksum; end
3512
+
3513
+ # @return [Comment, nil] the comment at that line, if any.
3514
+ def comment_at_line(line); end
3515
+
3516
+ # Consider using `each_comment_in_lines` instead
3517
+ #
3518
+ # @deprecated use contains_comment?
3519
+ # @return [Boolean] if any of the lines in the given `source_range` has a comment.
3520
+ def commented?(source_range); end
3521
+
3522
+ # Returns the value of attribute comments.
3523
+ def comments; end
3524
+
3525
+ # Should have been called `comments_before_or_at_line`. Doubtful it has of any valid use.
3526
+ #
3527
+ # @deprecated Use `each_comment_in_lines`
3528
+ def comments_before_line(line); end
3529
+
3530
+ # Consider using `each_comment_in_lines` instead
3531
+ #
3532
+ # @return [Boolean] if any of the lines in the given `source_range` has a comment.
3533
+ def contains_comment?(source_range); end
3534
+
3535
+ def current_line(token); end
3536
+
3537
+ # Returns the value of attribute diagnostics.
3538
+ def diagnostics; end
3539
+
3540
+ # @deprecated Use `comments.each`
3541
+ def each_comment(&block); end
3542
+
3543
+ # Enumerates on the comments contained with the given `line_range`
3544
+ def each_comment_in_lines(line_range); end
3545
+
3546
+ # @deprecated Use `tokens.each`
3547
+ def each_token(&block); end
3548
+
3549
+ def file_path; end
3550
+
3551
+ # @deprecated Use `comment_at_line`, `each_comment_in_lines`, or `comments.find`
3552
+ def find_comment(&block); end
3553
+
3554
+ # @deprecated Use `tokens.find`
3555
+ def find_token(&block); end
3556
+
3557
+ def first_token_of(range_or_node); end
3558
+ def following_line(token); end
3559
+ def last_token_of(range_or_node); end
3560
+ def line_indentation(line_number); end
3561
+
3562
+ # @return [Boolean] if the given line number has a comment.
3563
+ def line_with_comment?(line); end
3564
+
3565
+ # Returns the source lines, line break characters removed, excluding a
3566
+ # possible __END__ and everything that comes after.
3567
+ def lines; end
3568
+
3569
+ # Returns the value of attribute parser_error.
3570
+ def parser_error; end
3571
+
3572
+ # Returns the value of attribute path.
3573
+ def path; end
3574
+
3575
+ def preceding_line(token); end
3576
+
3577
+ # Returns the value of attribute raw_source.
3578
+ def raw_source; end
3579
+
3580
+ # Returns the value of attribute ruby_version.
3581
+ def ruby_version; end
3582
+
3583
+ # The tokens list is always sorted by token position, except for cases when heredoc
3584
+ # is passed as a method argument. In this case tokens are interleaved by
3585
+ # heredoc contents' tokens.
3586
+ def sorted_tokens; end
3587
+
3588
+ # @return [Boolean]
3589
+ def start_with?(string); end
3590
+
3591
+ # Returns the value of attribute tokens.
3592
+ def tokens; end
3593
+
3594
+ def tokens_within(range_or_node); end
3595
+
3596
+ # @return [Boolean]
3597
+ def valid_syntax?; end
3598
+
3599
+ private
3600
+
3601
+ def comment_index; end
3602
+ def create_parser(ruby_version); end
3603
+ def first_token_index(range_or_node); end
3604
+ def last_token_index(range_or_node); end
3605
+ def parse(source, ruby_version); end
3606
+ def parser_class(ruby_version); end
3607
+ def source_range(range_or_node); end
3608
+ def tokenize(parser); end
3609
+
3610
+ class << self
3611
+ def from_file(path, ruby_version); end
3612
+ end
3613
+ end
3614
+
3615
+ RuboCop::AST::ProcessedSource::INVALID_LEVELS = T.let(T.unsafe(nil), Array)
3616
+
3617
+ # @api private
3618
+ RuboCop::AST::ProcessedSource::STRING_SOURCE_NAME = T.let(T.unsafe(nil), String)
3619
+
3620
+ # A node extension for `irange` and `erange` nodes. This will be used in
3621
+ # place of a plain node when the builder constructs the AST, making its
3622
+ # methods available to all `irange` and `erange` nodes within RuboCop.
3623
+ class RuboCop::AST::RangeNode < ::RuboCop::AST::Node
3624
+ def begin; end
3625
+ def end; end
3626
+ end
3627
+
3628
+ # A node extension for `regexp` nodes. This will be used in place of a plain
3629
+ # node when the builder constructs the AST, making its methods available
3630
+ # to all `regexp` nodes within RuboCop.
3631
+ class RuboCop::AST::RegexpNode < ::RuboCop::AST::Node
3632
+ include ::RuboCop::Ext::RegexpNode
3633
+
3634
+ # @return [String] a string of regexp content
3635
+ def content; end
3636
+
3637
+ # @return [Bool] if char is one of the delimiters
3638
+ def delimiter?(char); end
3639
+
3640
+ # @return [String] the regexp delimiters (without %r)
3641
+ def delimiters; end
3642
+
3643
+ # @return [Bool] if regexp uses the extended regopt
3644
+ def extended?; end
3645
+
3646
+ # @return [Bool] if regexp uses the fixed-encoding regopt
3647
+ def fixed_encoding?; end
3648
+
3649
+ # @return [Bool] if regexp uses the ignore-case regopt
3650
+ def ignore_case?; end
3651
+
3652
+ # @return [Bool] if regexp contains interpolation
3653
+ def interpolation?; end
3654
+
3655
+ # @return [Bool] if regexp uses the multiline regopt
3656
+ def multiline_mode?; end
3657
+
3658
+ # @return [Bool] if regexp uses the no-encoding regopt
3659
+ def no_encoding?; end
3660
+
3661
+ # NOTE: The 'o' option is ignored.
3662
+ #
3663
+ # @return [Integer] the Regexp option bits as returned by Regexp#options
3664
+ def options; end
3665
+
3666
+ # @return [Bool] if the regexp is a %r{...} literal (using any delimiters)
3667
+ def percent_r_literal?; end
3668
+
3669
+ # @return [RuboCop::AST::Node] a regopt node
3670
+ def regopt; end
3671
+
3672
+ # @return [Bool] if regexp uses the single-interpolation regopt
3673
+ def single_interpolation?; end
3674
+
3675
+ # @return [Bool] if the regexp is a /.../ literal
3676
+ def slash_literal?; end
3677
+
3678
+ # @return [Regexp] a regexp of this node
3679
+ def to_regexp; end
3680
+
3681
+ private
3682
+
3683
+ # @return [Boolean]
3684
+ def regopt_include?(option); end
3685
+ end
3686
+
3687
+ RuboCop::AST::RegexpNode::OPTIONS = T.let(T.unsafe(nil), Hash)
3688
+
3689
+ # A node extension for `resbody` nodes. This will be used in place of a
3690
+ # plain node when the builder constructs the AST, making its methods
3691
+ # available to all `resbody` nodes within RuboCop.
3692
+ class RuboCop::AST::ResbodyNode < ::RuboCop::AST::Node
3693
+ # Returns the body of the `rescue` clause.
3694
+ #
3695
+ # @return [Node, nil] The body of the `resbody`.
3696
+ def body; end
3697
+
3698
+ # Returns the index of the `resbody` branch within the exception handling statement.
3699
+ #
3700
+ # @return [Integer] the index of the `resbody` branch
3701
+ def branch_index; end
3702
+
3703
+ # Returns the exception variable of the `rescue` clause.
3704
+ #
3705
+ # @return [Node, nil] The exception variable of the `resbody`.
3706
+ def exception_variable; end
3707
+
3708
+ # Returns an array of all the exceptions in the `rescue` clause.
3709
+ #
3710
+ # @return [Array<Node>] an array of exception nodes
3711
+ def exceptions; end
3712
+ end
3713
+
3714
+ # A node extension for `rescue` nodes. This will be used in place of a
3715
+ # plain node when the builder constructs the AST, making its methods
3716
+ # available to all `rescue` nodes within RuboCop.
3717
+ class RuboCop::AST::RescueNode < ::RuboCop::AST::Node
3718
+ # Returns the body of the rescue node.
3719
+ #
3720
+ # @return [Node, nil] The body of the rescue node.
3721
+ def body; end
3722
+
3723
+ # Returns an array of all the rescue branches in the exception handling statement.
3724
+ #
3725
+ # and the else (if any). Note that these bodies could be nil.
3726
+ #
3727
+ # @return [Array<Node, nil>] an array of the bodies of the rescue branches
3728
+ def branches; end
3729
+
3730
+ # Checks whether this exception handling statement has an `else` branch.
3731
+ #
3732
+ # @return [Boolean] whether the exception handling statement has an `else` branch
3733
+ def else?; end
3734
+
3735
+ # Returns the else branch of the exception handling statement, if any.
3736
+ #
3737
+ # @return [Node] the else branch node of the exception handling statement
3738
+ # @return [nil] if the exception handling statement does not have an else branch.
3739
+ def else_branch; end
3740
+
3741
+ # Returns an array of all the rescue branches in the exception handling statement.
3742
+ #
3743
+ # @return [Array<ResbodyNode>] an array of `resbody` nodes
3744
+ def resbody_branches; end
3745
+ end
3746
+
3747
+ # A node extension for `return` nodes. This will be used in place of a
3748
+ # plain node when the builder constructs the AST, making its methods
3749
+ # available to all `return` nodes within RuboCop.
3750
+ class RuboCop::AST::ReturnNode < ::RuboCop::AST::Node
3751
+ include ::RuboCop::AST::ParameterizedNode
3752
+ include ::RuboCop::AST::ParameterizedNode::WrappedArguments
3753
+ end
3754
+
3755
+ # Responsible for compatibility with main gem
3756
+ #
3757
+ # @api private
3758
+ module RuboCop::AST::RuboCopCompatibility
3759
+ # @api private
3760
+ def rubocop_loaded; end
3761
+ end
3762
+
3763
+ # @api private
3764
+ RuboCop::AST::RuboCopCompatibility::INCOMPATIBLE_COPS = T.let(T.unsafe(nil), Hash)
3765
+
3766
+ # A node extension for `sclass` nodes. This will be used in place of a
3767
+ # plain node when the builder constructs the AST, making its methods
3768
+ # available to all `sclass` nodes within RuboCop.
3769
+ class RuboCop::AST::SelfClassNode < ::RuboCop::AST::Node
3770
+ # The body of this `sclass` node.
3771
+ #
3772
+ # @return [Node, nil] the body of the class
3773
+ def body; end
3774
+
3775
+ # The identifier for this `sclass` node. (Always `self`.)
3776
+ #
3777
+ # @return [Node] the identifier of the class
3778
+ def identifier; end
3779
+ end
3780
+
3781
+ # A node extension for `send` nodes. This will be used in place of a plain
3782
+ # node when the builder constructs the AST, making its methods available
3783
+ # to all `send` nodes within RuboCop.
3784
+ class RuboCop::AST::SendNode < ::RuboCop::AST::Node
3785
+ include ::RuboCop::AST::ParameterizedNode
3786
+ include ::RuboCop::AST::ParameterizedNode::RestArguments
3787
+ include ::RuboCop::AST::MethodIdentifierPredicates
3788
+ include ::RuboCop::AST::MethodDispatchNode
3789
+
3790
+ def attribute_accessor?(param0 = T.unsafe(nil)); end
3791
+
3792
+ private
3793
+
3794
+ def first_argument_index; end
3795
+ end
3796
+
3797
+ # This module provides a shorthand method to create a {Node} like
3798
+ # `Parser::AST::Sexp`.
3799
+ #
3800
+ # @see https://www.rubydoc.info/gems/ast/AST/Sexp
3801
+ module RuboCop::AST::Sexp
3802
+ # Creates a {Node} with type `type` and children `children`.
3803
+ def s(type, *children); end
3804
+ end
3805
+
3806
+ # A node extension for `str`, `dstr`, and `xstr` nodes. This will be used
3807
+ # in place of a plain node when the builder constructs the AST, making
3808
+ # its methods available to all `str` nodes within RuboCop.
3809
+ class RuboCop::AST::StrNode < ::RuboCop::AST::Node
3810
+ include ::RuboCop::AST::BasicLiteralNode
3811
+
3812
+ # @return [Boolean]
3813
+ def heredoc?; end
3814
+ end
3815
+
3816
+ # A node extension for `super`- and `zsuper` nodes. This will be used in
3817
+ # place of a plain node when the builder constructs the AST, making its
3818
+ # methods available to all `super`- and `zsuper` nodes within RuboCop.
3819
+ class RuboCop::AST::SuperNode < ::RuboCop::AST::Node
3820
+ include ::RuboCop::AST::ParameterizedNode
3821
+ include ::RuboCop::AST::MethodIdentifierPredicates
3822
+ include ::RuboCop::AST::MethodDispatchNode
3823
+
3824
+ def arguments; end
3825
+
3826
+ # Custom destructuring method. This can be used to normalize
3827
+ # destructuring for different variations of the node.
3828
+ #
3829
+ # @return [Array] the different parts of the `super` node
3830
+ def node_parts; end
3831
+ end
3832
+
3833
+ # A node extension for `sym` nodes. This will be used in place of a
3834
+ # plain node when the builder constructs the AST, making its methods
3835
+ # available to all `sym` nodes within RuboCop.
3836
+ class RuboCop::AST::SymbolNode < ::RuboCop::AST::Node
3837
+ include ::RuboCop::AST::BasicLiteralNode
3838
+ end
3839
+
3840
+ # A basic wrapper around Parser's tokens.
3841
+ class RuboCop::AST::Token
3842
+ # @return [Token] a new instance of Token
3843
+ def initialize(pos, type, text); end
3844
+
3845
+ def begin_pos; end
3846
+ def column; end
3847
+
3848
+ # @return [Boolean]
3849
+ def comma?; end
3850
+
3851
+ # Type Predicates
3852
+ #
3853
+ # @return [Boolean]
3854
+ def comment?; end
3855
+
3856
+ # @return [Boolean]
3857
+ def dot?; end
3858
+
3859
+ # @return [Boolean]
3860
+ def end?; end
3861
+
3862
+ def end_pos; end
3863
+
3864
+ # @return [Boolean]
3865
+ def equal_sign?; end
3866
+
3867
+ # @return [Boolean]
3868
+ def left_array_bracket?; end
3869
+
3870
+ # @return [Boolean]
3871
+ def left_brace?; end
3872
+
3873
+ # @return [Boolean]
3874
+ def left_bracket?; end
3875
+
3876
+ # @return [Boolean]
3877
+ def left_curly_brace?; end
3878
+
3879
+ # @return [Boolean]
3880
+ def left_parens?; end
3881
+
3882
+ # @return [Boolean]
3883
+ def left_ref_bracket?; end
3884
+
3885
+ def line; end
3886
+
3887
+ # Returns the value of attribute pos.
3888
+ def pos; end
3889
+
3890
+ # @return [Boolean]
3891
+ def regexp_dots?; end
3892
+
3893
+ # @return [Boolean]
3894
+ def rescue_modifier?; end
3895
+
3896
+ # @return [Boolean]
3897
+ def right_bracket?; end
3898
+
3899
+ # @return [Boolean]
3900
+ def right_curly_brace?; end
3901
+
3902
+ # @return [Boolean]
3903
+ def right_parens?; end
3904
+
3905
+ # @return [Boolean]
3906
+ def semicolon?; end
3907
+
3908
+ # Checks if there is whitespace after token
3909
+ #
3910
+ # @return [Boolean]
3911
+ def space_after?; end
3912
+
3913
+ # Checks if there is whitespace before token
3914
+ #
3915
+ # @return [Boolean]
3916
+ def space_before?; end
3917
+
3918
+ # Returns the value of attribute text.
3919
+ def text; end
3920
+
3921
+ def to_s; end
3922
+
3923
+ # Returns the value of attribute type.
3924
+ def type; end
3925
+
3926
+ class << self
3927
+ def from_parser_token(parser_token); end
3928
+ end
3929
+ end
3930
+
3931
+ # Provides methods for traversing an AST.
3932
+ # Does not transform an AST; for that, use Parser::AST::Processor.
3933
+ # Override methods to perform custom processing. Remember to call `super`
3934
+ # if you want to recursively process descendant nodes.
3935
+ module RuboCop::AST::Traversal
3936
+ extend ::RuboCop::AST::Traversal::CallbackCompiler
3937
+
3938
+ def on_(node); end
3939
+ def on___ENCODING__(node); end
3940
+ def on___FILE__(node); end
3941
+ def on___LINE__(node); end
3942
+ def on_alias(node); end
3943
+ def on_and(node); end
3944
+ def on_and_asgn(node); end
3945
+ def on_arg(node); end
3946
+ def on_arg_expr(node); end
3947
+ def on_args(node); end
3948
+ def on_array(node); end
3949
+ def on_array_pattern(node); end
3950
+ def on_array_pattern_with_tail(node); end
3951
+ def on_back_ref(node); end
3952
+ def on_begin(node); end
3953
+ def on_block(node); end
3954
+ def on_block_pass(node); end
3955
+ def on_blockarg(node); end
3956
+ def on_break(node); end
3957
+ def on_case(node); end
3958
+ def on_case_match(node); end
3959
+ def on_casgn(node); end
3960
+ def on_cbase(node); end
3961
+ def on_class(node); end
3962
+ def on_complex(node); end
3963
+ def on_const(node); end
3964
+ def on_const_pattern(node); end
3965
+ def on_csend(node); end
3966
+ def on_cvar(node); end
3967
+ def on_cvasgn(node); end
3968
+ def on_def(node); end
3969
+ def on_defined?(node); end
3970
+ def on_defs(node); end
3971
+ def on_dstr(node); end
3972
+ def on_dsym(node); end
3973
+ def on_eflipflop(node); end
3974
+ def on_empty_else(node); end
3975
+ def on_ensure(node); end
3976
+ def on_erange(node); end
3977
+ def on_false(node); end
3978
+ def on_find_pattern(node); end
3979
+ def on_float(node); end
3980
+ def on_for(node); end
3981
+ def on_forward_arg(node); end
3982
+ def on_forward_args(node); end
3983
+ def on_forwarded_args(node); end
3984
+ def on_gvar(node); end
3985
+ def on_gvasgn(node); end
3986
+ def on_hash(node); end
3987
+ def on_hash_pattern(node); end
3988
+ def on_if(node); end
3989
+ def on_if_guard(node); end
3990
+ def on_iflipflop(node); end
3991
+ def on_in_match(node); end
3992
+ def on_in_pattern(node); end
3993
+ def on_index(node); end
3994
+ def on_indexasgn(node); end
3995
+ def on_int(node); end
3996
+ def on_irange(node); end
3997
+ def on_ivar(node); end
3998
+ def on_ivasgn(node); end
3999
+ def on_kwarg(node); end
4000
+ def on_kwargs(node); end
4001
+ def on_kwbegin(node); end
4002
+ def on_kwnilarg(node); end
4003
+ def on_kwoptarg(node); end
4004
+ def on_kwrestarg(node); end
4005
+ def on_kwsplat(node); end
4006
+ def on_lambda(node); end
4007
+ def on_lvar(node); end
4008
+ def on_lvasgn(node); end
4009
+ def on_masgn(node); end
4010
+ def on_match_alt(node); end
4011
+ def on_match_as(node); end
4012
+ def on_match_current_line(node); end
4013
+ def on_match_nil_pattern(node); end
4014
+ def on_match_pattern(node); end
4015
+ def on_match_pattern_p(node); end
4016
+ def on_match_rest(node); end
4017
+ def on_match_var(node); end
4018
+ def on_match_with_lvasgn(node); end
4019
+ def on_match_with_trailing_comma(node); end
4020
+ def on_mlhs(node); end
4021
+ def on_module(node); end
4022
+ def on_mrasgn(node); end
4023
+ def on_next(node); end
4024
+ def on_nil(node); end
4025
+ def on_not(node); end
4026
+ def on_nth_ref(node); end
4027
+ def on_numblock(node); end
4028
+ def on_op_asgn(node); end
4029
+ def on_optarg(node); end
4030
+ def on_or(node); end
4031
+ def on_or_asgn(node); end
4032
+ def on_pair(node); end
4033
+ def on_pin(node); end
4034
+ def on_postexe(node); end
4035
+ def on_preexe(node); end
4036
+ def on_procarg0(node); end
4037
+ def on_rasgn(node); end
4038
+ def on_rational(node); end
4039
+ def on_redo(node); end
4040
+ def on_regexp(node); end
4041
+ def on_regopt(node); end
4042
+ def on_resbody(node); end
4043
+ def on_rescue(node); end
4044
+ def on_restarg(node); end
4045
+ def on_retry(node); end
4046
+ def on_return(node); end
4047
+ def on_sclass(node); end
4048
+ def on_self(node); end
4049
+ def on_send(node); end
4050
+ def on_shadowarg(node); end
4051
+ def on_splat(node); end
4052
+ def on_str(node); end
4053
+ def on_super(node); end
4054
+ def on_sym(node); end
4055
+ def on_true(node); end
4056
+ def on_undef(node); end
4057
+ def on_unless_guard(node); end
4058
+ def on_until(node); end
4059
+ def on_until_post(node); end
4060
+ def on_when(node); end
4061
+ def on_while(node); end
4062
+ def on_while_post(node); end
4063
+ def on_xstr(node); end
4064
+ def on_yield(node); end
4065
+ def on_zsuper(node); end
4066
+ def walk(node); end
4067
+ end
4068
+
4069
+ # @api private
4070
+ module RuboCop::AST::Traversal::CallbackCompiler
4071
+ # @api private
4072
+ def arity_check(range); end
4073
+
4074
+ # @api private
4075
+ def body(signature, prelude); end
4076
+
4077
+ # @api private
4078
+ def def_callback(type, *signature, arity: T.unsafe(nil), arity_check: T.unsafe(nil), body: T.unsafe(nil)); end
4079
+ end
4080
+
4081
+ # @api private
4082
+ RuboCop::AST::Traversal::CallbackCompiler::SEND = T.let(T.unsafe(nil), String)
4083
+
4084
+ # @api private
4085
+ RuboCop::AST::Traversal::CallbackCompiler::TEMPLATE = T.let(T.unsafe(nil), Hash)
4086
+
4087
+ # Only for debugging.
4088
+ #
4089
+ # @api private
4090
+ class RuboCop::AST::Traversal::DebugError < ::RuntimeError; end
4091
+
4092
+ RuboCop::AST::Traversal::NO_CHILD_NODES = T.let(T.unsafe(nil), Set)
4093
+ RuboCop::AST::Traversal::TYPE_TO_METHOD = T.let(T.unsafe(nil), Hash)
4094
+
4095
+ # A node extension for `until` nodes. This will be used in place of a plain
4096
+ # node when the builder constructs the AST, making its methods available
4097
+ # to all `until` nodes within RuboCop.
4098
+ class RuboCop::AST::UntilNode < ::RuboCop::AST::Node
4099
+ include ::RuboCop::AST::ConditionalNode
4100
+ include ::RuboCop::AST::ModifierNode
4101
+
4102
+ # Checks whether the `until` node has a `do` keyword.
4103
+ #
4104
+ # @return [Boolean] whether the `until` node has a `do` keyword
4105
+ def do?; end
4106
+
4107
+ # Returns the inverse keyword of the `until` node as a string.
4108
+ # Returns `while` for `until` nodes and vice versa.
4109
+ #
4110
+ # @return [String] the inverse keyword of the `until` statement
4111
+ def inverse_keyword; end
4112
+
4113
+ # Returns the keyword of the `until` statement as a string.
4114
+ #
4115
+ # @return [String] the keyword of the `until` statement
4116
+ def keyword; end
4117
+ end
4118
+
4119
+ module RuboCop::AST::Version; end
4120
+ RuboCop::AST::Version::STRING = T.let(T.unsafe(nil), String)
4121
+
4122
+ # A node extension for `when` nodes. This will be used in place of a plain
4123
+ # node when the builder constructs the AST, making its methods available
4124
+ # to all `when` nodes within RuboCop.
4125
+ class RuboCop::AST::WhenNode < ::RuboCop::AST::Node
4126
+ # Returns the body of the `when` node.
4127
+ #
4128
+ # @return [Node, nil] the body of the `when` node
4129
+ def body; end
4130
+
4131
+ # Returns the index of the `when` branch within the `case` statement.
4132
+ #
4133
+ # @return [Integer] the index of the `when` branch
4134
+ def branch_index; end
4135
+
4136
+ # Returns an array of all the conditions in the `when` branch.
4137
+ #
4138
+ # @return [Array<Node>] an array of condition nodes
4139
+ def conditions; end
4140
+
4141
+ # @deprecated Use `conditions.each`
4142
+ def each_condition(&block); end
4143
+
4144
+ # Checks whether the `when` node has a `then` keyword.
4145
+ #
4146
+ # @return [Boolean] whether the `when` node has a `then` keyword
4147
+ def then?; end
4148
+ end
4149
+
4150
+ # A node extension for `while` nodes. This will be used in place of a plain
4151
+ # node when the builder constructs the AST, making its methods available
4152
+ # to all `while` nodes within RuboCop.
4153
+ class RuboCop::AST::WhileNode < ::RuboCop::AST::Node
4154
+ include ::RuboCop::AST::ConditionalNode
4155
+ include ::RuboCop::AST::ModifierNode
4156
+
4157
+ # Checks whether the `until` node has a `do` keyword.
4158
+ #
4159
+ # @return [Boolean] whether the `until` node has a `do` keyword
4160
+ def do?; end
4161
+
4162
+ # Returns the inverse keyword of the `while` node as a string.
4163
+ # Returns `until` for `while` nodes and vice versa.
4164
+ #
4165
+ # @return [String] the inverse keyword of the `while` statement
4166
+ def inverse_keyword; end
4167
+
4168
+ # Returns the keyword of the `while` statement as a string.
4169
+ #
4170
+ # @return [String] the keyword of the `while` statement
4171
+ def keyword; end
4172
+ end
4173
+
4174
+ # A node extension for `yield` nodes. This will be used in place of a plain
4175
+ # node when the builder constructs the AST, making its methods available
4176
+ # to all `yield` nodes within RuboCop.
4177
+ class RuboCop::AST::YieldNode < ::RuboCop::AST::Node
4178
+ include ::RuboCop::AST::ParameterizedNode
4179
+ include ::RuboCop::AST::MethodIdentifierPredicates
4180
+ include ::RuboCop::AST::MethodDispatchNode
4181
+
4182
+ def arguments; end
4183
+
4184
+ # Custom destructuring method. This can be used to normalize
4185
+ # destructuring for different variations of the node.
4186
+ #
4187
+ # @return [Array] the different parts of the `send` node
4188
+ def node_parts; end
4189
+ end
4190
+
4191
+ RuboCop::NodePattern = RuboCop::AST::NodePattern
4192
+ RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
4193
+ RuboCop::Token = RuboCop::AST::Token