diff --git a/.rubocop_todo/layout/first_hash_element_indentation.yml b/.rubocop_todo/layout/first_hash_element_indentation.yml index 007616b40b18967b9997a02cdbac44201185a744..5f586cc62063d781555903973983aef4bc290897 100644 --- a/.rubocop_todo/layout/first_hash_element_indentation.yml +++ b/.rubocop_todo/layout/first_hash_element_indentation.yml @@ -9,7 +9,6 @@ Layout/FirstHashElementIndentation: - 'app/controllers/projects/badges_controller.rb' - 'app/controllers/projects/merge_requests_controller.rb' - 'app/controllers/repositories/lfs_locks_api_controller.rb' - - 'app/experiments/concerns/project_commit_count.rb' - 'app/graphql/mutations/notes/create/diff_note.rb' - 'app/graphql/mutations/notes/create/image_diff_note.rb' - 'app/graphql/mutations/notes/create/note.rb' diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml index 4407992851822c47352b0701d953a6db493edf36..7b9289307ca5936e89629a576adde868c6ce20c1 100644 --- a/.rubocop_todo/layout/line_length.yml +++ b/.rubocop_todo/layout/line_length.yml @@ -3303,7 +3303,6 @@ Layout/LineLength: - 'spec/controllers/uploads_controller_spec.rb' - 'spec/db/schema_spec.rb' - 'spec/deprecation_toolkit_env.rb' - - 'spec/experiments/concerns/project_commit_count_spec.rb' - 'spec/factories/ci/job_artifacts.rb' - 'spec/factories/ci/pipelines.rb' - 'spec/factories/ci/reports/codequality_degradations.rb' diff --git a/.rubocop_todo/lint/empty_block.yml b/.rubocop_todo/lint/empty_block.yml index 5751ca7641f5243d4b4db0e634f9aede5387bb93..dbcef42eab41aa4bb2386a6272b63d44912c7285 100644 --- a/.rubocop_todo/lint/empty_block.yml +++ b/.rubocop_todo/lint/empty_block.yml @@ -4,7 +4,6 @@ Lint/EmptyBlock: - 'app/controllers/groups/boards_controller.rb' - 'app/controllers/projects/boards_controller.rb' - 'app/controllers/projects/pipelines_controller.rb' - - 'app/experiments/logged_out_marketing_header_experiment.rb' - 'config/application.rb' - 'ee/app/controllers/projects/learn_gitlab_controller.rb' - 'ee/spec/factories/incident_management/escalation_rules.rb' diff --git a/.rubocop_todo/rspec/described_class.yml b/.rubocop_todo/rspec/described_class.yml index 94ef19d7cfe89eaeb1c4b67857f5b8b0bfa21e0c..7f0db541ab0bd16031e2db0b712314f322b9b000 100644 --- a/.rubocop_todo/rspec/described_class.yml +++ b/.rubocop_todo/rspec/described_class.yml @@ -46,7 +46,6 @@ RSpec/DescribedClass: - 'spec/config/settings_spec.rb' - 'spec/controllers/repositories/git_http_controller_spec.rb' - 'spec/experiments/application_experiment_spec.rb' - - 'spec/experiments/concerns/project_commit_count_spec.rb' - 'spec/frontend/fixtures/timezones.rb' - 'spec/graphql/gitlab_schema_spec.rb' - 'spec/graphql/graphql_triggers_spec.rb' diff --git a/.rubocop_todo/rspec/missing_feature_category.yml b/.rubocop_todo/rspec/missing_feature_category.yml index e6d4b68d2e6cfd178c0d192c3a560473c3519f06..4142bf7a42ee431053bb2b33fc7a57c898e01431 100644 --- a/.rubocop_todo/rspec/missing_feature_category.yml +++ b/.rubocop_todo/rspec/missing_feature_category.yml @@ -1804,8 +1804,6 @@ RSpec/MissingFeatureCategory: - 'spec/dependencies/omniauth_saml_spec.rb' - 'spec/docs_screenshots/container_registry_docs.rb' - 'spec/docs_screenshots/wiki_docs.rb' - - 'spec/experiments/concerns/project_commit_count_spec.rb' - - 'spec/experiments/force_company_trial_experiment_spec.rb' - 'spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb' - 'spec/experiments/ios_specific_templates_experiment_spec.rb' - 'spec/features/admin/dashboard_spec.rb' diff --git a/.rubocop_todo/rspec/verified_doubles.yml b/.rubocop_todo/rspec/verified_doubles.yml index d5430dabbf064fedba086c50a3c4acbfbe60f018..3b4d4bc9e94421c444e13824ac2232e666861191 100644 --- a/.rubocop_todo/rspec/verified_doubles.yml +++ b/.rubocop_todo/rspec/verified_doubles.yml @@ -260,7 +260,6 @@ RSpec/VerifiedDoubles: - 'spec/controllers/projects/snippets_controller_spec.rb' - 'spec/controllers/sessions_controller_spec.rb' - 'spec/dependencies/omniauth_saml_spec.rb' - - 'spec/experiments/concerns/project_commit_count_spec.rb' - 'spec/factories/ci/job_artifacts.rb' - 'spec/features/admin/admin_system_info_spec.rb' - 'spec/features/clusters/create_agent_spec.rb' diff --git a/app/experiments/concerns/project_commit_count.rb b/app/experiments/concerns/project_commit_count.rb deleted file mode 100644 index 3f08538c21f162f250ce95ac9a89f3bef04c4833..0000000000000000000000000000000000000000 --- a/app/experiments/concerns/project_commit_count.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module ProjectCommitCount - include Gitlab::Git::WrapsGitalyErrors - - def commit_count_for(project, default_count: 0, max_count: nil, **exception_details) - raw_repo = project.repository&.raw_repository - root_ref = raw_repo&.root_ref - - return default_count unless root_ref - - Gitlab::GitalyClient::CommitService.new(raw_repo).commit_count(root_ref, { - all: true, # include all branches - max_count: max_count # limit as an optimization - }) - rescue StandardError => e - Gitlab::ErrorTracking.track_exception(e, exception_details) - - default_count - end -end diff --git a/app/experiments/empty_repo_upload_experiment.rb b/app/experiments/empty_repo_upload_experiment.rb deleted file mode 100644 index c8c75f32d69c581ccba4e8209be73e3079594c3c..0000000000000000000000000000000000000000 --- a/app/experiments/empty_repo_upload_experiment.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class EmptyRepoUploadExperiment < ApplicationExperiment - include ProjectCommitCount - - TRACKING_START_DATE = DateTime.parse('2021/4/20') - INITIAL_COMMIT_COUNT = 1 - - def track_initial_write - return unless should_track? # early return if we don't need to ask for commit counts - return unless context.project.created_at > TRACKING_START_DATE # early return for older projects - return unless commit_count == INITIAL_COMMIT_COUNT - - track(:initial_write, project: context.project) - end - - private - - def commit_count - commit_count_for(context.project, max_count: INITIAL_COMMIT_COUNT, experiment: name) - end -end diff --git a/app/experiments/force_company_trial_experiment.rb b/app/experiments/force_company_trial_experiment.rb deleted file mode 100644 index e7b98bb18ad04e43796a9f22e2c29494b2d5ada6..0000000000000000000000000000000000000000 --- a/app/experiments/force_company_trial_experiment.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class ForceCompanyTrialExperiment < ApplicationExperiment - exclude :setup_for_personal - - private - - def setup_for_personal - !context.user.setup_for_company - end -end diff --git a/app/experiments/logged_out_marketing_header_experiment.rb b/app/experiments/logged_out_marketing_header_experiment.rb deleted file mode 100644 index 3d88d94aec402c9a0012d3fd6b04be3b00fee379..0000000000000000000000000000000000000000 --- a/app/experiments/logged_out_marketing_header_experiment.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class LoggedOutMarketingHeaderExperiment < ApplicationExperiment - # These default behaviors are overriden in ApplicationHelper and header - # template partial - control {} - candidate {} - variant(:trial_focused) {} -end diff --git a/spec/experiments/concerns/project_commit_count_spec.rb b/spec/experiments/concerns/project_commit_count_spec.rb deleted file mode 100644 index f5969ad62417ee73e314a765cd1af6a84e6e853c..0000000000000000000000000000000000000000 --- a/spec/experiments/concerns/project_commit_count_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ProjectCommitCount do - let(:klass) { Class.include(ProjectCommitCount) } - let(:instance) { klass.new } - - describe '#commit_count_for' do - subject { instance.commit_count_for(project, default_count: 42, caller_info: :identifiable) } - - let(:project) { create(:project, :repository) } - - context 'when a root_ref exists' do - it 'returns commit count from GitlayClient' do - allow(Gitlab::GitalyClient).to receive(:call).and_call_original - allow(Gitlab::GitalyClient).to receive(:call).with(anything, :commit_service, :count_commits, anything, anything) - .and_return(double(count: 4)) - - expect(subject).to eq(4) - end - end - - context 'when a root_ref does not exist' do - let(:project) { create(:project, :empty_repo) } - - it 'returns the default_count' do - expect(subject).to eq(42) - end - end - - it "handles exceptions by logging them with exception_details and returns the default_count" do - allow(Gitlab::GitalyClient).to receive(:call).and_call_original - allow(Gitlab::GitalyClient).to receive(:call).with(anything, :commit_service, :count_commits, anything, anything).and_raise(e = StandardError.new('_message_')) - - expect(Gitlab::ErrorTracking).to receive(:track_exception).with(e, { caller_info: :identifiable }) - - expect(subject).to eq(42) - end - end -end diff --git a/spec/experiments/force_company_trial_experiment_spec.rb b/spec/experiments/force_company_trial_experiment_spec.rb deleted file mode 100644 index 42a3245771aab92e33a75af4bcd32da71b84d502..0000000000000000000000000000000000000000 --- a/spec/experiments/force_company_trial_experiment_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ForceCompanyTrialExperiment, :experiment do - subject { described_class.new(current_user: user) } - - let(:user) { create(:user, setup_for_company: setup_for_company) } - let(:setup_for_company) { true } - - context 'when a user is setup_for_company' do - it 'is not excluded' do - expect(subject).not_to exclude(user: user) - end - end - - context 'when a user is not setup_for_company' do - let(:setup_for_company) { nil } - - it 'is excluded' do - expect(subject).to exclude(user: user) - end - end -end diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index c3e0dc43c9eed4dc02705e8bdd79d38573b1f035..9747dbea6468f03af26b980e50303245c15fa5d2 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -3536,8 +3536,6 @@ - './spec/db/schema_spec.rb' - './spec/dependencies/omniauth_saml_spec.rb' - './spec/experiments/application_experiment_spec.rb' -- './spec/experiments/concerns/project_commit_count_spec.rb' -- './spec/experiments/force_company_trial_experiment_spec.rb' - './spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb' - './spec/experiments/ios_specific_templates_experiment_spec.rb' - './spec/features/abuse_report_spec.rb'