rubocop-ast 1.17.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/ast/node/mixin/parameterized_node.rb +1 -1
- data/lib/rubocop/ast/node.rb +1 -1
- data/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb +2 -2
- data/lib/rubocop/ast/node_pattern/node.rb +3 -3
- data/lib/rubocop/ast/processed_source.rb +17 -2
- data/lib/rubocop/ast/traversal.rb +2 -2
- data/lib/rubocop/ast/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc44200cb01d2a920c3f0dc730904dce038f0ce7ad48b18c1188f5f39395bf6
|
4
|
+
data.tar.gz: 65cf679ce211a1772606eef3ecf27c29732f8bd757b332d0324323f1b1898fb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9da19828233f088bb4de259c1448d33a4c021daceca170c809eb7c413496bf0791476e032b0632eedff463adc6a16916c6c37c5c7deb3957e0bb0ebbcaf6bbe
|
7
|
+
data.tar.gz: 1cbf941b340dcc64fa3d727aaff4c5dbba9a47561b02b01ed12ac96f1b8ef53fa9f6b7f3b361e622368d4215c373b3af2bee0b012b9078b2460726a2306b3bd3
|
@@ -84,7 +84,7 @@ module RuboCop
|
|
84
84
|
include ParameterizedNode
|
85
85
|
# @return [Array<Node>] arguments, if any
|
86
86
|
def arguments
|
87
|
-
children[first_argument_index
|
87
|
+
children[first_argument_index..].freeze
|
88
88
|
end
|
89
89
|
|
90
90
|
# A shorthand for getting the first argument of the node.
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -371,13 +371,13 @@ module RuboCop
|
|
371
371
|
|
372
372
|
# @return [Hash] of {subcompiler => code}
|
373
373
|
def compile_union_forks
|
374
|
-
compiler.each_union(node.children).
|
374
|
+
compiler.each_union(node.children).to_h do |child|
|
375
375
|
subsequence_terms = child.is_a?(Node::Subsequence) ? child.children : [child]
|
376
376
|
fork = dup
|
377
377
|
code = fork.compile_terms(subsequence_terms, @remaining_arity)
|
378
378
|
@in_sync = false if @cur_index != :variadic_mode
|
379
379
|
[fork, code]
|
380
|
-
end
|
380
|
+
end
|
381
381
|
end
|
382
382
|
|
383
383
|
# Modifies in place `forks` to insure that `cur_{child|index}_var` are ok
|
@@ -116,7 +116,7 @@ module RuboCop
|
|
116
116
|
|
117
117
|
def initialize(type, children = [], properties = {})
|
118
118
|
if (replace = children.first.in_sequence_head)
|
119
|
-
children = [*replace, *children[1
|
119
|
+
children = [*replace, *children[1..]]
|
120
120
|
end
|
121
121
|
|
122
122
|
super
|
@@ -130,7 +130,7 @@ module RuboCop
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def arg_list
|
133
|
-
children[1
|
133
|
+
children[1..]
|
134
134
|
end
|
135
135
|
end
|
136
136
|
FunctionCall = Predicate
|
@@ -212,7 +212,7 @@ module RuboCop
|
|
212
212
|
|
213
213
|
return unless (replace = children.first.in_sequence_head)
|
214
214
|
|
215
|
-
[with(children: [*replace, *children[1
|
215
|
+
[with(children: [*replace, *children[1..]])]
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
@@ -226,9 +226,24 @@ module RuboCop
|
|
226
226
|
[ast, comments, tokens]
|
227
227
|
end
|
228
228
|
|
229
|
-
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
229
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
230
230
|
def parser_class(ruby_version)
|
231
231
|
case ruby_version
|
232
|
+
when 1.9
|
233
|
+
require 'parser/ruby19'
|
234
|
+
Parser::Ruby19
|
235
|
+
when 2.0
|
236
|
+
require 'parser/ruby20'
|
237
|
+
Parser::Ruby20
|
238
|
+
when 2.1
|
239
|
+
require 'parser/ruby21'
|
240
|
+
Parser::Ruby21
|
241
|
+
when 2.2
|
242
|
+
require 'parser/ruby22'
|
243
|
+
Parser::Ruby22
|
244
|
+
when 2.3
|
245
|
+
require 'parser/ruby23'
|
246
|
+
Parser::Ruby23
|
232
247
|
when 2.4
|
233
248
|
require 'parser/ruby24'
|
234
249
|
Parser::Ruby24
|
@@ -255,7 +270,7 @@ module RuboCop
|
|
255
270
|
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
|
256
271
|
end
|
257
272
|
end
|
258
|
-
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
273
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
259
274
|
|
260
275
|
def create_parser(ruby_version)
|
261
276
|
builder = RuboCop::AST::Builder.new
|
@@ -34,7 +34,7 @@ module RuboCop
|
|
34
34
|
|
35
35
|
def def_callback(type, *signature,
|
36
36
|
arity: signature.size..signature.size,
|
37
|
-
arity_check: ENV
|
37
|
+
arity_check: ENV.fetch('RUBOCOP_DEBUG', nil) && self.arity_check(arity),
|
38
38
|
body: self.body(signature, arity_check))
|
39
39
|
type, *aliases = type
|
40
40
|
lineno = caller_locations(1, 1).first.lineno
|
@@ -162,7 +162,7 @@ module RuboCop
|
|
162
162
|
### generic processing of any other node (forward compatibility)
|
163
163
|
defined = instance_methods(false)
|
164
164
|
.grep(/^on_/)
|
165
|
-
.map { |s| s.to_s[3
|
165
|
+
.map { |s| s.to_s[3..].to_sym } # :on_foo => :foo
|
166
166
|
|
167
167
|
to_define = ::Parser::Meta::NODE_TYPES.to_a
|
168
168
|
to_define -= defined
|
data/lib/rubocop/ast/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
requirements:
|
169
169
|
- - ">="
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: 2.
|
171
|
+
version: 2.6.0
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - ">="
|