-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flag break
in with_lock
for Rails/TransactionExitStatement
#1005
Flag break
in with_lock
for Rails/TransactionExitStatement
#1005
Conversation
5752ca7
to
5103efd
Compare
end | ||
RUBY | ||
end | ||
shared_examples 'flags transaction exit statements' do |method| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've extracted the existing specs into shared_examples
to make sure that all cases are covered.
!statement_node.ancestors.find(&:block_type?).method?(:transaction) | ||
block_node = statement_node.ancestors.find(&:block_type?) | ||
|
||
RESTRICT_ON_SEND.none? { |name| block_node.method?(name) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The crux of this PR where with_lock
was not checked and produced false negatives.
Can you update the doc to include |
Previously, the following code was not flagged but is considered problematic: ApplicationRecord.with_lock do break if user.active? end
5103efd
to
673d52e
Compare
@koic Done! I've only added a I suppose it's because the same resolution as for |
Thanks! |
Previously, the following code was not flagged but is considered problematic:
Refs:
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.