From 18ee2c75a96f8468e20b6865fadf41a4dd89b517 Mon Sep 17 00:00:00 2001
From: "gaurav.marwal" <gauravmarwal@gmail.com>
Date: Mon, 29 Apr 2024 01:57:47 +0530
Subject: [PATCH] Resolve Layout/ArgumentAlignment offenses 74

Changelog: other
---
 .rubocop_todo/layout/argument_alignment.yml    | 13 -------------
 lib/gitlab/ci/config/entry/environment.rb      | 18 +++++++++---------
 lib/gitlab/ci/config/entry/imageable.rb        |  4 ++--
 lib/gitlab/ci/config/entry/job.rb              |  6 +++---
 lib/gitlab/ci/config/entry/product/parallel.rb |  2 +-
 lib/gitlab/ci/config/entry/pull_policy.rb      | 10 +++++-----
 lib/gitlab/ci/config/entry/retry.rb            |  8 ++++----
 lib/gitlab/ci/config/entry/root.rb             | 10 +++++-----
 .../ci/config/entry/rules/rule/changes.rb      |  8 ++++----
 lib/gitlab/ci/config/extendable/entry.rb       |  8 ++++----
 lib/gitlab/ci/lint.rb                          | 10 +++++-----
 lib/gitlab/ci/status/stage/common.rb           |  4 ++--
 lib/gitlab/ci/variables/collection.rb          |  4 ++--
 13 files changed, 46 insertions(+), 59 deletions(-)

diff --git a/.rubocop_todo/layout/argument_alignment.yml b/.rubocop_todo/layout/argument_alignment.yml
index 34a6873a7868e..7f453bd63d86b 100644
--- a/.rubocop_todo/layout/argument_alignment.yml
+++ b/.rubocop_todo/layout/argument_alignment.yml
@@ -190,19 +190,6 @@ Layout/ArgumentAlignment:
     - 'lib/gitlab/auth/ldap/adapter.rb'
     - 'lib/gitlab/chat/command.rb'
     - 'lib/gitlab/ci/ansi2json/line.rb'
-    - 'lib/gitlab/ci/config/entry/environment.rb'
-    - 'lib/gitlab/ci/config/entry/imageable.rb'
-    - 'lib/gitlab/ci/config/entry/job.rb'
-    - 'lib/gitlab/ci/config/entry/product/parallel.rb'
-    - 'lib/gitlab/ci/config/entry/pull_policy.rb'
-    - 'lib/gitlab/ci/config/entry/retry.rb'
-    - 'lib/gitlab/ci/config/entry/root.rb'
-    - 'lib/gitlab/ci/config/entry/rules/rule/changes.rb'
-    - 'lib/gitlab/ci/config/extendable/entry.rb'
-    - 'lib/gitlab/ci/lint.rb'
-    - 'lib/gitlab/ci/status/stage/common.rb'
-    - 'lib/gitlab/ci/trace/chunked_io.rb'
-    - 'lib/gitlab/ci/variables/collection.rb'
     - 'lib/gitlab/ci/yaml_processor/result.rb'
     - 'lib/gitlab/config/entry/node.rb'
     - 'lib/gitlab/config_checker/external_database_checker.rb'
diff --git a/lib/gitlab/ci/config/entry/environment.rb b/lib/gitlab/ci/config/entry/environment.rb
index a727da873080a..4d17b69607cd0 100644
--- a/lib/gitlab/ci/config/entry/environment.rb
+++ b/lib/gitlab/ci/config/entry/environment.rb
@@ -38,19 +38,19 @@ class Environment < ::Gitlab::Config::Entry::Node
               validates :config, allowed_keys: ALLOWED_KEYS
 
               validates :url,
-                        type: String,
-                        length: { maximum: 255 },
-                        allow_nil: true
+                type: String,
+                length: { maximum: 255 },
+                allow_nil: true
 
               validates :action,
-                        type: String,
-                        inclusion: { in: %w[start stop prepare verify access], message: 'should be start, stop, prepare, verify, or access' },
-                        allow_nil: true
+                type: String,
+                inclusion: { in: %w[start stop prepare verify access], message: 'should be start, stop, prepare, verify, or access' },
+                allow_nil: true
 
               validates :deployment_tier,
-                        type: String,
-                        inclusion: { in: ::Environment.tiers.keys, message: "must be one of #{::Environment.tiers.keys.join(', ')}" },
-                        allow_nil: true
+                type: String,
+                inclusion: { in: ::Environment.tiers.keys, message: "must be one of #{::Environment.tiers.keys.join(', ')}" },
+                allow_nil: true
 
               validates :on_stop, type: String, allow_nil: true
               validates :kubernetes, type: Hash, allow_nil: true
diff --git a/lib/gitlab/ci/config/entry/imageable.rb b/lib/gitlab/ci/config/entry/imageable.rb
index 53b810b30371e..804c0dc9408fd 100644
--- a/lib/gitlab/ci/config/entry/imageable.rb
+++ b/lib/gitlab/ci/config/entry/imageable.rb
@@ -36,10 +36,10 @@ module Imageable
             attributes :docker, :ports, :pull_policy
 
             entry :ports, Entry::Ports,
