rubocop 1.28.0 → 1.28.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: b0057db5077a3ded345dc26bc31452317c972d8646102835fe6f6452d2c09a99
|
4
|
+
data.tar.gz: 71a30cb395f16476d0e4150ef7de1e848a72a9df6c063d2fe63afa948328b56a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b960489ce8a90ea9bee84376021229f5f66c3ff76bb331f4e6678012ec1052a1b489008a59769728fd0f1c6ad56056230bffe4fae6136076c1b5ca6a455c3f
|
7
|
+
data.tar.gz: b43334414d5d99618a4102677e50c8d5bd3dd7a1657a2cdc626fb84dec220faa2a8d876df631416e4897f382140d4ee0d095d0fc4969255b3047a25fa9fd2fbc
|
@@ -157,6 +157,7 @@ module RuboCop
|
|
157
157
|
def omit_length(descendant)
|
158
158
|
parent = descendant.parent
|
159
159
|
return 0 if another_args?(parent)
|
160
|
+
return 0 unless parenthesized?(parent)
|
160
161
|
|
161
162
|
[
|
162
163
|
parent.loc.begin.end_pos != descendant.loc.expression.begin_pos,
|
@@ -164,6 +165,10 @@ module RuboCop
|
|
164
165
|
].count(true)
|
165
166
|
end
|
166
167
|
|
168
|
+
def parenthesized?(node)
|
169
|
+
node.call_type? && node.parenthesized?
|
170
|
+
end
|
171
|
+
|
167
172
|
def another_args?(node)
|
168
173
|
node.call_type? && node.arguments.count > 1
|
169
174
|
end
|
@@ -64,11 +64,14 @@ module RuboCop
|
|
64
64
|
node.parent.send_type? && node.parent.children.first == node && node.parent.dot?
|
65
65
|
end
|
66
66
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
67
|
+
# The following are allowed cases:
|
68
|
+
#
|
69
|
+
# - Used as a flag (e.g., `if ENV['X']` or `!ENV['X']`) because
|
70
|
+
# it simply checks whether the variable is set.
|
71
|
+
# - Receiving a message with dot syntax, e.g. `ENV['X'].nil?`.
|
72
|
+
# - `ENV['key']` is a receiver of `||=`, e.g. `ENV['X'] ||= y`.
|
70
73
|
def allowable_use?(node)
|
71
|
-
used_as_flag?(node) || message_chained_with_dot?(node)
|
74
|
+
used_as_flag?(node) || message_chained_with_dot?(node) || node.parent&.or_asgn_type?
|
72
75
|
end
|
73
76
|
end
|
74
77
|
end
|
data/lib/rubocop/version.rb
CHANGED