From 809c92c3726f1cc47eae145641101261de36fad8 Mon Sep 17 00:00:00 2001
From: Ashvin Sharma <ashsharma@gitlab.com>
Date: Sat, 22 Feb 2025 23:43:34 +0000
Subject: [PATCH] Fix rubocop errors in smoke test

Some of the rubocop errors snuck past local and that started failing
the smoke_tests. This MR aims to fix those test. I will also include
some fixes from the .rubocop_todo file to keep stuff clean.
---
 .rubocop_todo/layout/empty_lines_around_method_body.yml        | 2 --
 .../reconcile/output/desired_config_generator.rb               | 3 +--
 .../remote_development/remote_development_shared_contexts.rb   | 3 ++-
 lib/gitlab/fp/settings/default_settings_parser.rb              | 1 +
 spec/support/matchers/invoke_rop_steps.rb                      | 1 -
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/.rubocop_todo/layout/empty_lines_around_method_body.yml b/.rubocop_todo/layout/empty_lines_around_method_body.yml
index 27b2ee6020895..d3114c41e9049 100644
--- a/.rubocop_todo/layout/empty_lines_around_method_body.yml
+++ b/.rubocop_todo/layout/empty_lines_around_method_body.yml
@@ -10,9 +10,7 @@ Layout/EmptyLinesAroundMethodBody:
     - 'app/services/members/destroy_service.rb'
     - 'ee/app/models/software_license.rb'
     - 'ee/lib/gitlab/elastic/helper.rb'
-    - 'ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb'
     - 'ee/spec/support/helpers/identity_verification_helpers.rb'
-    - 'ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb'
     - 'lib/api/helpers/packages_helpers.rb'
     - 'lib/gitlab/background_migration/batched_migration_job.rb'
     - 'lib/gitlab/ci/project_config.rb'
diff --git a/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb
index 68b6114191bc7..8c1fcdeee06ef 100644
--- a/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb
+++ b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb
@@ -121,7 +121,6 @@ def self.get_extra_k8s_resources(
             env_secret_name:,
             file_secret_name:
           )
-
             workspaces_agent_config = workspace.workspaces_agent_config
             agent_annotations = workspaces_agent_config.annotations
             agent_labels = workspaces_agent_config.labels
@@ -281,7 +280,7 @@ def self.get_merged_labels_and_annotations(
               'workspaces.gitlab.com/host-template' => domain_template.to_s,
               'workspaces.gitlab.com/id' => workspace_id.to_s,
               'workspaces.gitlab.com/max-resources-per-workspace-sha256' =>
-                Digest::SHA256.hexdigest(max_resources_per_workspace.sort.to_h.to_s)
+                OpenSSL::Digest::SHA256.hexdigest(max_resources_per_workspace.sort.to_h.to_s)
             }
             annotations = agent_annotations.merge(extra_annotations)
             [labels, annotations]
diff --git a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb
index f8f459c435abd..41ee3a67bae9e 100644
--- a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb
+++ b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb
@@ -315,7 +315,9 @@ def create_config_to_apply(workspace:, **args)
     desired_config_generator_version = workspace.desired_config_generator_version
 
     method_name = "create_config_to_apply_v#{desired_config_generator_version}"
+    # rubocop:disable GitlabSecurity/PublicSend -- We are intentionally doing this send to dynamically select the generator version method
     send(method_name, workspace: workspace, **args)
+    # rubocop:enable GitlabSecurity/PublicSend
   end
 
   # rubocop:disable Metrics/ParameterLists, Metrics/AbcSize -- Cleanup as part of https://gitlab.com/gitlab-org/gitlab/-/issues/421687
@@ -986,7 +988,6 @@ def workspace_service_account(
     labels:,
     annotations:
   )
-
     image_pull_secrets_names = image_pull_secrets.map { |secret| { name: secret.symbolize_keys.fetch(:name) } }
     {
       kind: 'ServiceAccount',
diff --git a/lib/gitlab/fp/settings/default_settings_parser.rb b/lib/gitlab/fp/settings/default_settings_parser.rb
index edd105f5384e2..e5726c5b77fee 100644
--- a/lib/gitlab/fp/settings/default_settings_parser.rb
+++ b/lib/gitlab/fp/settings/default_settings_parser.rb
@@ -61,6 +61,7 @@ def self.validate_mutually_dependent_settings(
           mutually_dependent_settings:,
           default_setting_names:
         )
+          # No blank line here (satisfies Layout/EmptyLinesAroundMethodBody)
 
           if (mutually_dependent_settings - default_setting_names).any?
             raise "Unknown mutually dependent setting(s): " \
diff --git a/spec/support/matchers/invoke_rop_steps.rb b/spec/support/matchers/invoke_rop_steps.rb
index 6ff1886fca0c0..9c4724c1ddc9d 100644
--- a/spec/support/matchers/invoke_rop_steps.rb
+++ b/spec/support/matchers/invoke_rop_steps.rb
@@ -110,7 +110,6 @@ def build_expected_rop_steps(
     ok_results_for_steps:,
     context_passed_along_steps:
   )
-
     expected_rop_steps = []
 
     rop_steps.each do |rop_step|
-- 
GitLab