From 9a80f8a3b24a8bc2cc70e78c78efacd43a0cebe7 Mon Sep 17 00:00:00 2001 From: Jonathan Schafer <jschafer@gitlab.com> Date: Thu, 28 Jul 2022 20:41:43 +0000 Subject: [PATCH] Fix Layout/SpaceAroundMethodCallOperator rubocop offenses --- .../space_around_method_call_operator.yml | 32 ------------------- app/helpers/badges_helper.rb | 4 +-- .../config/entry/dast_configuration_spec.rb | 2 +- ...t_resync_flag_for_retried_projects_spec.rb | 2 +- ee/spec/models/approval_project_rule_spec.rb | 4 +-- .../github/status_message_spec.rb | 2 +- .../ee/boards/issues/move_service_spec.rb | 4 +-- .../services/ee/issues/create_service_spec.rb | 6 ++-- .../geo/repository_base_sync_service_spec.rb | 2 +- .../create_requirement_service_spec.rb | 4 +-- .../update_requirement_service_spec.rb | 2 +- spec/graphql/types/base_field_spec.rb | 2 +- .../gitlab/ci/pipeline/chain/command_spec.rb | 4 +-- spec/lib/gitlab/database/shared_model_spec.rb | 2 +- spec/lib/gitlab/diff/highlight_spec.rb | 2 +- spec/lib/gitlab/spamcheck/client_spec.rb | 2 +- ...251_remove_dangling_running_builds_spec.rb | 2 +- .../chat_message/issue_message_spec.rb | 4 +-- spec/models/milestone_spec.rb | 4 +-- .../alert_management/alert_presenter_spec.rb | 2 +- .../api/graphql/custom_emoji_query_spec.rb | 4 +-- spec/tasks/gitlab/db_rake_spec.rb | 2 +- .../limited_capacity/job_tracker_spec.rb | 2 +- 23 files changed, 32 insertions(+), 64 deletions(-) delete mode 100644 .rubocop_todo/layout/space_around_method_call_operator.yml diff --git a/.rubocop_todo/layout/space_around_method_call_operator.yml b/.rubocop_todo/layout/space_around_method_call_operator.yml deleted file mode 100644 index bc174a43d770c..0000000000000 --- a/.rubocop_todo/layout/space_around_method_call_operator.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# Cop supports --auto-correct. -Layout/SpaceAroundMethodCallOperator: - # Offense count: 35 - # Temporarily disabled due to too many offenses - Enabled: false - Exclude: - - 'app/helpers/badges_helper.rb' - - 'app/services/google_cloud/create_service_accounts_service.rb' - - 'app/services/google_cloud/enable_cloud_run_service.rb' - - 'app/services/google_cloud/generate_pipeline_service.rb' - - 'ee/spec/lib/gitlab/ci/config/entry/dast_configuration_spec.rb' - - 'ee/spec/migrations/geo/set_resync_flag_for_retried_projects_spec.rb' - - 'ee/spec/models/approval_project_rule_spec.rb' - - 'ee/spec/models/integrations/github/status_message_spec.rb' - - 'ee/spec/services/ee/boards/issues/move_service_spec.rb' - - 'ee/spec/services/ee/issues/create_service_spec.rb' - - 'ee/spec/services/geo/repository_base_sync_service_spec.rb' - - 'ee/spec/services/requirements_management/create_requirement_service_spec.rb' - - 'ee/spec/services/requirements_management/update_requirement_service_spec.rb' - - 'spec/graphql/types/base_field_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/command_spec.rb' - - 'spec/lib/gitlab/database/shared_model_spec.rb' - - 'spec/lib/gitlab/diff/highlight_spec.rb' - - 'spec/lib/gitlab/spamcheck/client_spec.rb' - - 'spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb' - - 'spec/models/integrations/chat_message/issue_message_spec.rb' - - 'spec/models/milestone_spec.rb' - - 'spec/presenters/alert_management/alert_presenter_spec.rb' - - 'spec/requests/api/graphql/custom_emoji_query_spec.rb' - - 'spec/tasks/gitlab/db_rake_spec.rb' - - 'spec/workers/concerns/limited_capacity/job_tracker_spec.rb' diff --git a/app/helpers/badges_helper.rb b/app/helpers/badges_helper.rb index 26ebe8a6470aa..46f0b043770cb 100644 --- a/app/helpers/badges_helper.rb +++ b/app/helpers/badges_helper.rb @@ -8,13 +8,13 @@ module BadgesHelper success: "badge-success", warning: "badge-warning", danger: "badge-danger" - }.tap { |hash| hash.default = hash.fetch(:muted) } .freeze + }.tap { |hash| hash.default = hash.fetch(:muted) }.freeze SIZE_CLASSES = { sm: "sm", md: "md", lg: "lg" - }.tap { |hash| hash.default = hash.fetch(:md) } .freeze + }.tap { |hash| hash.default = hash.fetch(:md) }.freeze GL_BADGE_CLASSES = %w[gl-badge badge badge-pill].freeze diff --git a/ee/spec/lib/gitlab/ci/config/entry/dast_configuration_spec.rb b/ee/spec/lib/gitlab/ci/config/entry/dast_configuration_spec.rb index 0405cefcd7497..32050418b1371 100644 --- a/ee/spec/lib/gitlab/ci/config/entry/dast_configuration_spec.rb +++ b/ee/spec/lib/gitlab/ci/config/entry/dast_configuration_spec.rb @@ -50,7 +50,7 @@ let(:config) { { foo: 'Foo profile' } } it 'reports error' do - expect(entry.errors) .to include 'dast configuration config contains unknown keys: foo' + expect(entry.errors).to include 'dast configuration config contains unknown keys: foo' end end end diff --git a/ee/spec/migrations/geo/set_resync_flag_for_retried_projects_spec.rb b/ee/spec/migrations/geo/set_resync_flag_for_retried_projects_spec.rb index b674cecbff6dc..a446aff299494 100644 --- a/ee/spec/migrations/geo/set_resync_flag_for_retried_projects_spec.rb +++ b/ee/spec/migrations/geo/set_resync_flag_for_retried_projects_spec.rb @@ -24,7 +24,7 @@ end it 'sets resync_wiki to true' do - expect(registry.where(resync_wiki: true).count). to eq(0) + expect(registry.where(resync_wiki: true).count).to eq(0) migrate! diff --git a/ee/spec/models/approval_project_rule_spec.rb b/ee/spec/models/approval_project_rule_spec.rb index 33d93ac5d39d6..c678c0afa3701 100644 --- a/ee/spec/models/approval_project_rule_spec.rb +++ b/ee/spec/models/approval_project_rule_spec.rb @@ -162,7 +162,7 @@ end it 'returns false for report_approver rules' do - expect(license_scanning_approver_rule.regular?). to eq(false) + expect(license_scanning_approver_rule.regular?).to eq(false) end end @@ -180,7 +180,7 @@ end it 'returns true for report_approver rules' do - expect(license_scanning_approver_rule.report_approver?). to eq(true) + expect(license_scanning_approver_rule.report_approver?).to eq(true) end end diff --git a/ee/spec/models/integrations/github/status_message_spec.rb b/ee/spec/models/integrations/github/status_message_spec.rb index 29a614f400ca4..3c29cab9a6fe1 100644 --- a/ee/spec/models/integrations/github/status_message_spec.rb +++ b/ee/spec/models/integrations/github/status_message_spec.rb @@ -134,7 +134,7 @@ let(:pipeline) { create(:ci_pipeline, :blocked) } it 'uses human readable status which can be used in a sentence' do - expect(subject.description). to eq 'Pipeline waiting for manual action on GitLab' + expect(subject.description).to eq 'Pipeline waiting for manual action on GitLab' end end diff --git a/ee/spec/services/ee/boards/issues/move_service_spec.rb b/ee/spec/services/ee/boards/issues/move_service_spec.rb index ac12626e306ac..4fc5b25222b81 100644 --- a/ee/spec/services/ee/boards/issues/move_service_spec.rb +++ b/ee/spec/services/ee/boards/issues/move_service_spec.rb @@ -22,7 +22,7 @@ it 'removes the milestone' do params = { board_id: board1.id, from_list_id: milestone_list1.id, to_list_id: backlog.id } - expect { described_class.new(parent, user, params).execute(issue) } .to change { issue.reload.milestone } + expect { described_class.new(parent, user, params).execute(issue) }.to change { issue.reload.milestone } .from(milestone_list1.milestone) .to(nil) end @@ -121,7 +121,7 @@ it 'removes the iteration' do params = { board_id: board1.id, from_list_id: iteration_list1.id, to_list_id: backlog.id } - expect { described_class.new(parent, user, params).execute(issue) } .to change { issue.reload.iteration } + expect { described_class.new(parent, user, params).execute(issue) }.to change { issue.reload.iteration } .from(iteration_list1.iteration) .to(nil) end diff --git a/ee/spec/services/ee/issues/create_service_spec.rb b/ee/spec/services/ee/issues/create_service_spec.rb index 808a45daf9119..c789eaba5eb6f 100644 --- a/ee/spec/services/ee/issues/create_service_spec.rb +++ b/ee/spec/services/ee/issues/create_service_spec.rb @@ -227,7 +227,7 @@ end it 'creates one requirement and one requirement issue' do - expect { service.execute }. to change { Issue.count }.by(1) + expect { service.execute }.to change { Issue.count }.by(1) .and change { RequirementsManagement::Requirement.count }.by(1) end @@ -249,7 +249,7 @@ allow(instance).to receive(:valid?).and_return(false) end - expect { service.execute }. to change { Issue.count }.by(0) + expect { service.execute }.to change { Issue.count }.by(0) .and change { RequirementsManagement::Requirement.count }.by(0) end end @@ -260,7 +260,7 @@ allow(instance).to receive(:valid?).and_return(false) end - expect { service.execute }. to change { Issue.count }.by(0) + expect { service.execute }.to change { Issue.count }.by(0) .and change { RequirementsManagement::Requirement.count }.by(0) end end diff --git a/ee/spec/services/geo/repository_base_sync_service_spec.rb b/ee/spec/services/geo/repository_base_sync_service_spec.rb index 498df3a65b963..c902202097e6e 100644 --- a/ee/spec/services/geo/repository_base_sync_service_spec.rb +++ b/ee/spec/services/geo/repository_base_sync_service_spec.rb @@ -27,7 +27,7 @@ describe '#lease_timeout' do it 'returns a lease timeout value' do - expect(subject.lease_timeout). to eq(8.hours) + expect(subject.lease_timeout).to eq(8.hours) end end diff --git a/ee/spec/services/requirements_management/create_requirement_service_spec.rb b/ee/spec/services/requirements_management/create_requirement_service_spec.rb index 88f5a5f183ae3..228e642003c9e 100644 --- a/ee/spec/services/requirements_management/create_requirement_service_spec.rb +++ b/ee/spec/services/requirements_management/create_requirement_service_spec.rb @@ -62,7 +62,7 @@ allow(instance).to receive(:valid?).with(:before_requirement_issue).and_return(false) end - expect { subject }. to change { Issue.count }.by(0) + expect { subject }.to change { Issue.count }.by(0) .and change { RequirementsManagement::Requirement.count }.by(0) end end @@ -75,7 +75,7 @@ end it 'does not create requirement' do - expect { subject }. to change { Issue.count }.by(0) + expect { subject }.to change { Issue.count }.by(0) .and change { RequirementsManagement::Requirement.count }.by(0) end diff --git a/ee/spec/services/requirements_management/update_requirement_service_spec.rb b/ee/spec/services/requirements_management/update_requirement_service_spec.rb index 2bed2d041e581..396da79d39176 100644 --- a/ee/spec/services/requirements_management/update_requirement_service_spec.rb +++ b/ee/spec/services/requirements_management/update_requirement_service_spec.rb @@ -64,7 +64,7 @@ # but on Requirement 'closed' means 'archived'. # requirement: enum state: { opened: 1, archived: 2 } # issue: STATE_ID_MAP = { opened: 1, closed: 2, ... - expect(requirement.read_attribute_before_type_cast(:state)). to eq(requirement.requirement_issue.state_id) + expect(requirement.read_attribute_before_type_cast(:state)).to eq(requirement.requirement_issue.state_id) end end diff --git a/spec/graphql/types/base_field_spec.rb b/spec/graphql/types/base_field_spec.rb index 439678e7e1626..a3efc60ff5b4f 100644 --- a/spec/graphql/types/base_field_spec.rb +++ b/spec/graphql/types/base_field_spec.rb @@ -299,7 +299,7 @@ def self.complexity_multiplier(args) end it 'returns the correct availability in the description' do - expect(field.description). to eq expected_description + expect(field.description).to eq expected_description end end end diff --git a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb index 0d78ce3440a24..de43e759193eb 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb @@ -282,7 +282,7 @@ subject { command.ambiguous_ref? } context 'when ref is not ambiguous' do - it { is_expected. to eq(false) } + it { is_expected.to eq(false) } end context 'when ref is ambiguous' do @@ -291,7 +291,7 @@ project.repository.add_branch(project.creator, 'ref', 'master') end - it { is_expected. to eq(true) } + it { is_expected.to eq(true) } end end diff --git a/spec/lib/gitlab/database/shared_model_spec.rb b/spec/lib/gitlab/database/shared_model_spec.rb index c88edc1781726..7e0ba3397d122 100644 --- a/spec/lib/gitlab/database/shared_model_spec.rb +++ b/spec/lib/gitlab/database/shared_model_spec.rb @@ -106,7 +106,7 @@ def expect_original_connection_around shared_model = shared_model_class.new - expect(shared_model.connection_db_config). to eq(described_class.connection_db_config) + expect(shared_model.connection_db_config).to eq(described_class.connection_db_config) end end end diff --git a/spec/lib/gitlab/diff/highlight_spec.rb b/spec/lib/gitlab/diff/highlight_spec.rb index 624160d2f48c1..c378ecb8134da 100644 --- a/spec/lib/gitlab/diff/highlight_spec.rb +++ b/spec/lib/gitlab/diff/highlight_spec.rb @@ -117,7 +117,7 @@ it 'reports to Sentry if configured' do expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).and_call_original - expect { subject }. to raise_exception(RangeError) + expect { subject }.to raise_exception(RangeError) end end diff --git a/spec/lib/gitlab/spamcheck/client_spec.rb b/spec/lib/gitlab/spamcheck/client_spec.rb index a6e7665569c0b..bb0b542b4f591 100644 --- a/spec/lib/gitlab/spamcheck/client_spec.rb +++ b/spec/lib/gitlab/spamcheck/client_spec.rb @@ -97,7 +97,7 @@ context: cxt) expect(issue_pb.title).to eq issue.title expect(issue_pb.description).to eq issue.description - expect(issue_pb.user_in_project). to be false + expect(issue_pb.user_in_project).to be false expect(issue_pb.project.project_id).to eq issue.project_id expect(issue_pb.created_at).to eq timestamp_to_protobuf_timestamp(issue.created_at) expect(issue_pb.updated_at).to eq timestamp_to_protobuf_timestamp(issue.updated_at) diff --git a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb index 3478305bbadef..a23f9995875e8 100644 --- a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb +++ b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb @@ -47,6 +47,6 @@ migrate! expect(running_metadata.reload).to be_present - expect { failed_metadata.reload } .to raise_error(ActiveRecord::RecordNotFound) + expect { failed_metadata.reload }.to raise_error(ActiveRecord::RecordNotFound) end end diff --git a/spec/models/integrations/chat_message/issue_message_spec.rb b/spec/models/integrations/chat_message/issue_message_spec.rb index 7026a314b78d4..4a86322cdaf5f 100644 --- a/spec/models/integrations/chat_message/issue_message_spec.rb +++ b/spec/models/integrations/chat_message/issue_message_spec.rb @@ -65,7 +65,7 @@ end it 'returns a message regarding closing of issues' do - expect(subject.pretext). to eq( + expect(subject.pretext).to eq( '[<http://somewhere.com|project_name>] Issue <http://url.com|#100 Issue title> closed by Test User (test.user)') expect(subject.attachments).to be_empty end @@ -111,7 +111,7 @@ end it 'returns a message regarding closing of issues' do - expect(subject.pretext). to eq( + expect(subject.pretext).to eq( '[[project_name](http://somewhere.com)] Issue [#100 Issue title](http://url.com) closed by Test User (test.user)') expect(subject.attachments).to be_empty expect(subject.activity).to eq({ diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 72a57b6076a8f..af1383b68bff8 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -257,7 +257,7 @@ let(:milestone) { create(:milestone, title: 'foo', description: 'bar') } it 'returns milestones with a matching title' do - expect(described_class.search_title(milestone.title)) .to eq([milestone]) + expect(described_class.search_title(milestone.title)).to eq([milestone]) end it 'returns milestones with a partially matching title' do @@ -272,7 +272,7 @@ it 'searches only on the title and ignores milestones with a matching description' do create(:milestone, title: 'bar', description: 'foo') - expect(described_class.search_title(milestone.title)) .to eq([milestone]) + expect(described_class.search_title(milestone.title)).to eq([milestone]) end end diff --git a/spec/presenters/alert_management/alert_presenter_spec.rb b/spec/presenters/alert_management/alert_presenter_spec.rb index 21c0cb3feada9..fe228f174fed9 100644 --- a/spec/presenters/alert_management/alert_presenter_spec.rb +++ b/spec/presenters/alert_management/alert_presenter_spec.rb @@ -115,7 +115,7 @@ it 'formats the start time of the alert' do alert.started_at = Time.utc(2019, 5, 5) - expect(presenter.start_time). to eq('05 May 2019, 12:00AM (UTC)') + expect(presenter.start_time).to eq('05 May 2019, 12:00AM (UTC)') end end diff --git a/spec/requests/api/graphql/custom_emoji_query_spec.rb b/spec/requests/api/graphql/custom_emoji_query_spec.rb index 874357d9eef60..13b7a22e791ca 100644 --- a/spec/requests/api/graphql/custom_emoji_query_spec.rb +++ b/spec/requests/api/graphql/custom_emoji_query_spec.rb @@ -31,8 +31,8 @@ def custom_emoji_query(group) post_graphql(custom_emoji_query(group), current_user: current_user) expect(response).to have_gitlab_http_status(:ok) - expect(graphql_data['group']['customEmoji']['nodes'].count). to eq(1) - expect(graphql_data['group']['customEmoji']['nodes'].first['name']). to eq(custom_emoji.name) + expect(graphql_data['group']['customEmoji']['nodes'].count).to eq(1) + expect(graphql_data['group']['customEmoji']['nodes'].first['name']).to eq(custom_emoji.name) end it 'returns nil when unauthorised' do diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index 74bec4069476b..8f8178cde4d8f 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -370,7 +370,7 @@ it 'outputs changed message for automation after operations happen' do allow(ActiveRecord::Base.connection.schema_migration).to receive(:table_exists?).and_return(schema_migration_table_exists) allow_any_instance_of(ActiveRecord::MigrationContext).to receive(:needs_migration?).and_return(needs_migrations) - expect { run_rake_task('gitlab:db:unattended') }. to output(/^#{rake_output}$/).to_stdout + expect { run_rake_task('gitlab:db:unattended') }.to output(/^#{rake_output}$/).to_stdout end end end diff --git a/spec/workers/concerns/limited_capacity/job_tracker_spec.rb b/spec/workers/concerns/limited_capacity/job_tracker_spec.rb index eeccdbd0e2dc4..0e3fa350fcd63 100644 --- a/spec/workers/concerns/limited_capacity/job_tracker_spec.rb +++ b/spec/workers/concerns/limited_capacity/job_tracker_spec.rb @@ -11,7 +11,7 @@ describe '#register' do it 'adds jid to the set' do - expect(job_tracker.register('a-job-id', max_jids)). to be true + expect(job_tracker.register('a-job-id', max_jids)).to be true expect(job_tracker.running_jids).to contain_exactly('a-job-id') end -- GitLab