-
-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Similar to #658 but using a until loop rather than loop:
ApplicationRecord.transaction do
until stop_looping?
break if condition
do_something
end
endhas offence:
Inspecting 1 file
C
Offenses:
loop.rb:3:5: C: Rails/TransactionExitStatement: Exit statement break is not allowed. Use raise (rollback) or next (commit).
break if condition
^^^^^
1 file inspected, 1 offense detected
Expected behavior
No offense - the break affects the until not the transaction.
Actual behavior
Offense found.
Steps to reproduce the problem
Code as above
RuboCop version
$ bundle exec rubocop -V
1.77.0 (using Parser 3.3.8.0, rubocop-ast 1.45.1, analyzing as Ruby 2.7, running on ruby 3.3.7) [arm64-darwin24]
- rubocop-performance 1.24.0
- rubocop-rails 2.32.0
- rubocop-rspec 3.3.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working