-                description: 'Ports used to expose the image/service'
+              description: 'Ports used to expose the image/service'
 
             entry :pull_policy, Entry::PullPolicy,
-                description: 'Pull policy for the image/service'
+              description: 'Pull policy for the image/service'
           end
 
           def name
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 2980d4d6a135b..5276eeca01a15 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -135,9 +135,9 @@ class Job < ::Gitlab::Config::Entry::Node
             description: 'Pages configuration.'
 
           attributes :script, :tags, :when, :dependencies,
-                     :needs, :retry, :parallel, :start_in,
-                     :timeout, :release,
-                     :allow_failure, :publish, :pages, :manual_confirmation
+            :needs, :retry, :parallel, :start_in,
+            :timeout, :release,
+            :allow_failure, :publish, :pages, :manual_confirmation
 
           def self.matching?(name, config)
             !name.to_s.start_with?('.') &&
diff --git a/lib/gitlab/ci/config/entry/product/parallel.rb b/lib/gitlab/ci/config/entry/product/parallel.rb
index 59cd3d3cf919b..3cbeb612d1145 100644
--- a/lib/gitlab/ci/config/entry/product/parallel.rb
+++ b/lib/gitlab/ci/config/entry/product/parallel.rb
@@ -21,7 +21,7 @@ class ParallelBuilds < ::Gitlab::Config::Entry::Node
                 validates :config, numericality: { only_integer: true,
                                                    greater_than_or_equal_to: 1,
                                                    less_than_or_equal_to: Entry::Product::Parallel::PARALLEL_LIMIT },
-                                   allow_nil: true
+                  allow_nil: true
 
                 validate do
                   next unless opt(:allowed_strategies)
diff --git a/lib/gitlab/ci/config/entry/pull_policy.rb b/lib/gitlab/ci/config/entry/pull_policy.rb
index f597134dd2c33..734c301b7097c 100644
--- a/lib/gitlab/ci/config/entry/pull_policy.rb
+++ b/lib/gitlab/ci/config/entry/pull_policy.rb
@@ -15,12 +15,12 @@ class PullPolicy < ::Gitlab::Config::Entry::Node
           validations do
             validates :config, array_of_strings_or_string: true
             validates :config,
-                      allowed_array_values: { in: ALLOWED_POLICIES },
-                      presence: true,
-                      if: :array?
+              allowed_array_values: { in: ALLOWED_POLICIES },
+              presence: true,
+              if: :array?
             validates :config,
-                      inclusion: { in: ALLOWED_POLICIES },
-                      if: :string?
+              inclusion: { in: ALLOWED_POLICIES },
+              if: :string?
           end
 
           def value
diff --git a/lib/gitlab/ci/config/entry/retry.rb b/lib/gitlab/ci/config/entry/retry.rb
index f225ed4caf42a..3f6ae73ddf235 100644
--- a/lib/gitlab/ci/config/entry/retry.rb
+++ b/lib/gitlab/ci/config/entry/retry.rb
@@ -48,11 +48,11 @@ class FullRetry < ::Gitlab::Config::Entry::Node
 
                 validates :when, array_of_strings_or_string: true
                 validates :when,
-                          allowed_array_values: { in: FullRetry.possible_retry_when_values },
-                          if: -> (config) { config.when.is_a?(Array) }
+                  allowed_array_values: { in: FullRetry.possible_retry_when_values },
+                  if: -> (config) { config.when.is_a?(Array) }
                 validates :when,
-                          inclusion: { in: FullRetry.possible_retry_when_values },
-                          if: -> (config) { config.when.is_a?(String) }
+                  inclusion: { in: FullRetry.possible_retry_when_values },
+                  if: -> (config) { config.when.is_a?(String) }
                 validates :exit_codes, array_of_integers_or_integer: true
               end
             end
diff --git a/lib/gitlab/ci/config/entry/root.rb b/lib/gitlab/ci/config/entry/root.rb
index a3d57ab6ac6b1..5fdeaf78d9a61 100644
--- a/lib/gitlab/ci/config/entry/root.rb
+++ b/lib/gitlab/ci/config/entry/root.rb
@@ -68,10 +68,10 @@ class Root < ::Gitlab::Config::Entry::Node
           dynamic_helpers :jobs
 
           delegate :before_script_value,
-                   :image_value,
-                   :services_value,
-                   :after_script_value,
-                   :cache_value, to: :default_entry
+            :image_value,
+            :services_value,
+            :after_script_value,
+            :cache_value, to: :default_entry
 
           attr_reader :jobs_config
 
@@ -107,7 +107,7 @@ def compose_jobs!
               ::Gitlab::Config::Entry::Factory.new(Entry::Jobs)
                 .value(jobs_config)
                 .with(key: :jobs, parent: self,
-                      description: 'Jobs definition for this pipeline')
+                  description: 'Jobs definition for this pipeline')
             end
 
             @entries[:jobs] = logger.instrument(:config_root_compose_jobs_create, once: true) do
