Autofix for Style/SoleNestedConditional
breaks my code, despite being flagged as safe
export RUBOCOP_TARGET_RUBY_VERSION=3.3 echo " if 'truthy' && assigned = '1' if '2' puts assigned end end " | rubocop --stdin user.rb --only 'Style/SoleNestedConditional' -aExpected behavior
Correction shouldn't change original code's behaviour (prints 1
), ie:
if 'truthy' && (assigned = '1') && '2' puts assigned endActual behavior
Correction changes original code's behaviour (prints 2
):
if 'truthy' && assigned = '1' && '2' puts assigned endSteps to reproduce the problem
As above
RuboCop version1.76.2 (using Parser 3.3.8.0, Prism 1.4.0, default, rubocop-ast 1.45.1, analyzing as Ruby 3.3, running on ruby 3.3.6) [x86_64-linux]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4