From 44e936cfbd09a3f9d30a492889d1494b378f4214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiago=20Figueir=C3=B3?= <tfigueiro@gitlab.com> Date: Fri, 26 Aug 2022 04:22:52 +0000 Subject: [PATCH] Fix Layout/HashAlignment offenses 39 --- .rubocop_todo/layout/hash_alignment.yml | 20 ------- .../gitlab/metrics/web_transaction_spec.rb | 4 +- spec/lib/gitlab/omniauth_initializer_spec.rb | 12 ++-- .../sidekiq_daemon/memory_killer_spec.rb | 4 +- spec/lib/gitlab/sidekiq_death_handler_spec.rb | 8 +-- .../sidekiq_middleware/server_metrics_spec.rb | 48 +++++++-------- spec/lib/gitlab/slug/environment_spec.rb | 26 ++++----- spec/lib/gitlab/tracking_spec.rb | 24 ++++++-- spec/lib/gitlab/usage_data/topology_spec.rb | 16 ++--- ...ge_request_activity_unique_counter_spec.rb | 4 +- .../usage_data_counters/note_counter_spec.rb | 2 +- spec/lib/gitlab/usage_data_spec.rb | 8 +-- spec/lib/gitlab/utils_spec.rb | 2 +- spec/lib/gitlab/word_diff/parser_spec.rb | 18 +++--- spec/lib/marginalia_spec.rb | 20 +++---- .../sast_build_action_spec.rb | 58 +++++++++---------- spec/mailers/emails/pipelines_spec.rb | 4 +- ...150320_create_base_work_item_types_spec.rb | 6 +- ...203408_upsert_base_work_item_types_spec.rb | 6 +- ...igrate_remaining_u2f_registrations_spec.rb | 12 ++-- ...204445_add_task_to_work_item_types_spec.rb | 8 +-- spec/models/ci/pipeline_spec.rb | 36 +++--------- spec/models/commit_status_spec.rb | 10 +--- .../clusters/cluster_presenter_spec.rb | 26 +++++---- 24 files changed, 175 insertions(+), 207 deletions(-) diff --git a/.rubocop_todo/layout/hash_alignment.yml b/.rubocop_todo/layout/hash_alignment.yml index 11f9ee53e67fe..b09539144d917 100644 --- a/.rubocop_todo/layout/hash_alignment.yml +++ b/.rubocop_todo/layout/hash_alignment.yml @@ -96,26 +96,6 @@ Layout/HashAlignment: - 'spec/lib/gitlab/metrics/subscribers/action_view_spec.rb' - 'spec/lib/gitlab/metrics/subscribers/active_record_spec.rb' - 'spec/lib/gitlab/metrics/subscribers/load_balancing_spec.rb' - - 'spec/lib/gitlab/metrics/web_transaction_spec.rb' - - 'spec/lib/gitlab/omniauth_initializer_spec.rb' - - 'spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb' - - 'spec/lib/gitlab/sidekiq_death_handler_spec.rb' - - 'spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb' - - 'spec/lib/gitlab/slug/environment_spec.rb' - - 'spec/lib/gitlab/tracking_spec.rb' - - 'spec/lib/gitlab/usage_data/topology_spec.rb' - - 'spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb' - - 'spec/lib/gitlab/usage_data_counters/note_counter_spec.rb' - - 'spec/lib/gitlab/usage_data_spec.rb' - - 'spec/lib/gitlab/utils_spec.rb' - - 'spec/lib/gitlab/word_diff/parser_spec.rb' - - 'spec/lib/marginalia_spec.rb' - - 'spec/lib/security/ci_configuration/sast_build_action_spec.rb' - - 'spec/mailers/emails/pipelines_spec.rb' - - 'spec/migrations/20210804150320_create_base_work_item_types_spec.rb' - - 'spec/migrations/20210831203408_upsert_base_work_item_types_spec.rb' - - 'spec/migrations/20211117084814_migrate_remaining_u2f_registrations_spec.rb' - - 'spec/migrations/20211126204445_add_task_to_work_item_types_spec.rb' - 'spec/models/ci/build_spec.rb' - 'spec/models/ci/pipeline_spec.rb' - 'spec/models/ci/processable_spec.rb' diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb index d6590efcf4fde..dc59fa804c4f2 100644 --- a/spec/lib/gitlab/metrics/web_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb @@ -66,8 +66,8 @@ before do route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)') endpoint = double(:endpoint, route: route, - options: { for: API::Projects, path: [":id/archive"] }, - namespace: "/projects") + options: { for: API::Projects, path: [":id/archive"] }, + namespace: "/projects") env['api.endpoint'] = endpoint diff --git a/spec/lib/gitlab/omniauth_initializer_spec.rb b/spec/lib/gitlab/omniauth_initializer_spec.rb index c91b14a33ba02..563c97fa2cbc2 100644 --- a/spec/lib/gitlab/omniauth_initializer_spec.rb +++ b/spec/lib/gitlab/omniauth_initializer_spec.rb @@ -31,7 +31,7 @@ context 'when there is an app_id and an app_secret, and an array of args' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'app_id' => 1, 'app_secret' => 2, 'args' => %w[one two three] @@ -46,7 +46,7 @@ context 'when there is an app_id and an app_secret, and an array of args, and default values' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'app_id' => 1, 'app_secret' => 2, 'args' => %w[one two three] @@ -68,7 +68,7 @@ context 'when there is an app_id and an app_secret, and a hash of args' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'app_id' => 1, 'app_secret' => 2, 'args' => { 'foo' => 100, 'bar' => 200, 'nested' => { 'value' => 300 } } @@ -84,7 +84,7 @@ context 'when there is an app_id and an app_secret, and a hash of args, and default arguments' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'app_id' => 1, 'app_secret' => 2, 'args' => { 'foo' => 100, 'bar' => 200, 'nested' => { 'value' => 300 } } @@ -106,7 +106,7 @@ context 'when there is an app_id and an app_secret, no args, and default values' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'app_id' => 1, 'app_secret' => 2 } @@ -127,7 +127,7 @@ context 'when there are args, of an unsupported type' do let(:provider) do { - 'name' => 'unknown', + 'name' => 'unknown', 'args' => 1 } end diff --git a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb index 635f572daef04..dff04a2e5093c 100644 --- a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb +++ b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb @@ -326,7 +326,7 @@ class: described_class.to_s, signal: signal, pid: pid, - message: "sending Sidekiq worker PID-#{pid} #{signal} (#{explanation})") + message: "sending Sidekiq worker PID-#{pid} #{signal} (#{explanation})") expect(Process).to receive(:kill).with(signal, pid).ordered subject @@ -340,7 +340,7 @@ class: described_class.to_s, signal: signal, pid: pid, - message: "sending Sidekiq worker PGRP-#{pid} #{signal} (#{explanation})") + message: "sending Sidekiq worker PGRP-#{pid} #{signal} (#{explanation})") expect(Process).to receive(:kill).with(signal, 0).ordered subject diff --git a/spec/lib/gitlab/sidekiq_death_handler_spec.rb b/spec/lib/gitlab/sidekiq_death_handler_spec.rb index e3f9f8277a070..434642bf3efe2 100644 --- a/spec/lib/gitlab/sidekiq_death_handler_spec.rb +++ b/spec/lib/gitlab/sidekiq_death_handler_spec.rb @@ -24,8 +24,8 @@ expect(described_class.counter) .to receive(:increment) .with({ queue: 'test_queue', worker: 'TestWorker', - urgency: 'low', external_dependencies: 'yes', - feature_category: 'users', boundary: 'cpu' }) + urgency: 'low', external_dependencies: 'yes', + feature_category: 'users', boundary: 'cpu' }) described_class.handler({ 'class' => 'TestWorker', 'queue' => 'test_queue' }, nil) end @@ -40,8 +40,8 @@ expect(described_class.counter) .to receive(:increment) .with({ queue: 'test_queue', worker: 'TestWorker', - urgency: '', external_dependencies: 'no', - feature_category: '', boundary: '' }) + urgency: '', external_dependencies: 'no', + feature_category: '', boundary: '' }) described_class.handler({ 'class' => 'TestWorker', 'queue' => 'test_queue' }, nil) end diff --git a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb index d6d24ea3a2433..52b50a143fcab 100644 --- a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb @@ -22,39 +22,39 @@ expect(completion_seconds_metric) .to receive(:get).with({ queue: 'merge', - worker: 'MergeWorker', - urgency: 'high', - external_dependencies: 'no', - feature_category: 'source_code_management', - boundary: '', - job_status: 'done' }) + worker: 'MergeWorker', + urgency: 'high', + external_dependencies: 'no', + feature_category: 'source_code_management', + boundary: '', + job_status: 'done' }) expect(completion_seconds_metric) .to receive(:get).with({ queue: 'merge', - worker: 'MergeWorker', - urgency: 'high', - external_dependencies: 'no', - feature_category: 'source_code_management', - boundary: '', - job_status: 'fail' }) + worker: 'MergeWorker', + urgency: 'high', + external_dependencies: 'no', + feature_category: 'source_code_management', + boundary: '', + job_status: 'fail' }) expect(completion_seconds_metric) .to receive(:get).with({ queue: 'default', - worker: 'Ci::BuildFinishedWorker', - urgency: 'high', - external_dependencies: 'no', - feature_category: 'continuous_integration', - boundary: 'cpu', - job_status: 'done' }) + worker: 'Ci::BuildFinishedWorker', + urgency: 'high', + external_dependencies: 'no', + feature_category: 'continuous_integration', + boundary: 'cpu', + job_status: 'done' }) expect(completion_seconds_metric) .to receive(:get).with({ queue: 'default', - worker: 'Ci::BuildFinishedWorker', - urgency: 'high', - external_dependencies: 'no', - feature_category: 'continuous_integration', - boundary: 'cpu', - job_status: 'fail' }) + worker: 'Ci::BuildFinishedWorker', + urgency: 'high', + external_dependencies: 'no', + feature_category: 'continuous_integration', + boundary: 'cpu', + job_status: 'fail' }) described_class.initialize_process_metrics end diff --git a/spec/lib/gitlab/slug/environment_spec.rb b/spec/lib/gitlab/slug/environment_spec.rb index 5456501eb8b47..e8f0fba27b256 100644 --- a/spec/lib/gitlab/slug/environment_spec.rb +++ b/spec/lib/gitlab/slug/environment_spec.rb @@ -7,21 +7,21 @@ { "staging-12345678901234567" => "staging-123456789-q517sa", "9-staging-123456789012345" => "env-9-staging-123-q517sa", - "staging-1234567890123456" => "staging-1234567890123456", + "staging-1234567890123456" => "staging-1234567890123456", "staging-1234567890123456-" => "staging-123456789-q517sa", - "production" => "production", - "PRODUCTION" => "production-q517sa", - "review/1-foo" => "review-1-foo-q517sa", - "1-foo" => "env-1-foo-q517sa", - "1/foo" => "env-1-foo-q517sa", - "foo-" => "foo", - "foo--bar" => "foo-bar-q517sa", - "foo**bar" => "foo-bar-q517sa", - "*-foo" => "env-foo-q517sa", - "staging-12345678-" => "staging-12345678", + "production" => "production", + "PRODUCTION" => "production-q517sa", + "review/1-foo" => "review-1-foo-q517sa", + "1-foo" => "env-1-foo-q517sa", + "1/foo" => "env-1-foo-q517sa", + "foo-" => "foo", + "foo--bar" => "foo-bar-q517sa", + "foo**bar" => "foo-bar-q517sa", + "*-foo" => "env-foo-q517sa", + "staging-12345678-" => "staging-12345678", "staging-12345678-01234567" => "staging-12345678-q517sa", - "" => "env-q517sa", - nil => "env-q517sa" + "" => "env-q517sa", + nil => "env-q517sa" }.each do |name, matcher| before do # ('a' * 64).to_i(16).to_s(36).last(6) gives 'q517sa' diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 028c985f3b384..7f30d794aeee1 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -132,9 +132,16 @@ expect(args[:context].last).to eq(other_context) end - described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5, - context: [other_context], project: project, user: user, namespace: namespace, - extra_key_1: 'extra value 1', extra_key_2: 'extra value 2') + described_class.event('category', 'action', + label: 'label', + property: 'property', + value: 1.5, + context: [other_context], + project: project, + user: user, + namespace: namespace, + extra_key_1: 'extra value 1', + extra_key_2: 'extra value 2') end end @@ -197,8 +204,15 @@ expect(args[:extra_key_1]).to eq('extra value 1') end - described_class.definition('filename', category: nil, action: nil, label: 'label', property: '...', - project: project, user: user, namespace: namespace, extra_key_1: 'extra value 1') + described_class.definition('filename', + category: nil, + action: nil, + label: 'label', + property: '...', + project: project, + user: user, + namespace: namespace, + extra_key_1: 'extra value 1') end end diff --git a/spec/lib/gitlab/usage_data/topology_spec.rb b/spec/lib/gitlab/usage_data/topology_spec.rb index 737580e349333..dfdf8eaabe817 100644 --- a/spec/lib/gitlab/usage_data/topology_spec.rb +++ b/spec/lib/gitlab/usage_data/topology_spec.rb @@ -187,7 +187,7 @@ [ { 'metric' => { 'instance' => 'localhost:9100' }, - 'value' => [1000, '512'] + 'value' => [1000, '512'] } ] end @@ -196,7 +196,7 @@ [ { 'metric' => { 'instance' => 'localhost:9100' }, - 'value' => [1000, '0.35'] + 'value' => [1000, '0.35'] } ] end @@ -224,23 +224,23 @@ [ { 'metric' => { 'instance' => 'localhost:8080', 'job' => 'gitlab-rails' }, - 'value' => [1000, '10'] + 'value' => [1000, '10'] }, { 'metric' => { 'instance' => '127.0.0.1:8090', 'job' => 'gitlab-sidekiq' }, - 'value' => [1000, '11'] + 'value' => [1000, '11'] }, { 'metric' => { 'instance' => '0.0.0.0:9090', 'job' => 'prometheus' }, - 'value' => [1000, '12'] + 'value' => [1000, '12'] }, { 'metric' => { 'instance' => '[::1]:1234', 'job' => 'redis' }, - 'value' => [1000, '13'] + 'value' => [1000, '13'] }, { 'metric' => { 'instance' => '[::]:1234', 'job' => 'postgres' }, - 'value' => [1000, '14'] + 'value' => [1000, '14'] } ] end @@ -640,7 +640,7 @@ def receive_node_service_memory_rss_query(result: nil) .and_return(result || [ { 'metric' => { 'instance' => 'instance1:8080', 'job' => 'gitlab-rails' }, - 'value' => [1000, '300'] + 'value' => [1000, '300'] }, { 'metric' => { 'instance' => 'instance1:8090', 'job' => 'gitlab-sidekiq' }, diff --git a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb index 3f44cfdcf2743..74e63d219bdd4 100644 --- a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb @@ -100,9 +100,9 @@ subject expect_snowplow_event( - category: 'merge_requests', + category: 'merge_requests', action: 'i_code_review_user_approve_mr', - namespace: target_project.namespace, + namespace: target_project.namespace, user: user, project: target_project ) diff --git a/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb index 7e8f0172e06fe..687f8c2cd411c 100644 --- a/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb @@ -41,7 +41,7 @@ let(:expected_totals) do { snippet_comment: 3, merge_request_comment: 4, - commit_comment: 5 } + commit_comment: 5 } end before do diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 692b648314921..3b0cc0fb16b14 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -583,10 +583,10 @@ def omniauth_providers it 'gathers object store usage correctly' do expect(subject[:object_store]).to eq( { artifacts: { enabled: true, object_store: { enabled: true, direct_upload: true, background_upload: false, provider: "AWS" } }, - external_diffs: { enabled: false }, - lfs: { enabled: true, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } }, - uploads: { enabled: nil, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } }, - packages: { enabled: true, object_store: { enabled: false, direct_upload: false, background_upload: true, provider: "AWS" } } } + external_diffs: { enabled: false }, + lfs: { enabled: true, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } }, + uploads: { enabled: nil, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } }, + packages: { enabled: true, object_store: { enabled: false, direct_upload: false, background_upload: true, provider: "AWS" } } } ) end diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb index ad1a65ffae8c1..61323f0646b6d 100644 --- a/spec/lib/gitlab/utils_spec.rb +++ b/spec/lib/gitlab/utils_spec.rb @@ -174,7 +174,7 @@ { 'TEST' => 'test', 'project_with_underscores' => 'project-with-underscores', - 'namespace/project' => 'namespace-project', + 'namespace/project' => 'namespace-project', 'a' * 70 => 'a' * 63, 'test_trailing_' => 'test-trailing' }.each do |original, expected| diff --git a/spec/lib/gitlab/word_diff/parser_spec.rb b/spec/lib/gitlab/word_diff/parser_spec.rb index 915c3f5a0f980..18109a8160be4 100644 --- a/spec/lib/gitlab/word_diff/parser_spec.rb +++ b/spec/lib/gitlab/word_diff/parser_spec.rb @@ -42,18 +42,18 @@ { index: 1, old_pos: 2, new_pos: 2, text: 'Unchanged line', type: nil, marker_ranges: [] }, { index: 2, old_pos: 3, new_pos: 3, text: '', type: nil, marker_ranges: [] }, { index: 3, old_pos: 4, new_pos: 4, text: 'Old changeNew addition unchanged content', type: nil, - marker_ranges: [ - Gitlab::MarkerRange.new(0, 9, mode: :deletion), - Gitlab::MarkerRange.new(10, 21, mode: :addition) - ] }, + marker_ranges: [ + Gitlab::MarkerRange.new(0, 9, mode: :deletion), + Gitlab::MarkerRange.new(10, 21, mode: :addition) + ] }, { index: 4, old_pos: 50, new_pos: 50, text: '@@ -50,14 +50,13 @@', type: 'match', marker_ranges: [] }, { index: 5, old_pos: 50, new_pos: 50, text: 'First change same same same_removed_added_end of the line', type: nil, - marker_ranges: [ - Gitlab::MarkerRange.new(0, 11, mode: :addition), - Gitlab::MarkerRange.new(28, 35, mode: :deletion), - Gitlab::MarkerRange.new(36, 41, mode: :addition) - ] }, + marker_ranges: [ + Gitlab::MarkerRange.new(0, 11, mode: :addition), + Gitlab::MarkerRange.new(28, 35, mode: :deletion), + Gitlab::MarkerRange.new(36, 41, mode: :addition) + ] }, { index: 6, old_pos: 51, new_pos: 51, text: '', type: nil, marker_ranges: [] } ] diff --git a/spec/lib/marginalia_spec.rb b/spec/lib/marginalia_spec.rb index 59add4e8347d2..5f405e71d79d9 100644 --- a/spec/lib/marginalia_spec.rb +++ b/spec/lib/marginalia_spec.rb @@ -45,8 +45,8 @@ def first_user let(:component_map) do { - "application" => "test", - "endpoint_id" => "MarginaliaTestController#first_user", + "application" => "test", + "endpoint_id" => "MarginaliaTestController#first_user", "correlation_id" => correlation_id, "db_config_name" => "main" } @@ -62,8 +62,8 @@ def first_user let(:recorded) { ActiveRecord::QueryRecorder.new { make_request(correlation_id, :first_ci_pipeline) } } let(:component_map) do { - "application" => "test", - "endpoint_id" => "MarginaliaTestController#first_ci_pipeline", + "application" => "test", + "endpoint_id" => "MarginaliaTestController#first_ci_pipeline", "correlation_id" => correlation_id, "db_config_name" => 'ci' } @@ -104,10 +104,10 @@ def first_user let(:component_map) do { - "application" => "sidekiq", - "endpoint_id" => "MarginaliaTestJob", + "application" => "sidekiq", + "endpoint_id" => "MarginaliaTestJob", "correlation_id" => sidekiq_job['correlation_id'], - "jid" => sidekiq_job['jid'], + "jid" => sidekiq_job['jid'], "db_config_name" => "main" } end @@ -129,9 +129,9 @@ def first_user let(:component_map) do { - "application" => "sidekiq", - "endpoint_id" => "ActionMailer::MailDeliveryJob", - "jid" => delivery_job.job_id, + "application" => "sidekiq", + "endpoint_id" => "ActionMailer::MailDeliveryJob", + "jid" => delivery_job.job_id, "db_config_name" => "main" } end diff --git a/spec/lib/security/ci_configuration/sast_build_action_spec.rb b/spec/lib/security/ci_configuration/sast_build_action_spec.rb index 611a886d25231..381ea60e7f59c 100644 --- a/spec/lib/security/ci_configuration/sast_build_action_spec.rb +++ b/spec/lib/security/ci_configuration/sast_build_action_spec.rb @@ -33,12 +33,12 @@ params.merge( { analyzers: [ { - name: "bandit", - enabled: false + name: "bandit", + enabled: false }, { - name: "brakeman", - enabled: true, + name: "brakeman", + enabled: true, variables: [ { field: "SAST_BRAKEMAN_LEVEL", default_value: "1", @@ -46,8 +46,8 @@ ] }, { - name: "flawfinder", - enabled: true, + name: "flawfinder", + enabled: true, variables: [ { field: "SAST_FLAWFINDER_LEVEL", default_value: "1", @@ -62,12 +62,12 @@ params.merge( { analyzers: [ { - name: "flawfinder", - enabled: true + name: "flawfinder", + enabled: true }, { - name: "brakeman", - enabled: true + name: "brakeman", + enabled: true } ] } ) @@ -219,49 +219,49 @@ def existing_gitlab_ci_and_template_array_without_sast { "stages" => %w(test security), - "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, - "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, - "include" => [{ "template" => "existing.yml" }] } + "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, + "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, + "include" => [{ "template" => "existing.yml" }] } end def existing_gitlab_ci_and_single_template_with_sast_and_default_stage { "stages" => %w(test), - "variables" => { "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, - "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "test" }, - "include" => { "template" => "Security/SAST.gitlab-ci.yml" } } + "variables" => { "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, + "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "test" }, + "include" => { "template" => "Security/SAST.gitlab-ci.yml" } } end def existing_gitlab_ci_and_single_template_without_sast { "stages" => %w(test security), - "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, - "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, - "include" => { "template" => "existing.yml" } } + "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, + "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, + "include" => { "template" => "existing.yml" } } end def existing_gitlab_ci_with_no_variables { "stages" => %w(test security), - "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, - "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } + "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, + "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } end def existing_gitlab_ci_with_no_sast_section { "stages" => %w(test security), - "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, - "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } + "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, + "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } end def existing_gitlab_ci_with_no_sast_variables { "stages" => %w(test security), - "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, - "sast" => { "stage" => "security" }, - "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } + "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" }, + "sast" => { "stage" => "security" }, + "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } end def existing_gitlab_ci { "stages" => %w(test security), - "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "bad_prefix" }, - "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, - "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } + "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "bad_prefix" }, + "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" }, + "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] } end end diff --git a/spec/mailers/emails/pipelines_spec.rb b/spec/mailers/emails/pipelines_spec.rb index 3a2eb105964c9..1ac989cc46b1e 100644 --- a/spec/mailers/emails/pipelines_spec.rb +++ b/spec/mailers/emails/pipelines_spec.rb @@ -26,7 +26,7 @@ let!(:merge_request) do create(:merge_request, source_branch: 'master', target_branch: 'feature', - source_project: project, target_project: project) + source_project: project, target_project: project) end it 'has correct information that there is no merge request link' do @@ -56,7 +56,7 @@ context 'when branch pipeline is set to a merge request as a head pipeline' do let(:pipeline) do create(:ci_pipeline, project: project, ref: ref, sha: sha, - merge_requests_as_head_pipeline: [merge_request]) + merge_requests_as_head_pipeline: [merge_request]) end let(:merge_request) do diff --git a/spec/migrations/20210804150320_create_base_work_item_types_spec.rb b/spec/migrations/20210804150320_create_base_work_item_types_spec.rb index 6df8e1b2ebf0e..ae510826fe13e 100644 --- a/spec/migrations/20210804150320_create_base_work_item_types_spec.rb +++ b/spec/migrations/20210804150320_create_base_work_item_types_spec.rb @@ -10,9 +10,9 @@ let(:base_types) do { - issue: 0, - incident: 1, - test_case: 2, + issue: 0, + incident: 1, + test_case: 2, requirement: 3 } end diff --git a/spec/migrations/20210831203408_upsert_base_work_item_types_spec.rb b/spec/migrations/20210831203408_upsert_base_work_item_types_spec.rb index 1957a973ee124..552602983d9fc 100644 --- a/spec/migrations/20210831203408_upsert_base_work_item_types_spec.rb +++ b/spec/migrations/20210831203408_upsert_base_work_item_types_spec.rb @@ -10,9 +10,9 @@ let(:base_types) do { - issue: 0, - incident: 1, - test_case: 2, + issue: 0, + incident: 1, + test_case: 2, requirement: 3 } end diff --git a/spec/migrations/20211117084814_migrate_remaining_u2f_registrations_spec.rb b/spec/migrations/20211117084814_migrate_remaining_u2f_registrations_spec.rb index 6a82ed016af2d..ef6dd94d9e359 100644 --- a/spec/migrations/20211117084814_migrate_remaining_u2f_registrations_spec.rb +++ b/spec/migrations/20211117084814_migrate_remaining_u2f_registrations_spec.rb @@ -33,11 +33,11 @@ def create_u2f_registration(id, name, public_key = nil) device = U2F::FakeU2F.new(FFaker::BaconIpsum.characters(5), { key_handle: SecureRandom.random_bytes(255) }) public_key ||= Base64.strict_encode64(device.origin_public_key_raw) u2f_registrations.create!({ id: id, - certificate: Base64.strict_encode64(device.cert_raw), - key_handle: U2F.urlsafe_encode64(device.key_handle_raw), - public_key: public_key, - counter: 5, - name: name, - user_id: user.id }) + certificate: Base64.strict_encode64(device.cert_raw), + key_handle: U2F.urlsafe_encode64(device.key_handle_raw), + public_key: public_key, + counter: 5, + name: name, + user_id: user.id }) end end diff --git a/spec/migrations/20211126204445_add_task_to_work_item_types_spec.rb b/spec/migrations/20211126204445_add_task_to_work_item_types_spec.rb index b80e4703f0755..34a6e2fdd1259 100644 --- a/spec/migrations/20211126204445_add_task_to_work_item_types_spec.rb +++ b/spec/migrations/20211126204445_add_task_to_work_item_types_spec.rb @@ -10,11 +10,11 @@ let(:base_types) do { - issue: 0, - incident: 1, - test_case: 2, + issue: 0, + incident: 1, + test_case: 2, requirement: 3, - task: 4 + task: 4 } end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index e4c0e81cc1be1..6fbff95f50495 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -1375,32 +1375,11 @@ def create_build(name, status) let(:pipeline) { build(:ci_empty_pipeline, :created) } before do - create(:ci_stage, project: project, - pipeline: pipeline, - position: 4, - name: 'deploy') - - create(:ci_build, project: project, - pipeline: pipeline, - stage: 'test', - stage_idx: 3, - name: 'test') - - create(:ci_build, project: project, - pipeline: pipeline, - stage: 'build', - stage_idx: 2, - name: 'build') - - create(:ci_stage, project: project, - pipeline: pipeline, - position: 1, - name: 'sanity') - - create(:ci_stage, project: project, - pipeline: pipeline, - position: 5, - name: 'cleanup') + create(:ci_stage, project: project, pipeline: pipeline, position: 4, name: 'deploy') + create(:ci_build, project: project, pipeline: pipeline, stage: 'test', stage_idx: 3, name: 'test') + create(:ci_build, project: project, pipeline: pipeline, stage: 'build', stage_idx: 2, name: 'build') + create(:ci_stage, project: project, pipeline: pipeline, position: 1, name: 'sanity') + create(:ci_stage, project: project, pipeline: pipeline, position: 5, name: 'cleanup') end subject { pipeline.stages } @@ -1649,9 +1628,8 @@ def create_build(name, status) context 'when auto merge is enabled' do let_it_be_with_reload(:merge_request) { create(:merge_request, :merge_when_pipeline_succeeds) } let_it_be_with_reload(:pipeline) do - create(:ci_pipeline, :running, project: merge_request.source_project, - ref: merge_request.source_branch, - sha: merge_request.diff_head_sha) + create(:ci_pipeline, :running, + project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end before_all do diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 78d4d9de84efd..e0e17ee5e8971 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -836,17 +836,11 @@ def create_status(**opts) context 'when commit status does not have stage but it exists' do let!(:stage) do - create(:ci_stage, project: project, - pipeline: pipeline, - name: 'test') + create(:ci_stage, project: project, pipeline: pipeline, name: 'test') end let(:commit_status) do - create(:commit_status, project: project, - pipeline: pipeline, - name: 'rspec', - stage: 'test', - status: :success) + create(:commit_status, project: project, pipeline: pipeline, name: 'rspec', stage: 'test', status: :success) end it 'uses existing stage', :sidekiq_might_not_need_inline do diff --git a/spec/presenters/clusters/cluster_presenter_spec.rb b/spec/presenters/clusters/cluster_presenter_spec.rb index 7349f444fac36..755f1ea607876 100644 --- a/spec/presenters/clusters/cluster_presenter_spec.rb +++ b/spec/presenters/clusters/cluster_presenter_spec.rb @@ -119,18 +119,20 @@ subject { cluster_presenter.health_data(clusterable_presenter) } it do - is_expected.to include('clusters-path': clusterable_presenter.index_path, - 'dashboard-endpoint': clusterable_presenter.metrics_dashboard_path(cluster), - 'documentation-path': help_page_path('user/infrastructure/clusters/manage/clusters_health'), - 'add-dashboard-documentation-path': help_page_path('operations/metrics/dashboards/index.md', anchor: 'add-a-new-dashboard-to-your-project'), - 'empty-getting-started-svg-path': match_asset_path('/assets/illustrations/monitoring/getting_started.svg'), - 'empty-loading-svg-path': match_asset_path('/assets/illustrations/monitoring/loading.svg'), - 'empty-no-data-svg-path': match_asset_path('/assets/illustrations/monitoring/no_data.svg'), - 'empty-no-data-small-svg-path': match_asset_path('illustrations/chart-empty-state-small.svg'), - 'empty-unable-to-connect-svg-path': match_asset_path('/assets/illustrations/monitoring/unable_to_connect.svg'), - 'settings-path': '', - 'project-path': '', - 'tags-path': '') + is_expected.to include( + 'clusters-path': clusterable_presenter.index_path, + 'dashboard-endpoint': clusterable_presenter.metrics_dashboard_path(cluster), + 'documentation-path': help_page_path('user/infrastructure/clusters/manage/clusters_health'), + 'add-dashboard-documentation-path': help_page_path('operations/metrics/dashboards/index.md', anchor: 'add-a-new-dashboard-to-your-project'), + 'empty-getting-started-svg-path': match_asset_path('/assets/illustrations/monitoring/getting_started.svg'), + 'empty-loading-svg-path': match_asset_path('/assets/illustrations/monitoring/loading.svg'), + 'empty-no-data-svg-path': match_asset_path('/assets/illustrations/monitoring/no_data.svg'), + 'empty-no-data-small-svg-path': match_asset_path('illustrations/chart-empty-state-small.svg'), + 'empty-unable-to-connect-svg-path': match_asset_path('/assets/illustrations/monitoring/unable_to_connect.svg'), + 'settings-path': '', + 'project-path': '', + 'tags-path': '' + ) end end -- GitLab