rubocop-ast 1.8.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74f293f4bc64d882c585948fa1cadb54c207f6f21b1d46986751433c9e8f8e6
|
4
|
+
data.tar.gz: c2d80c9d76eab9d8e9dfc1bb5d7ba3ea99ec55edda6c57e63acf894730f12e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c641709f25b739e2fca2784601c50b0344c6ee5f23011b58795e118ebceb38488944fc3b7929b3ed62e0e79dff6cd279a5aac71e817a2c2c9624a9d15cc0d2
|
7
|
+
data.tar.gz: ae3bdbcb7bc6664ecaf11ec72c98a598a88ea6d5b4b021607564fb361cf1663071bc9286a38af21b576c1f5cfc0d884895f845d825a331dff0cf7f106f9d6396
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -317,7 +317,11 @@ module RuboCop
|
|
317
317
|
# returns nil if answer cannot be determined
|
318
318
|
ancestors = each_ancestor(:class, :module, :sclass, :casgn, :block)
|
319
319
|
result = ancestors.map do |ancestor|
|
320
|
-
parent_module_name_part(ancestor)
|
320
|
+
parent_module_name_part(ancestor) do |full_name|
|
321
|
+
return nil unless full_name
|
322
|
+
|
323
|
+
full_name
|
324
|
+
end
|
321
325
|
end.compact.reverse.join('::')
|
322
326
|
result.empty? ? 'Object' : result
|
323
327
|
end
|
@@ -47,6 +47,7 @@ module RuboCop
|
|
47
47
|
# Returns the else branch of the `case` statement, if any.
|
48
48
|
#
|
49
49
|
# @return [Node] the else branch node of the `case` statement
|
50
|
+
# @return [EmptyElse] the empty else branch node of the `case` statement
|
50
51
|
# @return [nil] if the case statement does not have an else branch.
|
51
52
|
def else_branch
|
52
53
|
node_parts[-1]
|
@@ -80,23 +80,23 @@ module RuboCop
|
|
80
80
|
"#<#{self.class} #{pattern}>"
|
81
81
|
end
|
82
82
|
|
83
|
-
def marshal_load(pattern)
|
83
|
+
def marshal_load(pattern) # :nodoc:
|
84
84
|
initialize pattern
|
85
85
|
end
|
86
86
|
|
87
|
-
def marshal_dump
|
87
|
+
def marshal_dump # :nodoc:
|
88
88
|
pattern
|
89
89
|
end
|
90
90
|
|
91
|
-
def as_json(_options = nil)
|
91
|
+
def as_json(_options = nil) # :nodoc:
|
92
92
|
pattern
|
93
93
|
end
|
94
94
|
|
95
|
-
def encode_with(coder)
|
95
|
+
def encode_with(coder) # :nodoc:
|
96
96
|
coder['pattern'] = pattern
|
97
97
|
end
|
98
98
|
|
99
|
-
def init_with(coder)
|
99
|
+
def init_with(coder) # :nodoc:
|
100
100
|
initialize(coder['pattern'])
|
101
101
|
end
|
102
102
|
|
@@ -54,7 +54,7 @@ module RuboCop
|
|
54
54
|
children_nodes.sum(&:nb_captures)
|
55
55
|
end
|
56
56
|
|
57
|
-
# @return [Boolean] returns
|
57
|
+
# @return [Boolean] returns wether it matches a variable number of elements
|
58
58
|
def variadic?
|
59
59
|
arity.is_a?(Range)
|
60
60
|
end
|
@@ -177,6 +177,14 @@ module RuboCop
|
|
177
177
|
sorted_tokens[last_token_index(range_or_node)]
|
178
178
|
end
|
179
179
|
|
180
|
+
# The tokens list is always sorted by token position, except for cases when heredoc
|
181
|
+
# is passed as a method argument. In this case tokens are interleaved by
|
182
|
+
# heredoc contents' tokens.
|
183
|
+
def sorted_tokens
|
184
|
+
# Use stable sort.
|
185
|
+
@sorted_tokens ||= tokens.sort_by.with_index { |token, i| [token.begin_pos, i] }
|
186
|
+
end
|
187
|
+
|
180
188
|
private
|
181
189
|
|
182
190
|
def comment_index
|
@@ -272,14 +280,6 @@ module RuboCop
|
|
272
280
|
sorted_tokens.bsearch_index { |token| token.end_pos >= end_pos }
|
273
281
|
end
|
274
282
|
|
275
|
-
# The tokens list is always sorted by token position, except for cases when heredoc
|
276
|
-
# is passed as a method argument. In this case tokens are interleaved by
|
277
|
-
# heredoc contents' tokens.
|
278
|
-
def sorted_tokens
|
279
|
-
# Use stable sort.
|
280
|
-
@sorted_tokens ||= tokens.sort_by.with_index { |token, i| [token.begin_pos, i] }
|
281
|
-
end
|
282
|
-
|
283
283
|
def source_range(range_or_node)
|
284
284
|
if range_or_node.respond_to?(:source_range)
|
285
285
|
range_or_node.source_range
|
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.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|