From 9b17542b5d414495d30bcfc28c60afa291475d7d Mon Sep 17 00:00:00 2001 From: Tan Le <tle@gitlab.com> Date: Tue, 19 Sep 2023 16:57:55 +1000 Subject: [PATCH] Fix Rubocop Style/PercentLiteralDelimiters offence - ee/lib/** - rubocop/** - scripts/** - sidekiq_cluster/** - tooling/** --- .../style/percent_literal_delimiters.yml | 33 ------------------- ee/lib/api/status_checks.rb | 2 +- ee/lib/api/visual_review_discussions.rb | 2 +- ee/lib/ee/api/helpers/members_helpers.rb | 2 +- ee/lib/ee/api/helpers/projects_helpers.rb | 2 +- ee/lib/ee/api/members.rb | 2 +- ee/lib/ee/api/search.rb | 2 +- .../alert_management/payload/generic.rb | 2 +- ee/lib/ee/gitlab/auth/ldap/adapter.rb | 2 +- .../migrate_approver_to_approval_rules.rb | 2 +- .../checks/push_rules/file_size_check.rb | 2 +- .../security/validators/schema_validator.rb | 2 +- ee/lib/ee/gitlab/etag_caching/router/rails.rb | 2 +- .../gitlab/middleware/read_only/controller.rb | 16 ++++----- ee/lib/ee/gitlab/path_regex.rb | 2 +- ee/lib/ee/gitlab/usage_data.rb | 4 +-- ee/lib/elastic/class_proxy_util.rb | 4 +-- ee/lib/elastic/latest/config.rb | 14 ++++---- .../latest/custom_language_analyzers.rb | 2 +- .../elastic/latest/project_instance_proxy.rb | 4 +-- ee/lib/elastic/latest/snippet_class_proxy.rb | 2 +- ee/lib/gitlab/auth/group_saml/auth_hash.rb | 2 +- ee/lib/gitlab/geo/replicator.rb | 2 +- .../instrumentations/license_metric.rb | 4 +-- ee/lib/tasks/gitlab/elastic/test.rake | 2 +- .../cop/migration/background_migrations.rb | 4 +-- rubocop/cop/rspec/httparty_basic_auth.rb | 2 +- rubocop/migration_helpers.rb | 4 +-- scripts/qa/quarantine-types-check | 4 +-- scripts/qa/testcases-check | 6 ++-- scripts/regenerate-schema | 18 +++++----- scripts/undercoverage | 4 +-- sidekiq_cluster/cli.rb | 4 +-- tooling/danger/datateam.rb | 2 +- 34 files changed, 65 insertions(+), 98 deletions(-) diff --git a/.rubocop_todo/style/percent_literal_delimiters.yml b/.rubocop_todo/style/percent_literal_delimiters.yml index 59acd655d4b3..09f590ae11ae 100644 --- a/.rubocop_todo/style/percent_literal_delimiters.yml +++ b/.rubocop_todo/style/percent_literal_delimiters.yml @@ -2,30 +2,6 @@ # Cop supports --autocorrect. Style/PercentLiteralDelimiters: Exclude: - - 'ee/lib/api/status_checks.rb' - - 'ee/lib/api/visual_review_discussions.rb' - - 'ee/lib/ee/api/helpers/members_helpers.rb' - - 'ee/lib/ee/api/helpers/projects_helpers.rb' - - 'ee/lib/ee/api/members.rb' - - 'ee/lib/ee/api/search.rb' - - 'ee/lib/ee/gitlab/alert_management/payload/generic.rb' - - 'ee/lib/ee/gitlab/auth/ldap/adapter.rb' - - 'ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb' - - 'ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb' - - 'ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb' - - 'ee/lib/ee/gitlab/etag_caching/router/rails.rb' - - 'ee/lib/ee/gitlab/middleware/read_only/controller.rb' - - 'ee/lib/ee/gitlab/path_regex.rb' - - 'ee/lib/ee/gitlab/usage_data.rb' - - 'ee/lib/elastic/class_proxy_util.rb' - - 'ee/lib/elastic/latest/config.rb' - - 'ee/lib/elastic/latest/custom_language_analyzers.rb' - - 'ee/lib/elastic/latest/project_instance_proxy.rb' - - 'ee/lib/elastic/latest/snippet_class_proxy.rb' - - 'ee/lib/gitlab/auth/group_saml/auth_hash.rb' - - 'ee/lib/gitlab/geo/replicator.rb' - - 'ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb' - - 'ee/lib/tasks/gitlab/elastic/test.rake' - 'ee/spec/controllers/ee/sessions_controller_spec.rb' - 'ee/spec/controllers/groups/saml_providers_controller_spec.rb' - 'ee/spec/controllers/groups/scim_oauth_controller_spec.rb' @@ -199,14 +175,6 @@ Style/PercentLiteralDelimiters: - 'qa/qa/specs/features/ee/browser_ui/3_create/repository/push_rules_spec.rb' - 'qa/spec/git/repository_spec.rb' - 'qa/spec/page/view_spec.rb' - - 'rubocop/cop/migration/background_migrations.rb' - - 'rubocop/cop/rspec/httparty_basic_auth.rb' - - 'rubocop/migration_helpers.rb' - - 'scripts/qa/quarantine-types-check' - - 'scripts/qa/testcases-check' - - 'scripts/regenerate-schema' - - 'scripts/undercoverage' - - 'sidekiq_cluster/cli.rb' - 'spec/benchmarks/banzai_benchmark.rb' - 'spec/commands/sidekiq_cluster/cli_spec.rb' - 'spec/components/pajamas/component_spec.rb' @@ -732,4 +700,3 @@ Style/PercentLiteralDelimiters: - 'spec/workers/projects/record_target_platforms_worker_spec.rb' - 'spec/workers/stuck_merge_jobs_worker_spec.rb' - 'spec/workers/update_project_statistics_worker_spec.rb' - - 'tooling/danger/datateam.rb' diff --git a/ee/lib/api/status_checks.rb b/ee/lib/api/status_checks.rb index b939cefa0e0e..7da9d4a96283 100644 --- a/ee/lib/api/status_checks.rb +++ b/ee/lib/api/status_checks.rb @@ -132,7 +132,7 @@ def check_feature_enabled! requires :status, type: String, desc: 'Set to passed to pass the check or failed to fail it', - values: %w(passed failed), + values: %w[passed failed], documentation: { example: 'passed' } end post 'status_check_responses' do diff --git a/ee/lib/api/visual_review_discussions.rb b/ee/lib/api/visual_review_discussions.rb index 4aaf34f9565e..3df0eb993b01 100644 --- a/ee/lib/api/visual_review_discussions.rb +++ b/ee/lib/api/visual_review_discussions.rb @@ -22,7 +22,7 @@ class VisualReviewDiscussions < ::API::Base requires :base_sha, type: String, desc: 'Base commit SHA in the source branch' requires :start_sha, type: String, desc: 'SHA referencing commit in target branch' requires :head_sha, type: String, desc: 'SHA referencing HEAD of this merge request' - requires :position_type, type: String, desc: 'Type of the position reference', values: %w(text image) + requires :position_type, type: String, desc: 'Type of the position reference', values: %w[text image] optional :new_path, type: String, desc: 'File path after change' optional :new_line, type: Integer, desc: 'Line number after change' optional :old_path, type: String, desc: 'File path before change' diff --git a/ee/lib/ee/api/helpers/members_helpers.rb b/ee/lib/ee/api/helpers/members_helpers.rb index d8aac0879c47..2ee8f6eb3d08 100644 --- a/ee/lib/ee/api/helpers/members_helpers.rb +++ b/ee/lib/ee/api/helpers/members_helpers.rb @@ -22,7 +22,7 @@ def member_sort_options end params :optional_state_filter_ee do - optional :state, type: String, desc: 'Filter results by member state', values: %w(awaiting active) + optional :state, type: String, desc: 'Filter results by member state', values: %w[awaiting active] end params :optional_put_params_ee do diff --git a/ee/lib/ee/api/helpers/projects_helpers.rb b/ee/lib/ee/api/helpers/projects_helpers.rb index 99ad272eda1a..a49eec0ca4e8 100644 --- a/ee/lib/ee/api/helpers/projects_helpers.rb +++ b/ee/lib/ee/api/helpers/projects_helpers.rb @@ -21,7 +21,7 @@ module ProjectsHelpers optional :mirror, type: Grape::API::Boolean, desc: 'Enables pull mirroring in a project' optional :mirror_trigger_builds, type: Grape::API::Boolean, desc: 'Pull mirroring triggers builds' optional :external_authorization_classification_label, type: String, desc: 'The classification label for the project' - optional :requirements_access_level, type: String, values: %w(disabled private enabled), desc: 'Requirements feature access level. One of `disabled`, `private` or `enabled`' + optional :requirements_access_level, type: String, values: %w[disabled private enabled], desc: 'Requirements feature access level. One of `disabled`, `private` or `enabled`' end params :optional_filter_params_ee do diff --git a/ee/lib/ee/api/members.rb b/ee/lib/ee/api/members.rb index 7ff963740e8d..452d5585a733 100644 --- a/ee/lib/ee/api/members.rb +++ b/ee/lib/ee/api/members.rb @@ -144,7 +144,7 @@ module Members desc 'Changes the state of the memberships of a user in the group' params do requires :user_id, type: Integer, desc: 'The user ID of the user' - requires :state, type: String, values: %w(awaiting active), desc: 'The new state for the memberships of the user' + requires :state, type: String, values: %w[awaiting active], desc: 'The new state for the memberships of the user' end put ":id/members/:user_id/state", feature_category: :user_management do user = find_user(params[:user_id]) diff --git a/ee/lib/ee/api/search.rb b/ee/lib/ee/api/search.rb index 119feb4efbac..2a277b67d330 100644 --- a/ee/lib/ee/api/search.rb +++ b/ee/lib/ee/api/search.rb @@ -9,7 +9,7 @@ module Search helpers do extend ::Gitlab::Utils::Override - ELASTICSEARCH_SCOPES = %w(wiki_blobs blobs commits notes).freeze + ELASTICSEARCH_SCOPES = %w[wiki_blobs blobs commits notes].freeze override :scope_preload_method def scope_preload_method diff --git a/ee/lib/ee/gitlab/alert_management/payload/generic.rb b/ee/lib/ee/gitlab/alert_management/payload/generic.rb index 363365a3cd36..a2caceb60dfc 100644 --- a/ee/lib/ee/gitlab/alert_management/payload/generic.rb +++ b/ee/lib/ee/gitlab/alert_management/payload/generic.rb @@ -9,7 +9,7 @@ module Generic include Mappable extend ::Gitlab::Utils::Override - EXCLUDED_PAYLOAD_FINGERPRINT_PARAMS = %w(start_time end_time hosts).freeze + EXCLUDED_PAYLOAD_FINGERPRINT_PARAMS = %w[start_time end_time hosts].freeze private diff --git a/ee/lib/ee/gitlab/auth/ldap/adapter.rb b/ee/lib/ee/gitlab/auth/ldap/adapter.rb index 714a3f162aaa..a115b24ef340 100644 --- a/ee/lib/ee/gitlab/auth/ldap/adapter.rb +++ b/ee/lib/ee/gitlab/auth/ldap/adapter.rb @@ -20,7 +20,7 @@ def groups(cn = "*", size = nil) options = { base: config.group_base, filter: Net::LDAP::Filter.eq("cn", cn), - attributes: %w(dn cn memberuid member submember uniquemember memberof) + attributes: %w[dn cn memberuid member submember uniquemember memberof] } options[:size] = size if size diff --git a/ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb b/ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb index 4e330488f1ec..9b4f6171a49b 100644 --- a/ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb +++ b/ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb @@ -171,7 +171,7 @@ class User < ActiveRecord::Base self.table_name = 'users' end - ALLOWED_TARGET_TYPES = %w{MergeRequest Project}.freeze + ALLOWED_TARGET_TYPES = %w[MergeRequest Project].freeze # @param target_type [String] class of target, either 'MergeRequest' or 'Project' # @param target_id [Integer] id of target diff --git a/ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb b/ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb index 547926857837..65f2afcc3b74 100644 --- a/ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb +++ b/ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb @@ -21,7 +21,7 @@ def validate! ).find(timeout: logger.time_left) if large_blobs.present? - raise ::Gitlab::GitAccess::ForbiddenError, %{File "#{large_blobs.first.path}" is larger than the allowed size of #{max_file_size} MiB. Use Git LFS to manage this file.} + raise ::Gitlab::GitAccess::ForbiddenError, %(File "#{large_blobs.first.path}" is larger than the allowed size of #{max_file_size} MiB. Use Git LFS to manage this file.) end end end diff --git a/ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb b/ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb index 294f684cb8d6..c62a03b06af5 100644 --- a/ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb +++ b/ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb @@ -9,7 +9,7 @@ module SchemaValidator module Schema extend ::Gitlab::Utils::Override - CE_TYPES = %i(sast secret_detection).freeze + CE_TYPES = %i[sast secret_detection].freeze override :root_path def root_path diff --git a/ee/lib/ee/gitlab/etag_caching/router/rails.rb b/ee/lib/ee/gitlab/etag_caching/router/rails.rb index 7e05dd4d533d..9d11f1a6664c 100644 --- a/ee/lib/ee/gitlab/etag_caching/router/rails.rb +++ b/ee/lib/ee/gitlab/etag_caching/router/rails.rb @@ -9,7 +9,7 @@ module Rails EE_ROUTE_DEFINITONS = [ [ - %r(^/groups/#{::Gitlab::PathRegex.full_namespace_route_regex}/-/epics/\d+/realtime_changes\z), + %r{^/groups/#{::Gitlab::PathRegex.full_namespace_route_regex}/-/epics/\d+/realtime_changes\z}, 'epic_realtime_changes', ::Groups::EpicsController, :realtime_changes diff --git a/ee/lib/ee/gitlab/middleware/read_only/controller.rb b/ee/lib/ee/gitlab/middleware/read_only/controller.rb index 343fc40401f0..f3d9f8856d93 100644 --- a/ee/lib/ee/gitlab/middleware/read_only/controller.rb +++ b/ee/lib/ee/gitlab/middleware/read_only/controller.rb @@ -8,29 +8,29 @@ module Controller extend ::Gitlab::Utils::Override ALLOWLISTED_GEO_ROUTES = { - 'admin/geo/nodes' => %w{update} + 'admin/geo/nodes' => %w[update] }.freeze ALLOWLISTED_GEO_ROUTES_TRACKING_DB = { - 'admin/geo/projects' => %w{destroy resync reverify resync_all reverify_all}, - 'admin/geo/uploads' => %w{destroy} + 'admin/geo/projects' => %w[destroy resync reverify resync_all reverify_all], + 'admin/geo/uploads' => %w[destroy] }.freeze ALLOWLISTED_GIT_READ_WRITE_ROUTES = { - 'repositories/git_http' => %w{git_upload_pack git_receive_pack} + 'repositories/git_http' => %w[git_upload_pack git_receive_pack] }.freeze ALLOWLISTED_GIT_LFS_LOCKS_ROUTES = { - 'repositories/lfs_locks_api' => %w{verify create unlock} + 'repositories/lfs_locks_api' => %w[verify create unlock] }.freeze ALLOWLISTED_SIGN_OUT_ROUTES = { - 'sessions' => %w{destroy} + 'sessions' => %w[destroy] }.freeze ALLOWLISTED_SIGN_IN_ROUTES = { - 'sessions' => %w{create}, - 'oauth/tokens' => %w{create} + 'sessions' => %w[create], + 'oauth/tokens' => %w[create] }.freeze ALLOWLISTED_SSO_SIGN_IN_CONTROLLERS = [ diff --git a/ee/lib/ee/gitlab/path_regex.rb b/ee/lib/ee/gitlab/path_regex.rb index 43a359284acf..0ecd88e88a61 100644 --- a/ee/lib/ee/gitlab/path_regex.rb +++ b/ee/lib/ee/gitlab/path_regex.rb @@ -7,7 +7,7 @@ module PathRegex class_methods do def saml_callback_regex - @saml_callback_regex ||= %r(\A\/groups\/(?<group>#{full_namespace_route_regex})\/\-\/saml\/callback\z) + @saml_callback_regex ||= %r{\A\/groups\/(?<group>#{full_namespace_route_regex})\/\-\/saml\/callback\z} end end end diff --git a/ee/lib/ee/gitlab/usage_data.rb b/ee/lib/ee/gitlab/usage_data.rb index 154445b53f21..87ddbf48a945 100644 --- a/ee/lib/ee/gitlab/usage_data.rb +++ b/ee/lib/ee/gitlab/usage_data.rb @@ -10,12 +10,12 @@ module Gitlab module UsageData extend ActiveSupport::Concern - EE_MEMOIZED_VALUES = %i( + EE_MEMOIZED_VALUES = %i[ approval_merge_request_rule_minimum_id approval_merge_request_rule_maximum_id merge_request_minimum_id merge_request_maximum_id - ).freeze + ].freeze class_methods do extend ::Gitlab::Utils::Override diff --git a/ee/lib/elastic/class_proxy_util.rb b/ee/lib/elastic/class_proxy_util.rb index f88787b0a3fb..807a25b3fe1f 100644 --- a/ee/lib/elastic/class_proxy_util.rb +++ b/ee/lib/elastic/class_proxy_util.rb @@ -34,11 +34,11 @@ def version_namespace class_methods do def methods_for_all_write_targets - %i(refresh_index!) + %i[refresh_index!] end def methods_for_one_write_target - %i(import create_index! delete_index!) + %i[import create_index! delete_index!] end end end diff --git a/ee/lib/elastic/latest/config.rb b/ee/lib/elastic/latest/config.rb index 762b9a7832f6..fb953abe48c4 100644 --- a/ee/lib/elastic/latest/config.rb +++ b/ee/lib/elastic/latest/config.rb @@ -27,7 +27,7 @@ module Config analyzer: { default: { tokenizer: 'standard', - filter: %w(lowercase stemmer) + filter: %w[lowercase stemmer] }, my_ngram_analyzer: { tokenizer: 'my_ngram_tokenizer', @@ -36,16 +36,16 @@ module Config path_analyzer: { type: 'custom', tokenizer: 'path_tokenizer', - filter: %w(lowercase asciifolding) + filter: %w[lowercase asciifolding] }, code_analyzer: { type: 'custom', tokenizer: 'whitespace', - filter: %w(word_delimiter_graph_filter flatten_graph lowercase asciifolding remove_duplicates) + filter: %w[word_delimiter_graph_filter flatten_graph lowercase asciifolding remove_duplicates] }, whitespace_reverse: { tokenizer: 'whitespace', - filter: %w(lowercase asciifolding reverse) + filter: %w[lowercase asciifolding reverse] }, email_analyzer: { tokenizer: 'email_tokenizer' @@ -62,7 +62,7 @@ module Config type: 'ngram', min_gram: 2, max_gram: 3, - token_chars: %w(letter digit) + token_chars: %w[letter digit] }, path_tokenizer: { type: 'path_hierarchy', @@ -95,7 +95,7 @@ module Config indexes :join_field, type: :join, relations: { - project: %i( + project: %i[ issue merge_request milestone @@ -103,7 +103,7 @@ module Config blob wiki_blob commit - ) + ] } # ES6 requires a single type per index, so we implement our own "type" indexes :type, type: :keyword diff --git a/ee/lib/elastic/latest/custom_language_analyzers.rb b/ee/lib/elastic/latest/custom_language_analyzers.rb index b6c3a14ca210..9fc98ecc6d25 100644 --- a/ee/lib/elastic/latest/custom_language_analyzers.rb +++ b/ee/lib/elastic/latest/custom_language_analyzers.rb @@ -4,7 +4,7 @@ module Elastic module Latest module CustomLanguageAnalyzers class << self - SUPPORTED_FIELDS = %i{title description}.freeze + SUPPORTED_FIELDS = %i[title description].freeze def custom_analyzers_mappings(type: :text) hash = { properties: {} } diff --git a/ee/lib/elastic/latest/project_instance_proxy.rb b/ee/lib/elastic/latest/project_instance_proxy.rb index 13151fcacb5e..7598ca0880ee 100644 --- a/ee/lib/elastic/latest/project_instance_proxy.rb +++ b/ee/lib/elastic/latest/project_instance_proxy.rb @@ -3,13 +3,13 @@ module Elastic module Latest class ProjectInstanceProxy < ApplicationInstanceProxy - TRACKED_FEATURE_SETTINGS = %w( + TRACKED_FEATURE_SETTINGS = %w[ issues_access_level merge_requests_access_level snippets_access_level wiki_access_level repository_access_level - ).freeze + ].freeze def as_indexed_json(options = {}) # We don't use as_json(only: ...) because it calls all virtual and serialized attributes diff --git a/ee/lib/elastic/latest/snippet_class_proxy.rb b/ee/lib/elastic/latest/snippet_class_proxy.rb index 9318cd14e38a..74d7b6053c00 100644 --- a/ee/lib/elastic/latest/snippet_class_proxy.rb +++ b/ee/lib/elastic/latest/snippet_class_proxy.rb @@ -4,7 +4,7 @@ module Elastic module Latest class SnippetClassProxy < ApplicationClassProxy def elastic_search(query, options: {}) - query_hash = basic_query_hash(%w(title description), query) + query_hash = basic_query_hash(%w[title description], query) query_hash = context.name(:snippet, :authorized) { filter(query_hash, options) } search(query_hash, options) diff --git a/ee/lib/gitlab/auth/group_saml/auth_hash.rb b/ee/lib/gitlab/auth/group_saml/auth_hash.rb index 07952d0b1a1c..49d3c5f84f46 100644 --- a/ee/lib/gitlab/auth/group_saml/auth_hash.rb +++ b/ee/lib/gitlab/auth/group_saml/auth_hash.rb @@ -6,7 +6,7 @@ module GroupSaml class AuthHash < Gitlab::Auth::Saml::AuthHash include Gitlab::Utils::StrongMemoize - ALLOWED_USER_ATTRIBUTES = %w(can_create_group projects_limit).freeze + ALLOWED_USER_ATTRIBUTES = %w[can_create_group projects_limit].freeze def groups Array.wrap(get_raw('groups') || get_raw('Groups')) diff --git a/ee/lib/gitlab/geo/replicator.rb b/ee/lib/gitlab/geo/replicator.rb index 5cb1f382aabe..6c73000b5bb3 100644 --- a/ee/lib/gitlab/geo/replicator.rb +++ b/ee/lib/gitlab/geo/replicator.rb @@ -15,7 +15,7 @@ class Replicator extend ::Gitlab::Geo::LogHelpers extend ::Gitlab::Geo::BatchCounter - CLASS_SUFFIXES = %w(RegistryFinder RegistriesResolver).freeze + CLASS_SUFFIXES = %w[RegistryFinder RegistriesResolver].freeze attr_reader :model_record_id diff --git a/ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb b/ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb index c24de1497f06..5a798247ca1b 100644 --- a/ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb +++ b/ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb @@ -13,7 +13,7 @@ class LicenseMetric < GenericMetric # attribute: md5 # end - ALLOWED_ATTRIBUTES = %w(add_ons + ALLOWED_ATTRIBUTES = %w[add_ons daily_billable_users_count expires_at license_id @@ -23,7 +23,7 @@ class LicenseMetric < GenericMetric starts_at trial? trial_ends_on - user_count).freeze + user_count].freeze def initialize(metric_definition) super diff --git a/ee/lib/tasks/gitlab/elastic/test.rake b/ee/lib/tasks/gitlab/elastic/test.rake index 684503a83b97..8f9c7948876b 100644 --- a/ee/lib/tasks/gitlab/elastic/test.rake +++ b/ee/lib/tasks/gitlab/elastic/test.rake @@ -11,7 +11,7 @@ namespace :gitlab do indices += helper.standalone_indices_proxies.map(&:index_name) indices.each do |index_name| puts "===== Size stats for index: #{index_name} =====" - pp helper.index_size(index_name: index_name).slice(*%w(docs store)) + pp helper.index_size(index_name: index_name).slice(*%w[docs store]) end end diff --git a/rubocop/cop/migration/background_migrations.rb b/rubocop/cop/migration/background_migrations.rb index 7dcc2101fb14..e131ab42318f 100644 --- a/rubocop/cop/migration/background_migrations.rb +++ b/rubocop/cop/migration/background_migrations.rb @@ -14,11 +14,11 @@ class BackgroundMigrations < RuboCop::Cop::Base def on_send(node) name = node.children[1] - disabled_methods = %i( + disabled_methods = %i[ queue_background_migration_jobs_by_range_at_intervals requeue_background_migration_jobs_by_range_at_intervals migrate_in - ) + ] add_offense(node.loc.selector) if disabled_methods.include? name end diff --git a/rubocop/cop/rspec/httparty_basic_auth.rb b/rubocop/cop/rspec/httparty_basic_auth.rb index d188002673f6..68d48ca4f825 100644 --- a/rubocop/cop/rspec/httparty_basic_auth.rb +++ b/rubocop/cop/rspec/httparty_basic_auth.rb @@ -19,7 +19,7 @@ class HTTPartyBasicAuth < RuboCop::Cop::Base MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`" - RESTRICT_ON_SEND = %i(get put post delete).freeze + RESTRICT_ON_SEND = %i[get put post delete].freeze def_node_matcher :httparty_basic_auth?, <<~PATTERN (send diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index d49280c39e42..400c0c3a2a7e 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -19,9 +19,9 @@ module MigrationHelpers # List of helpers that add new columns, either directly (ADD_COLUMN_METHODS) # or through a create/alter table (TABLE_METHODS) - ADD_COLUMN_METHODS = %i(add_column change_column_type_concurrently).freeze + ADD_COLUMN_METHODS = %i[add_column change_column_type_concurrently].freeze - TABLE_METHODS = %i(create_table create_table_if_not_exists change_table).freeze + TABLE_METHODS = %i[create_table create_table_if_not_exists change_table].freeze def high_traffic_tables @high_traffic_tables ||= rubocop_migrations_config.dig('Migration/UpdateLargeTable', 'HighTrafficTables') diff --git a/scripts/qa/quarantine-types-check b/scripts/qa/quarantine-types-check index 188348b949cf..8c2768b67223 100755 --- a/scripts/qa/quarantine-types-check +++ b/scripts/qa/quarantine-types-check @@ -7,8 +7,8 @@ QUARANTINE_TYPES = %w[stale bug investigating flaky broken test_environment wait missing_issues = [] quarantine_type_errors = [] -invalid_type_message = %"\n*** The following quarantined tests have invalid types:\n\n%s\n" -missing_issue_message = %"\n*** The following quarantined tests are missing issue links:\n\n%s\n" +invalid_type_message = %(\n*** The following quarantined tests have invalid types:\n\n%s\n) +missing_issue_message = %(\n*** The following quarantined tests are missing issue links:\n\n%s\n) test_metadata_file = ARGV.shift diff --git a/scripts/qa/testcases-check b/scripts/qa/testcases-check index 2bc1ea2c5c79..fad5f620e021 100755 --- a/scripts/qa/testcases-check +++ b/scripts/qa/testcases-check @@ -9,9 +9,9 @@ testcases = [] missing_testcases = [] formatted_duplicates = [] testcase_format_errors = [] -missing_message = %"\n*** The following tests are missing testcase links:\n\n%s\n" -duplicate_message = %"\n*** The following tests have duplicate testcase links:\n\n%s" -format_message = %"\n*** The following testcase links are incorrectly formatted:\n\n%s\n" +missing_message = %(\n*** The following tests are missing testcase links:\n\n%s\n) +duplicate_message = %(\n*** The following tests have duplicate testcase links:\n\n%s) +format_message = %(\n*** The following testcase links are incorrectly formatted:\n\n%s\n) test_metadata_file = ARGV.shift diff --git a/scripts/regenerate-schema b/scripts/regenerate-schema index 67c58339c6ca..f10184033953 100755 --- a/scripts/regenerate-schema +++ b/scripts/regenerate-schema @@ -52,8 +52,8 @@ class SchemaRegenerator def checkout_ref return unless ci? - run %[git checkout #{source_ref}] - run %q[git clean -f -- db] + run %(git checkout #{source_ref}) + run %q(git clean -f -- db) end ## @@ -71,8 +71,8 @@ class SchemaRegenerator return false unless project_url return false unless target_project_url - run %[git remote add target_project #{target_project_url}.git] - run %[git fetch target_project #{target_branch}:#{target_branch}] + run %(git remote add target_project #{target_project_url}.git) + run %(git fetch target_project #{target_branch}:#{target_branch}) local_checkout_clean_schema end @@ -83,8 +83,8 @@ class SchemaRegenerator # Ask git to checkout the schema from the target branch and reset # the file to unstage the changes. def local_checkout_clean_schema - run %[git checkout #{merge_base} -- #{FILENAME}] - run %[git reset -- #{FILENAME}] + run %(git checkout #{merge_base} -- #{FILENAME}) + run %(git reset -- #{FILENAME}) end ## @@ -152,19 +152,19 @@ class SchemaRegenerator ## # Stop spring before modifying the database def stop_spring - run %q[bin/spring stop] + run %q(bin/spring stop) end ## # Run rake task to reset the database. def reset_db - run %q[bin/rails db:reset RAILS_ENV=test] + run %q(bin/rails db:reset RAILS_ENV=test) end ## # Run rake task to run migrations. def migrate - run %q[bin/rails db:migrate RAILS_ENV=test] + run %q(bin/rails db:migrate RAILS_ENV=test) end ## diff --git a/scripts/undercoverage b/scripts/undercoverage index 348f421c0d57..4acfc78b11bc 100755 --- a/scripts/undercoverage +++ b/scripts/undercoverage @@ -20,11 +20,11 @@ module Undercover end compare_base = ARGV[0] -compare_base ||= IO.popen(%w(git merge-base origin/master HEAD)) { |p| p.read.chomp } +compare_base ||= IO.popen(%w[git merge-base origin/master HEAD]) { |p| p.read.chomp } coverage_file_path = 'coverage/lcov/gitlab.lcov' result = if File.exist?(coverage_file_path) - Undercover::CLI.run(%W(-c #{compare_base})) + Undercover::CLI.run(%W[-c #{compare_base}]) else warn "#{coverage_file_path} doesn't exist" 0 diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index fc065d799d48..ddedc63e4586 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -23,10 +23,10 @@ class CLI THREAD_NAME = 'sidekiq-cluster' # The signals that should terminate both the master and workers. - TERMINATE_SIGNALS = %i(INT TERM).freeze + TERMINATE_SIGNALS = %i[INT TERM].freeze # The signals that should simply be forwarded to the workers. - FORWARD_SIGNALS = %i(TTIN USR1 USR2 HUP).freeze + FORWARD_SIGNALS = %i[TTIN USR1 USR2 HUP].freeze # The default queues that each Sidekiq process always listens to if routing rules are not customized: # - `default` queue comes from config initializer's Settings.build_sidekiq_routing_rules diff --git a/tooling/danger/datateam.rb b/tooling/danger/datateam.rb index 86e413e55b6b..1354e684d508 100644 --- a/tooling/danger/datateam.rb +++ b/tooling/danger/datateam.rb @@ -17,7 +17,7 @@ module Datateam PERFORMANCE_INDICATOR_REGEX = %r{gmau|smau|paid_gmau|umau} METRIC_REMOVED = %r{\+status: removed} DATABASE_REGEX = %r{\Adb/structure\.sql} - STRUCTURE_SQL_FILE = %w(db/structure.sql).freeze + STRUCTURE_SQL_FILE = %w[db/structure.sql].freeze def build_message return unless impacted? -- GitLab