diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-29 09:08:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-29 09:08:03 +0000 |
commit | ad2789aeba21edaadcbdc06523462e6fd87d4ba1 (patch) | |
tree | 319403c595130a4f78fae367c7cedc88466dd9db /rubocop | |
parent | 2add640cfc67c927eb41cf542ef39ecda4c456c1 (diff) | |
download | gitlab-ce-ad2789aeba21edaadcbdc06523462e6fd87d4ba1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/migration/sidekiq_queue_migrate.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rubocop/cop/migration/sidekiq_queue_migrate.rb b/rubocop/cop/migration/sidekiq_queue_migrate.rb new file mode 100644 index 00000000000..134bda590da --- /dev/null +++ b/rubocop/cop/migration/sidekiq_queue_migrate.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative '../../migration_helpers' + +module RuboCop + module Cop + module Migration + # Cop that checks if sidekiq_queue_migrate is used in a regular + # (not post-deployment) migration. + class SidekiqQueueMigrate < RuboCop::Cop::Cop + include MigrationHelpers + + MSG = '`sidekiq_queue_migrate` must only be used in post-deployment migrations' + + def on_def(node) + return unless in_migration?(node) && !in_post_deployment_migration?(node) + + node.each_descendant(:send) do |send_node| + send_method = send_node.children[1] + + if send_method == :sidekiq_queue_migrate + add_offense(send_node, location: :selector) + end + end + end + end + end + end +end |