rubocop-ast 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubocop/ast/node/pair_node.rb +7 -0
- data/lib/rubocop/ast/node.rb +1 -1
- data/lib/rubocop/ast/node_pattern/lexer.rex +1 -1
- data/lib/rubocop/ast/node_pattern/lexer.rex.rb +1 -1
- data/lib/rubocop/ast/processed_source.rb +5 -2
- data/lib/rubocop/ast/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e65c7ca3cc4f7a4345d3584be2d2f1ed5ddb737c6c9dd9698c61ee8082041439
|
4
|
+
data.tar.gz: b5c6e4a5e460af4a8c4fd5e8941f2a997b94dbffcd54b53549c9147ec7cd9dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e422e89790ad586e0d26d8af780a15d14c892830c550a5f536e349ac46be76348760cf4f837be42fea912910db9ea2923c47d09d5e854b6ca2fb0fb72e3ebd8f
|
7
|
+
data.tar.gz: e7c2c6af704a97d5102a96304eec899f63edc2a5d4eabe656205324a8e5aae4237851e6d16665dbc51a8023bd370d1090cee35ab0c6fdb36a48801a1719afb5d
|
@@ -62,6 +62,13 @@ module RuboCop
|
|
62
62
|
def value_on_new_line?
|
63
63
|
key.loc.line != value.loc.line
|
64
64
|
end
|
65
|
+
|
66
|
+
# Checks whether the `pair` uses hash value omission.
|
67
|
+
#
|
68
|
+
# @return [Boolean] whether this `pair` uses hash value omission
|
69
|
+
def value_omission?
|
70
|
+
source.end_with?(':')
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -274,7 +274,7 @@ module RuboCop
|
|
274
274
|
|
275
275
|
# @!method receiver(node = self)
|
276
276
|
def_node_matcher :receiver, <<~PATTERN
|
277
|
-
{(send $_ ...) ({block numblock} (
|
277
|
+
{(send $_ ...) ({block numblock} (call $_ ...) ...)}
|
278
278
|
PATTERN
|
279
279
|
|
280
280
|
# @!method str_content(node = self)
|
@@ -12,7 +12,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
12
12
|
|
13
13
|
macros
|
14
14
|
CONST_NAME /[A-Z:][a-zA-Z_:]+/
|
15
|
-
SYMBOL_NAME /[\w
|
15
|
+
SYMBOL_NAME /[\w+@*\/?!<>=~|%^&-]+|\[\]=?/
|
16
16
|
IDENTIFIER /[a-z][a-zA-Z0-9_]*/
|
17
17
|
NODE_TYPE /[a-z][a-zA-Z0-9_-]*/ # Same as identifier but allows '-'
|
18
18
|
CALL /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
@@ -25,7 +25,7 @@ class RuboCop::AST::NodePattern::LexerRex
|
|
25
25
|
|
26
26
|
# :stopdoc:
|
27
27
|
CONST_NAME = /[A-Z:][a-zA-Z_:]+/
|
28
|
-
SYMBOL_NAME = /[\w
|
28
|
+
SYMBOL_NAME = /[\w+@*\/?!<>=~|%^&-]+|\[\]=?/
|
29
29
|
IDENTIFIER = /[a-z][a-zA-Z0-9_]*/
|
30
30
|
NODE_TYPE = /[a-z][a-zA-Z0-9_-]*/
|
31
31
|
CALL = /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
|
@@ -226,7 +226,7 @@ module RuboCop
|
|
226
226
|
[ast, comments, tokens]
|
227
227
|
end
|
228
228
|
|
229
|
-
# rubocop:disable Metrics/MethodLength
|
229
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
230
230
|
def parser_class(ruby_version)
|
231
231
|
case ruby_version
|
232
232
|
when 2.4
|
@@ -247,12 +247,15 @@ module RuboCop
|
|
247
247
|
when 3.1
|
248
248
|
require 'parser/ruby31'
|
249
249
|
Parser::Ruby31
|
250
|
+
when 3.2
|
251
|
+
require 'parser/ruby32'
|
252
|
+
Parser::Ruby32
|
250
253
|
else
|
251
254
|
raise ArgumentError,
|
252
255
|
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
|
253
256
|
end
|
254
257
|
end
|
255
|
-
# rubocop:enable Metrics/MethodLength
|
258
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
256
259
|
|
257
260
|
def create_parser(ruby_version)
|
258
261
|
builder = RuboCop::AST::Builder.new
|
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.16.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:
|
13
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: 3.1.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 3.
|
28
|
+
version: 3.1.1.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.3.3
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: RuboCop tools to deal with Ruby code AST.
|