rubocop 1.54.0 → 1.54.1
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/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
- data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +10 -0
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +1 -0
- data/lib/rubocop/cop/variable_force/assignment.rb +14 -3
- data/lib/rubocop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c223b2bb07266543894d986f949feb9b6b0470bb43e511e82c8cdf12e9d48872
|
4
|
+
data.tar.gz: a785917f1251d60ebe36a2c41680e62a4b789ff40977b1b81a07e09c562c233c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56c5e545a2440c9994ea57547601d322f940f5dc3215d2e76fc6ef1b59b2bf0a9b73f49c370e9f6eebe1e449bcc71f0e018d8a3d6f70a40a6b585b9034d28aa0
|
7
|
+
data.tar.gz: 4c38b1ab3e73fc9cd1579f72331240f3eeebaad1f10ce126fe85f7f57bdba283476310104244b883d90d86c6b78fe1ad2b9ff17b6ff5eb8cc64cf0c3e341dc55
|
@@ -51,7 +51,9 @@ module RuboCop
|
|
51
51
|
|
52
52
|
def extract_receiver(node)
|
53
53
|
receiver = node.receiver
|
54
|
-
|
54
|
+
if receiver.send_type? && (receiver.method?(:loc) || receiver.method?(:source_range))
|
55
|
+
receiver = receiver.receiver
|
56
|
+
end
|
55
57
|
receiver.source
|
56
58
|
end
|
57
59
|
end
|
@@ -24,7 +24,15 @@ module RuboCop
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def kind(token)
|
27
|
-
'comma' if token.comma?
|
27
|
+
'comma' if token.comma? && !before_semicolon?(token)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def before_semicolon?(token)
|
33
|
+
tokens = processed_source.tokens
|
34
|
+
|
35
|
+
tokens[tokens.index(token) + 1].semicolon?
|
28
36
|
end
|
29
37
|
end
|
30
38
|
end
|
@@ -5,6 +5,14 @@ module RuboCop
|
|
5
5
|
module Lint
|
6
6
|
# Checks for redundant quantifiers inside Regexp literals.
|
7
7
|
#
|
8
|
+
# It is always allowed when interpolation is used in a regexp literal,
|
9
|
+
# because it's unknown what kind of string will be expanded as a result:
|
10
|
+
#
|
11
|
+
# [source,ruby]
|
12
|
+
# ----
|
13
|
+
# /(?:a*#{interpolation})?/x
|
14
|
+
# ----
|
15
|
+
#
|
8
16
|
# @example
|
9
17
|
# # bad
|
10
18
|
# /(?:x+)+/
|
@@ -32,6 +40,8 @@ module RuboCop
|
|
32
40
|
'with a single `%<replacement>s`.'
|
33
41
|
|
34
42
|
def on_regexp(node)
|
43
|
+
return if node.interpolation?
|
44
|
+
|
35
45
|
each_redundantly_quantified_pair(node) do |group, child|
|
36
46
|
replacement = merged_quantifier(group, child)
|
37
47
|
add_offense(
|
@@ -102,10 +102,11 @@ module RuboCop
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def multiple_assignment_node
|
105
|
-
grandparent_node = node.parent&.parent
|
106
|
-
|
105
|
+
return nil unless (grandparent_node = node.parent&.parent)
|
106
|
+
if (node = find_multiple_assignment_node(grandparent_node))
|
107
|
+
return node
|
108
|
+
end
|
107
109
|
return nil unless grandparent_node.type == MULTIPLE_ASSIGNMENT_TYPE
|
108
|
-
return nil unless node.parent.type == MULTIPLE_LEFT_HAND_SIDE_TYPE
|
109
110
|
|
110
111
|
grandparent_node
|
111
112
|
end
|
@@ -122,6 +123,16 @@ module RuboCop
|
|
122
123
|
|
123
124
|
node.parent
|
124
125
|
end
|
126
|
+
|
127
|
+
def find_multiple_assignment_node(grandparent_node)
|
128
|
+
return unless grandparent_node.type == MULTIPLE_LEFT_HAND_SIDE_TYPE
|
129
|
+
return if grandparent_node.children.any?(&:splat_type?)
|
130
|
+
|
131
|
+
parent = grandparent_node.parent
|
132
|
+
return parent if parent.type == MULTIPLE_ASSIGNMENT_TYPE
|
133
|
+
|
134
|
+
find_multiple_assignment_node(parent)
|
135
|
+
end
|
125
136
|
end
|
126
137
|
end
|
127
138
|
end
|
data/lib/rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.54.
|
4
|
+
version: 1.54.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-07-
|
13
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|