diff --git a/lib/gitlab/ci/config/entry/rules/rule/changes.rb b/lib/gitlab/ci/config/entry/rules/rule/changes.rb
index 107e7c228af0e..31bbf47a060e4 100644
--- a/lib/gitlab/ci/config/entry/rules/rule/changes.rb
+++ b/lib/gitlab/ci/config/entry/rules/rule/changes.rb
@@ -15,8 +15,8 @@ class SimpleChanges < ::Gitlab::Config::Entry::Node
 
                 validations do
                   validates :config,
-                            array_of_strings: true,
-                            length: { maximum: 50, too_long: "has too many entries (maximum %{count})" }
+                    array_of_strings: true,
+                    length: { maximum: 50, too_long: "has too many entries (maximum %{count})" }
                 end
 
                 def value
@@ -41,8 +41,8 @@ class ComplexChanges < ::Gitlab::Config::Entry::Node
 
                   with_options allow_nil: false do
                     validates :paths,
-                              array_of_strings: true,
-                              length: { maximum: 50, too_long: "has too many entries (maximum %{count})" }
+                      array_of_strings: true,
+                      length: { maximum: 50, too_long: "has too many entries (maximum %{count})" }
                     validates :compare_to, type: String, allow_nil: true
                   end
                 end
diff --git a/lib/gitlab/ci/config/extendable/entry.rb b/lib/gitlab/ci/config/extendable/entry.rb
index 169d329fe023c..c65106dabd06f 100644
--- a/lib/gitlab/ci/config/extendable/entry.rb
+++ b/lib/gitlab/ci/config/extendable/entry.rb
@@ -64,22 +64,22 @@ def extend!
 
             if unknown_extensions.any?
               raise Entry::InvalidExtensionError,
-                    "#{key}: unknown keys in `extends` (#{show_keys(unknown_extensions)})"
+                "#{key}: unknown keys in `extends` (#{show_keys(unknown_extensions)})"
             end
 
             if invalid_bases.any?
               raise Entry::InvalidExtensionError,
-                    "#{key}: invalid base hashes in `extends` (#{show_keys(invalid_bases)})"
+                "#{key}: invalid base hashes in `extends` (#{show_keys(invalid_bases)})"
             end
 
             if nesting_too_deep?
               raise Entry::NestingTooDeepError,
-                    "#{key}: nesting too deep in `extends`"
+                "#{key}: nesting too deep in `extends`"
             end
 
             if circular_dependency?
               raise Entry::CircularDependencyError,
-                    "#{key}: circular dependency detected in `extends`"
+                "#{key}: circular dependency detected in `extends`"
             end
 
             merged = {}
diff --git a/lib/gitlab/ci/lint.rb b/lib/gitlab/ci/lint.rb
index 98d034f48496e..4158f3d053c34 100644
--- a/lib/gitlab/ci/lint.rb
+++ b/lib/gitlab/ci/lint.rb
@@ -80,11 +80,11 @@ def static_validation(content)
       def yaml_processor_result(content, logger)
         logger.instrument(:yaml_process, once: true) do
           Gitlab::Ci::YamlProcessor.new(content, project: project,
-                                                 user: current_user,
-                                                 ref: project_ref_name,
-                                                 sha: sha,
-                                                 verify_project_sha: verify_project_sha,
-                                                 logger: logger).execute
+            user: current_user,
+            ref: project_ref_name,
+            sha: sha,
+            verify_project_sha: verify_project_sha,
+            logger: logger).execute
         end
       end
 
diff --git a/lib/gitlab/ci/status/stage/common.rb b/lib/gitlab/ci/status/stage/common.rb
index f12daaa96763e..a0dc5c4ce841f 100644
--- a/lib/gitlab/ci/status/stage/common.rb
+++ b/lib/gitlab/ci/status/stage/common.rb
@@ -11,8 +11,8 @@ def has_details?
 
           def details_path
             project_pipeline_path(subject.pipeline.project,
-                                  subject.pipeline,
-                                  anchor: subject.name)
+              subject.pipeline,
+              anchor: subject.name)
           end
 
           def has_action?
diff --git a/lib/gitlab/ci/variables/collection.rb b/lib/gitlab/ci/variables/collection.rb
index f77ef26223628..8d4c1cc7675ee 100644
--- a/lib/gitlab/ci/variables/collection.rb
+++ b/lib/gitlab/ci/variables/collection.rb
@@ -102,8 +102,8 @@ def sort_and_expand_all(keep_undefined: false, expand_file_refs: true, expand_ra
             # expand variables as they are added
             variable = item.to_runner_variable
             variable[:value] = new_collection.expand_value(variable[:value], keep_undefined: keep_undefined,
-                                                                             expand_file_refs: expand_file_refs,
-                                                                             expand_raw_refs: expand_raw_refs)
+              expand_file_refs: expand_file_refs,
+              expand_raw_refs: expand_raw_refs)
             new_collection.append(variable)
           end
 
-- 
GitLab