-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
cop incorrectly reports when using &. and comparators.
[Before rubocop -a]
code:
value = 100
puts (value&.> 10) ? 1000 : 2000
value = nil
puts (value&.> 10) ? 1000 : 2000result:
1000
2000
[After rubocop -a]
code:
value = 100
puts value&.> 10 ? 1000 : 2000
value = nil
puts value&.> 10 ? 1000 : 2000result:
false
Expected behavior
cop should not report Style/TernaryParentheses. Additionally, do not auto-correct.
Actual behavior
C: [Correctable] Style/TernaryParentheses: Omit parentheses for ternary conditions.
puts (value&.> 10) ? 1000 : 2000
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Steps to reproduce the problem
execute rubocop -a
RuboCop version
1.67.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]