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: af243a553ad28a14173bdaad5e52f46e61c2d61096c6cab37ae41ccf88cad1ff
4
- data.tar.gz: efe4a129082e9e879501b01772d7708a80020ab71b10f24fc2ffff32819d50b3
3
+ metadata.gz: b0057db5077a3ded345dc26bc31452317c972d8646102835fe6f6452d2c09a99
4
+ data.tar.gz: 71a30cb395f16476d0e4150ef7de1e848a72a9df6c063d2fe63afa948328b56a
5
5
  SHA512:
6
- metadata.gz: 536ced62e51af2fa59a347dc416d0af919ebbe04335e37a2011d704c11821d170decaad13bc7f6abe59da23146cdc2be31820458941fa8272c59b266bb852dae
7
- data.tar.gz: 3087db4a3f808c630eaf850d1ac371cca4dda687fe1459cf5125e1fc49e55451b4c90fd9fdace47d93049bfa0d569138e361461ead47eac8503553907b47b32c
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
- # Allow if used as a flag (e.g., `if ENV['X']` or `!ENV['X']`) because
68
- # it simply checks whether the variable is set.
69
- # Also allow if receiving a message with dot syntax, e.g. `ENV['X'].nil?`.
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
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.28.0'
6
+ STRING = '1.28.1'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
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.28.0
4
+ version: 1.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov