Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/migration/with_lock_retries_without_ddl_transaction.rb')
-rw-r--r--rubocop/cop/migration/with_lock_retries_without_ddl_transaction.rb36
1 files changed, 0 insertions, 36 deletions
diff --git a/rubocop/cop/migration/with_lock_retries_without_ddl_transaction.rb b/rubocop/cop/migration/with_lock_retries_without_ddl_transaction.rb
deleted file mode 100644
index ebd91dd5a6e..00000000000
--- a/rubocop/cop/migration/with_lock_retries_without_ddl_transaction.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-require_relative '../../migration_helpers'
-
-module RuboCop
- module Cop
- module Migration
- # Cop that prevents usage of `with_lock_retries` with `disable_ddl_transaction!`
- class WithLockRetriesWithoutDdlTransaction < RuboCop::Cop::Cop
- include MigrationHelpers
-
- MSG = '`with_lock_retries` cannot be used with disabled DDL transactions (`disable_ddl_transaction!`). ' \
- 'Please remove the `disable_ddl_transaction!` call from your migration.'.freeze
-
- def_node_matcher :disable_ddl_transaction?, <<~PATTERN
- (send _ :disable_ddl_transaction!)
- PATTERN
-
- def_node_matcher :with_lock_retries?, <<~PATTERN
- (send _ :with_lock_retries)
- PATTERN
-
- def on_send(node)
- return unless in_migration?(node)
- return unless with_lock_retries?(node)
-
- node.each_ancestor(:begin) do |begin_node|
- disable_ddl_transaction_node = begin_node.children.find { |n| disable_ddl_transaction?(n) }
-
- add_offense(node, location: :expression) if disable_ddl_transaction_node
- end
- end
- end
- end
- end
-end