Skip to content

Add rubocop for deprecated advanced search migrations

Terri Chu requested to merge 412676-add-rubocop-for-deprecated-migrations into master

What does this MR do and why?

Related to #412676 (closed)

There is a comment in the migration to not use it to gate code with has_migration_finished?, but I thought a rubocop might be beter (and would allow us to prevent other migrations from being used in the future)

Issue to remove grace period: #415924 (closed)

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. add code to check migration_has_finished? for
diff --git a/ee/lib/elastic/latest/project_instance_proxy.rb b/ee/lib/elastic/latest/project_instance_proxy.rb
index 081bb9ce4f3e..a55ec9cf5134 100644
--- a/ee/lib/elastic/latest/project_instance_proxy.rb
+++ b/ee/lib/elastic/latest/project_instance_proxy.rb
@@ -45,7 +45,7 @@ def as_indexed_json(options = {})

         data['traversal_ids'] = target.elastic_namespace_ancestry

-        if ::Elastic::DataMigrationService.migration_has_finished?(:add_ci_catalog_to_project)
+        if ::Elastic::DataMigrationService.migration_has_finished?(:add_ci_catalog_to_project) && ::Elastic::DataMigrationService.migration_has_finished?(:backfill_project_permissions_in_blobs_using_permutations)
           data['ci_catalog'] = target.catalog_resource.present?
         end

  1. run rubocop and verify it reports the issue: rubocop ee/lib/elastic/latest/project_instance_proxy.rb
  2. I also tested without the :: to make sure it worked

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Terri Chu

Merge request reports