rubocop_canvas: fix add_reference non-transactional logic
we don't need to suggest `disable_ddl_transaction!` when adding a non-indexed reference fixes FOO-3298 test plan: specs Change-Id: I33ca47954e5760bf3f14d8b240891713f735eeda Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308301 Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Jeremy Stanley <jeremy@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
parent
1e0ee0640e
commit
2502fd32ce
|
@ -104,11 +104,12 @@ module RuboCop
|
|||
end
|
||||
|
||||
def check_add_reference(node)
|
||||
check_non_transactional
|
||||
|
||||
arg = index_argument(node).first
|
||||
if arg.nil? || (!false?(arg) && !algorithm_concurrently?(arg))
|
||||
add_offense arg || node, message: INDEX_ALGORITHM_CONCURRENTLY_MSG, severity: :warning
|
||||
if arg.nil? || !false?(arg)
|
||||
check_non_transactional
|
||||
if arg.nil? || !algorithm_concurrently?(arg)
|
||||
add_offense arg || node, message: INDEX_ALGORITHM_CONCURRENTLY_MSG, severity: :warning
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -145,7 +145,6 @@ describe RuboCop::Cop::Migration::AddIndex do
|
|||
it "doesn't complain if not indexed" do
|
||||
inspect_source(<<~RUBY)
|
||||
class TestMigration < ActiveRecord::Migration
|
||||
disable_ddl_transaction!
|
||||
def up
|
||||
add_reference :users, :organizations, index: false
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue