From 4fdd1d736b16545cb0ace22c65a97f3156f5e9a1 Mon Sep 17 00:00:00 2001 From: jejacks0n <jjackson@gitlab.com> Date: Thu, 3 Feb 2022 12:59:34 -0700 Subject: [PATCH] Allow experiment classed to not be namespaced This is because all experiments are so far circumventing the rule, as well as they may span an area of focus. The experiment feature flags can be useful for this, or we can choose to solve this challenge in a different and more nuanced way. --- .rubocop.yml | 1 + app/experiments/application_experiment.rb | 2 +- app/experiments/combined_registration_experiment.rb | 2 +- app/experiments/empty_repo_upload_experiment.rb | 2 +- app/experiments/force_company_trial_experiment.rb | 2 +- .../in_product_guidance_environments_webide_experiment.rb | 2 +- app/experiments/new_project_sast_enabled_experiment.rb | 2 +- .../require_verification_for_namespace_creation_experiment.rb | 2 +- app/experiments/security_reports_mr_widget_prompt_experiment.rb | 2 +- 9 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5757a2739265..1b2e7ea470a1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -666,6 +666,7 @@ Gitlab/NamespacedClass: - 'ee/elastic/**/*.rb' - 'scripts/**/*' - 'spec/migrations/**/*.rb' + - 'app/experiments/**/*_experiment.rb' Lint/HashCompareByIdentity: Enabled: true diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb index ec6762096ad0..f6af7ca15bb3 100644 --- a/app/experiments/application_experiment.rb +++ b/app/experiments/application_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/NamespacedClass +class ApplicationExperiment < Gitlab::Experiment def publish(_result = nil) super diff --git a/app/experiments/combined_registration_experiment.rb b/app/experiments/combined_registration_experiment.rb index 08c015838db4..576e10815aaf 100644 --- a/app/experiments/combined_registration_experiment.rb +++ b/app/experiments/combined_registration_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CombinedRegistrationExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class CombinedRegistrationExperiment < ApplicationExperiment include Rails.application.routes.url_helpers def key_for(source, _ = nil) diff --git a/app/experiments/empty_repo_upload_experiment.rb b/app/experiments/empty_repo_upload_experiment.rb index d0d79a5fb453..c8c75f32d69c 100644 --- a/app/experiments/empty_repo_upload_experiment.rb +++ b/app/experiments/empty_repo_upload_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class EmptyRepoUploadExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class EmptyRepoUploadExperiment < ApplicationExperiment include ProjectCommitCount TRACKING_START_DATE = DateTime.parse('2021/4/20') diff --git a/app/experiments/force_company_trial_experiment.rb b/app/experiments/force_company_trial_experiment.rb index 00bdd5d693dc..e7b98bb18ad0 100644 --- a/app/experiments/force_company_trial_experiment.rb +++ b/app/experiments/force_company_trial_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ForceCompanyTrialExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class ForceCompanyTrialExperiment < ApplicationExperiment exclude :setup_for_personal private diff --git a/app/experiments/in_product_guidance_environments_webide_experiment.rb b/app/experiments/in_product_guidance_environments_webide_experiment.rb index d77063a98345..6567ec0b3f1d 100644 --- a/app/experiments/in_product_guidance_environments_webide_experiment.rb +++ b/app/experiments/in_product_guidance_environments_webide_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class InProductGuidanceEnvironmentsWebideExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class InProductGuidanceEnvironmentsWebideExperiment < ApplicationExperiment exclude :has_environments? def control_behavior diff --git a/app/experiments/new_project_sast_enabled_experiment.rb b/app/experiments/new_project_sast_enabled_experiment.rb index a779b8ec6339..ee9d0dc17000 100644 --- a/app/experiments/new_project_sast_enabled_experiment.rb +++ b/app/experiments/new_project_sast_enabled_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class NewProjectSastEnabledExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class NewProjectSastEnabledExperiment < ApplicationExperiment def publish(_result = nil) super diff --git a/app/experiments/require_verification_for_namespace_creation_experiment.rb b/app/experiments/require_verification_for_namespace_creation_experiment.rb index 78390ddd0998..0c47f5d183c1 100644 --- a/app/experiments/require_verification_for_namespace_creation_experiment.rb +++ b/app/experiments/require_verification_for_namespace_creation_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class RequireVerificationForNamespaceCreationExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class RequireVerificationForNamespaceCreationExperiment < ApplicationExperiment exclude :existing_user EXPERIMENT_START_DATE = Date.new(2022, 1, 31) diff --git a/app/experiments/security_reports_mr_widget_prompt_experiment.rb b/app/experiments/security_reports_mr_widget_prompt_experiment.rb index fa0ba8e24d41..bcb9d64fcb74 100644 --- a/app/experiments/security_reports_mr_widget_prompt_experiment.rb +++ b/app/experiments/security_reports_mr_widget_prompt_experiment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SecurityReportsMrWidgetPromptExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass +class SecurityReportsMrWidgetPromptExperiment < ApplicationExperiment def publish(_result = nil) super -- GitLab