-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
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
end
Expected behavior
Should not change this block of code at all
Actual behavior
The 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
.
Steps to reproduce the problem
Use above code sample in file.rb, and run rubocop -A file.rb
RuboCop version
› 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