Skip to content

Conversation

@koic
Copy link
Member

@koic koic commented Mar 16, 2022

Fixes #658.

This PR fixes a false positive for Rails/TransactionExitStatement when break is used in loop in transactions.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@koic koic force-pushed the fix_a_false_positive_for_rails_transaction_exit_statement branch 2 times, most recently from 3bdd8df to de664fa Compare March 16, 2022 04:26
@koic koic changed the title [Fix #658] Fix an false positive for Rails/TransactionExitStatement [Fix #658] Fix a false positive for Rails/TransactionExitStatement Mar 16, 2022
RUBY
end

it 'does not register an offense when `raise` is used in `loop` in transactions' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this refer to break rather than raise?

Suggested change
it 'does not register an offense when `raise` is used in `loop` in transactions' do
it 'does not register an offense when `break` is used in `loop` in transactions' do

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Thank you!

…ement`

Fixes rubocop#658.

This PR fixes a false positive for `Rails/TransactionExitStatement`
when `break` is used in `loop` in transactions.
@koic koic force-pushed the fix_a_false_positive_for_rails_transaction_exit_statement branch from de664fa to 583175c Compare March 16, 2022 10:42
@koic koic merged commit d2ce35d into rubocop:master Mar 16, 2022
@koic koic deleted the fix_a_false_positive_for_rails_transaction_exit_statement branch March 16, 2022 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rails/TransactionExitStatement false positive when mixing transaction and other blocks

2 participants