You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should detect all cases when used inside a hash or array.
Actual behavior
The Style/DoubleNegation cop does not detect double negations for the last line of a hash or array whe it is the returned value of a method. I think this is because of the allowed_in_returns setting, but I'm not entirely sure.
test.rb:5:10: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
foo: !!foo,
^
test.rb:12:5: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
!!foo,
^
test.rb:5:10: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
foo: !!foo,
^
test.rb:6:10: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
bar: !!bar
^
test.rb:14:5: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
!!foo,
^
test.rb:15:5: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
!!bar
^
Expected behavior
It should detect all cases when used inside a hash or array.
Actual behavior
The Style/DoubleNegation cop does not detect double negations for the last line of a hash or array whe it is the returned value of a method. I think this is because of the
allowed_in_returns
setting, but I'm not entirely sure.rubocop/lib/rubocop/cop/style/double_negation.rb
Lines 8 to 10 in 7dee99a
Steps to reproduce the problem
Simplified examples:
Only detects the offense on the lines for
foo
:Does not detect an offense at all:
Correctly detects the offense for all lines:
RuboCop version
The text was updated successfully, but these errors were encountered: