def testing attempts ||= 1 do_something rescue Exception1 => e raise e if attempts > 2 # does something attempts += 1 retry rescue Exception2 => e raise e if attempts > 2 # does something attempts += 1 retry endExpected behavior
Should not change this block of code at all
Actual behaviorThe cop makes the first instance of attempts += 1
into attempts + 1
, which then splits into attempts\n1
, which then gets removed entirely by Lint/Void
.
Use above code sample in file.rb, and run rubocop -A file.rb
› bundle exec rubocop -V
1.79.0 (using Parser 3.3.9.0, Prism 1.4.0, parser_prism, rubocop-ast 1.46.0, analyzing as Ruby 3.4, running on ruby 3.4.4) [arm64-darwin24]
- rubocop-rails 2.32.0
- rubocop-performance 1.25.0
- rubocop-rspec 3.6.0
- rubocop-rspec_rails 2.31.0
- rubocop-factory_bot 2.27.1
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