diff --git a/.rubocop_todo/style/keyword_parameters_order.yml b/.rubocop_todo/style/keyword_parameters_order.yml deleted file mode 100644 index 567796e6906efb8d7031e9fa23024b81812e40f2..0000000000000000000000000000000000000000 --- a/.rubocop_todo/style/keyword_parameters_order.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/KeywordParametersOrder: - Exclude: - - 'ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb' - - 'ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb' - - 'ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb' - - 'ee/lib/gitlab/elastic/helper.rb' - - 'ee/lib/gitlab/insights/executors/dora_executor.rb' - - 'ee/lib/gitlab/insights/executors/issuable_executor.rb' - - 'ee/spec/requests/api/deployments_spec.rb' - - 'lib/gitlab/background_migration/batched_migration_job.rb' - - 'lib/gitlab/checks/timed_logger.rb' - - 'lib/gitlab/ci/reports/security/finding.rb' - - 'lib/gitlab/cleanup/personal_access_tokens.rb' - - 'lib/gitlab/database/partitioning/monthly_strategy.rb' - - 'lib/gitlab/database/with_lock_retries.rb' - - 'lib/gitlab/diff/diff_refs.rb' - - 'lib/gitlab/email/smime/signer.rb' - - 'lib/gitlab/exclusive_lease.rb' - - 'lib/gitlab/merge_requests/mergeability/results_store.rb' - - 'lib/microsoft_teams/notifier.rb' diff --git a/ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb b/ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb index 9bb4cf854596498d72efecb831e8744fcdc1f2c2..bf0450d09e3b1ad8fe1f799c1efc5d953b8c50bc 100644 --- a/ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb +++ b/ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb @@ -6,7 +6,7 @@ module EnabledNamespaces class CreateService include CommonMethods - def initialize(enabled_namespace: Analytics::DevopsAdoption::EnabledNamespace.new, params: {}, current_user:) + def initialize(current_user:, enabled_namespace: Analytics::DevopsAdoption::EnabledNamespace.new, params: {}) @enabled_namespace = enabled_namespace @params = params @current_user = current_user diff --git a/ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb b/ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb index 148a6e8dcf0a4a4c64924c9c1bb8203b6b342cbe..b70c63dc02b38101684eeb2de7d8aeae54128eb9 100644 --- a/ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb +++ b/ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb @@ -8,7 +8,7 @@ class FindOrCreateService delegate :authorize!, to: :create_service - def initialize(params: {}, current_user:) + def initialize(current_user:, params: {}) @params = params @current_user = current_user end diff --git a/ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb b/ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb index 66346f62145856bf895f414c54690ba02d02631b..2ac2e66b12a626c78e2f6af33c52d4fb02c7c6f0 100644 --- a/ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb +++ b/ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb @@ -4,7 +4,7 @@ # and for all of a user's groups when the user is impersonated. module AuditEvents class UserImpersonationGroupAuditEventService - def initialize(impersonator:, user:, remote_ip:, action: :started, created_at:) + def initialize(impersonator:, user:, remote_ip:, created_at:, action: :started) @impersonator = impersonator @user = user @remote_ip = remote_ip diff --git a/ee/lib/gitlab/elastic/helper.rb b/ee/lib/gitlab/elastic/helper.rb index a017431479e8a9587b3c647b72bad63a21498cc6..6075656e55be64d22347a0ff1cd41d94e2e06b8d 100644 --- a/ee/lib/gitlab/elastic/helper.rb +++ b/ee/lib/gitlab/elastic/helper.rb @@ -264,7 +264,7 @@ def cluster_free_size_bytes client.cluster.stats['nodes']['fs']['free_in_bytes'] end - def reindex(from: target_index_name, to:, max_slice:, slice:, wait_for_completion: false) + def reindex(to:, max_slice:, slice:, from: target_index_name, wait_for_completion: false) response = ::Search::ReindexingService.execute( from: from, to: to, slice: slice, max_slices: max_slice, wait_for_completion: wait_for_completion ) @@ -288,11 +288,11 @@ def get_mapping(index_name: nil) mappings.dig(index, 'mappings', 'properties') end - def update_settings(index_name: nil, settings:) + def update_settings(settings:, index_name: nil) client.indices.put_settings(index: index_name || target_index_name, body: settings) end - def update_mapping(index_name: nil, mappings:) + def update_mapping(mappings:, index_name: nil) options = { index: index_name || target_index_name, body: mappings @@ -306,7 +306,7 @@ def get_meta(index_name: nil) mappings.dig(index, 'mappings', '_meta') end - def switch_alias(from: target_index_name, alias_name: target_name, to:) + def switch_alias(to:, from: target_index_name, alias_name: target_name) actions = [ { remove: { index: from, alias: alias_name } diff --git a/ee/lib/gitlab/insights/executors/dora_executor.rb b/ee/lib/gitlab/insights/executors/dora_executor.rb index 8fbaa28888b27e45c43ed7bf5713b67b0cbe5e88..382eb467fb1caaca8ff0bb71b01041e67776b789 100644 --- a/ee/lib/gitlab/insights/executors/dora_executor.rb +++ b/ee/lib/gitlab/insights/executors/dora_executor.rb @@ -13,7 +13,7 @@ class DoraExecutor 'deployment_frequency' => 0 }.freeze - def initialize(query_params:, current_user:, insights_entity:, projects: {}, chart_type:) + def initialize(query_params:, current_user:, insights_entity:, chart_type:, projects: {}) @query_params = query_params @current_user = current_user @insights_entity = insights_entity diff --git a/ee/lib/gitlab/insights/executors/issuable_executor.rb b/ee/lib/gitlab/insights/executors/issuable_executor.rb index 0cdbdf0bb712f3cb6e0daa4fa646199d0c5c59d2..f68a76d590aa1352fdc397b86eb3abaebae3c510 100644 --- a/ee/lib/gitlab/insights/executors/issuable_executor.rb +++ b/ee/lib/gitlab/insights/executors/issuable_executor.rb @@ -4,7 +4,7 @@ module Gitlab module Insights module Executors class IssuableExecutor - def initialize(query_params:, current_user:, insights_entity:, projects: [], chart_type:) + def initialize(query_params:, current_user:, insights_entity:, chart_type:, projects: []) @query_params = query_params @current_user = current_user @insights_entity = insights_entity diff --git a/ee/spec/requests/api/deployments_spec.rb b/ee/spec/requests/api/deployments_spec.rb index 75190cdf4d12c8a513a69ed3d4ca8e37b485cd25..bd156002d2a40a44b56a7d847c8d92e8d45a99d3 100644 --- a/ee/spec/requests/api/deployments_spec.rb +++ b/ee/spec/requests/api/deployments_spec.rb @@ -335,7 +335,7 @@ end describe 'POST /projects/:id/deployments/:deployment_id/approval' do - shared_examples_for 'not created' do |approval_status: 'approved', response_status:, message:| + shared_examples_for 'not created' do |response_status:, message:, approval_status: 'approved'| it 'does not create an approval' do expect { post(api(path, user), params: { status: approval_status }) }.not_to change { Deployments::Approval.count } diff --git a/lib/gitlab/background_migration/batched_migration_job.rb b/lib/gitlab/background_migration/batched_migration_job.rb index 9e9fc9b98b7920b475e813853274d17729eadf5a..2bf139681c7330d5b97c202340ef044a52402a36 100644 --- a/lib/gitlab/background_migration/batched_migration_job.rb +++ b/lib/gitlab/background_migration/batched_migration_job.rb @@ -16,7 +16,7 @@ class BatchedMigrationJob DEFAULT_FEATURE_CATEGORY = :database class << self - def generic_instance(batch_table:, batch_column:, job_arguments: [], connection:) + def generic_instance(batch_table:, batch_column:, connection:, job_arguments: []) new( batch_table: batch_table, batch_column: batch_column, job_arguments: job_arguments, connection: connection, @@ -62,7 +62,7 @@ def feature_category(feature_category_name = nil) end def initialize( - start_id:, end_id:, batch_table:, batch_column:, sub_batch_size:, pause_ms:, job_arguments: [], connection:, + start_id:, end_id:, batch_table:, batch_column:, sub_batch_size:, pause_ms:, connection:, job_arguments: [], sub_batch_exception: nil ) diff --git a/lib/gitlab/checks/timed_logger.rb b/lib/gitlab/checks/timed_logger.rb index 0db38d32bb32aad57b7411f522a9c23c604a3a7e..e9e461db4ca0bdafa857b7bf1cf3f1ca9910d63b 100644 --- a/lib/gitlab/checks/timed_logger.rb +++ b/lib/gitlab/checks/timed_logger.rb @@ -7,7 +7,7 @@ class TimedLogger attr_reader :start_time, :header, :log, :timeout - def initialize(start_time: Time.now, log: [], header: "", timeout:) + def initialize(timeout:, start_time: Time.now, log: [], header: "") @start_time = start_time @timeout = timeout @header = header diff --git a/lib/gitlab/ci/reports/security/finding.rb b/lib/gitlab/ci/reports/security/finding.rb index fbca1e674d167a6b17e0cb0836e9e2fe48824636..aba886db7b7265ed742a76aece08cffeec5b0c35 100644 --- a/lib/gitlab/ci/reports/security/finding.rb +++ b/lib/gitlab/ci/reports/security/finding.rb @@ -33,7 +33,7 @@ class Finding delegate :file_path, :start_line, :end_line, to: :location - def initialize(identifiers:, flags: [], links: [], remediations: [], location:, evidence:, metadata_version:, name:, original_data:, report_type:, scanner:, scan:, uuid:, confidence: nil, severity: nil, details: {}, signatures: [], project_id: nil, vulnerability_finding_signatures_enabled: false, found_by_pipeline: nil, cvss: []) # rubocop:disable Metrics/ParameterLists + def initialize(identifiers:, location:, evidence:, metadata_version:, name:, original_data:, report_type:, scanner:, scan:, uuid:, flags: [], links: [], remediations: [], confidence: nil, severity: nil, details: {}, signatures: [], project_id: nil, vulnerability_finding_signatures_enabled: false, found_by_pipeline: nil, cvss: []) # rubocop:disable Metrics/ParameterLists -- TODO: Reduce number of parameters in this function @confidence = confidence @identifiers = identifiers @flags = flags diff --git a/lib/gitlab/cleanup/personal_access_tokens.rb b/lib/gitlab/cleanup/personal_access_tokens.rb index fbc8c24f3ccab5f7fdc3567c444d461b99f18c4c..436c3a23a0830d0f3d156d2fa4863504ee53def0 100644 --- a/lib/gitlab/cleanup/personal_access_tokens.rb +++ b/lib/gitlab/cleanup/personal_access_tokens.rb @@ -10,7 +10,7 @@ class PersonalAccessTokens attr_reader :logger, :cut_off_date, :revocation_time, :group - def initialize(cut_off_date: DEFAULT_TIME_PERIOD.ago.beginning_of_day, logger: nil, group_full_path:) + def initialize(group_full_path:, cut_off_date: DEFAULT_TIME_PERIOD.ago.beginning_of_day, logger: nil) @cut_off_date = cut_off_date # rubocop: disable CodeReuse/ActiveRecord diff --git a/lib/gitlab/database/partitioning/monthly_strategy.rb b/lib/gitlab/database/partitioning/monthly_strategy.rb index e6af4ac4574fddb8eea9b8fdbba1dd08db6c02d8..91af9dcf2228fef01d6db3a651576424a4670b71 100644 --- a/lib/gitlab/database/partitioning/monthly_strategy.rb +++ b/lib/gitlab/database/partitioning/monthly_strategy.rb @@ -96,7 +96,7 @@ def relevant_range [min_date, max_date] end - def partition_for(lower_bound: nil, upper_bound:) + def partition_for(upper_bound:, lower_bound: nil) TimePartition.new(table_name, lower_bound, upper_bound) end diff --git a/lib/gitlab/database/with_lock_retries.rb b/lib/gitlab/database/with_lock_retries.rb index 3206c5626c3fc9c128f8070f9ed2cfc0b3d62b2a..a27c58e272997bdecb216b8c2bdc6bfea634ea1a 100644 --- a/lib/gitlab/database/with_lock_retries.rb +++ b/lib/gitlab/database/with_lock_retries.rb @@ -61,7 +61,7 @@ class WithLockRetries [10.seconds, 10.minutes] ].freeze - def initialize(logger: NULL_LOGGER, allow_savepoints: true, timing_configuration: DEFAULT_TIMING_CONFIGURATION, klass: nil, env: ENV, connection:) + def initialize(connection:, logger: NULL_LOGGER, allow_savepoints: true, timing_configuration: DEFAULT_TIMING_CONFIGURATION, klass: nil, env: ENV) @logger = logger @klass = klass @allow_savepoints = allow_savepoints diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb index 12b93af3f2664a814e5d336ef6acc480cea542b4..e52787b4b92c15a330b66ce6365095b5547b71ec 100644 --- a/lib/gitlab/diff/diff_refs.rb +++ b/lib/gitlab/diff/diff_refs.rb @@ -7,7 +7,7 @@ class DiffRefs attr_reader :start_sha attr_reader :head_sha - def initialize(base_sha:, start_sha: base_sha, head_sha:) + def initialize(base_sha:, head_sha:, start_sha: base_sha) @base_sha = base_sha @start_sha = start_sha @head_sha = head_sha diff --git a/lib/gitlab/email/smime/signer.rb b/lib/gitlab/email/smime/signer.rb index 6a445730463a051432ab2797656957435b3eea58..3f14b997f90915ad3271e3104bbf23719a2684eb 100644 --- a/lib/gitlab/email/smime/signer.rb +++ b/lib/gitlab/email/smime/signer.rb @@ -10,7 +10,7 @@ class Signer # The `ca_certs` parameter, if provided, is an array of CA certificates # that will be attached in the signature together with the main `cert`. # This will be typically intermediate CAs - def self.sign(cert:, key:, ca_certs: nil, data:) + def self.sign(cert:, key:, data:, ca_certs: nil) signed_data = OpenSSL::PKCS7.sign(cert, key, data, Array.wrap(ca_certs), OpenSSL::PKCS7::DETACHED) OpenSSL::PKCS7.write_smime(signed_data) end @@ -21,7 +21,7 @@ def self.sign(cert:, key:, ca_certs: nil, data:) # in the array by creating a trusted store, stopping validation at the first match # This is relevant when using intermediate CAs, `ca_certs` should only # include the trusted, root CA - def self.verify_signature(ca_certs: nil, signed_data:) + def self.verify_signature(signed_data:, ca_certs: nil) store = OpenSSL::X509::Store.new store.set_default_paths Array.wrap(ca_certs).compact.each { |ca_cert| store.add_cert(ca_cert) } diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb index b596956077454d53d98fda0c4d97807e3d8c29b8..d2059ae9aa1fff2289318024e7e4b8eeac77d29b 100644 --- a/lib/gitlab/exclusive_lease.rb +++ b/lib/gitlab/exclusive_lease.rb @@ -106,7 +106,7 @@ def self.skipping_transaction_check set_skip_transaction_check_flag(previous_skip_transaction_check) end - def initialize(key, uuid: nil, timeout:) + def initialize(key, timeout:, uuid: nil) @redis_shared_state_key = self.class.redis_shared_state_key(key) @timeout = timeout @uuid = uuid || SecureRandom.uuid diff --git a/lib/gitlab/merge_requests/mergeability/results_store.rb b/lib/gitlab/merge_requests/mergeability/results_store.rb index 2f7b8888b2f3607d99d56f056ba8e21cba9363a1..8002f8b7b988d94a26143b02395fe09a7341cd87 100644 --- a/lib/gitlab/merge_requests/mergeability/results_store.rb +++ b/lib/gitlab/merge_requests/mergeability/results_store.rb @@ -3,7 +3,7 @@ module Gitlab module MergeRequests module Mergeability class ResultsStore - def initialize(interface: RedisInterface.new, merge_request:) + def initialize(merge_request:, interface: RedisInterface.new) @interface = interface @merge_request = merge_request end diff --git a/lib/microsoft_teams/notifier.rb b/lib/microsoft_teams/notifier.rb index 299e3eeb953906fcfa3285f0d2afc9fab50cff30..7e783576579d2862fe1248df9afdf658bf2d1aef 100644 --- a/lib/microsoft_teams/notifier.rb +++ b/lib/microsoft_teams/notifier.rb @@ -27,7 +27,7 @@ def ping(options = {}) private - def body(title: nil, summary: nil, attachments: nil, activity:) + def body(activity:, title: nil, summary: nil, attachments: nil) result = { 'sections' => [] } result['title'] = title