diff --git a/.rubocop_todo/style/mutable_constant.yml b/.rubocop_todo/style/mutable_constant.yml index 8e6a0a2335bb1a4e0eb162709d6c28ed5be1ad66..dd7fd259b2f6470d902dd7f5ab5b351d7bca094a 100644 --- a/.rubocop_todo/style/mutable_constant.yml +++ b/.rubocop_todo/style/mutable_constant.yml @@ -40,16 +40,6 @@ Style/MutableConstant: - 'lib/gitlab/sidekiq_signals.rb' - 'lib/gitlab/web_hooks/recursion_detection/uuid.rb' - 'lib/tasks/gitlab/backup.rake' - - 'rubocop/cop/background_migration/feature_category.rb' - - 'rubocop/cop/filename_length.rb' - - 'rubocop/cop/gitlab/event_store_subscriber.rb' - - 'rubocop/cop/graphql/descriptions.rb' - - 'rubocop/cop/graphql/enum_names.rb' - - 'rubocop/cop/migration/prevent_index_creation.rb' - - 'rubocop/cop/migration/versioned_migration_class.rb' - - 'rubocop/cop/migration/with_lock_retries_disallowed_method.rb' - - 'rubocop/cop/scalability/idempotent_worker.rb' - - 'rubocop/cop/sidekiq_load_balancing/worker_data_consistency.rb' - 'scripts/lib/glfm/constants.rb' - 'scripts/lint-docs-blueprints.rb' - 'scripts/perf/gc/collect_gc_stats.rb' diff --git a/rubocop/cop/background_migration/feature_category.rb b/rubocop/cop/background_migration/feature_category.rb index ec70b5baadf6c3d883e150be301a2985ded7de72..c6611a65e49cf0715db56b7495cb7e8f0169ac35 100644 --- a/rubocop/cop/background_migration/feature_category.rb +++ b/rubocop/cop/background_migration/feature_category.rb @@ -17,7 +17,7 @@ class FeatureCategory < RuboCop::Cop::Base "https://docs.gitlab.com/ee/development/feature_categorization/#batched-background-migrations" INVALID_FEATURE_CATEGORY_MSG = "'feature_category' is invalid. " \ - "List of valid ones can be found in #{FEATURE_CATEGORIES_FILE_PATH}" + "List of valid ones can be found in #{FEATURE_CATEGORIES_FILE_PATH}".freeze RESTRICT_ON_SEND = [:feature_category].freeze diff --git a/rubocop/cop/filename_length.rb b/rubocop/cop/filename_length.rb index 948f69cc88cbc1148e7b073c083c6de8075f59cc..4144337f00f5f1e81e95ea22d27637bd4ba8d107 100644 --- a/rubocop/cop/filename_length.rb +++ b/rubocop/cop/filename_length.rb @@ -7,8 +7,8 @@ class FilenameLength < RuboCop::Cop::Base FILEPATH_MAX_BYTES = 256 FILENAME_MAX_BYTES = 100 - MSG_FILEPATH_LEN = "This file path is too long. It should be #{FILEPATH_MAX_BYTES} or less" - MSG_FILENAME_LEN = "This file name is too long. It should be #{FILENAME_MAX_BYTES} or less" + MSG_FILEPATH_LEN = "This file path is too long. It should be #{FILEPATH_MAX_BYTES} or less".freeze + MSG_FILENAME_LEN = "This file name is too long. It should be #{FILENAME_MAX_BYTES} or less".freeze def on_new_investigation file_path = processed_source.file_path diff --git a/rubocop/cop/gitlab/event_store_subscriber.rb b/rubocop/cop/gitlab/event_store_subscriber.rb index 7e4cc3e66cca5e5ecbb619689fb0fb751c68d5ac..04dc29ec400e36673ba07a70bd3963b354145512 100644 --- a/rubocop/cop/gitlab/event_store_subscriber.rb +++ b/rubocop/cop/gitlab/event_store_subscriber.rb @@ -32,8 +32,8 @@ module Gitlab # class EventStoreSubscriber < RuboCop::Cop::Base SUBSCRIBER_MODULE_NAME = 'Gitlab::EventStore::Subscriber' - FORBID_PERFORM_OVERRIDE = "Do not override `perform` in a `#{SUBSCRIBER_MODULE_NAME}`." - REQUIRE_HANDLE_EVENT = "A `#{SUBSCRIBER_MODULE_NAME}` must implement `#handle_event(event)`." + FORBID_PERFORM_OVERRIDE = "Do not override `perform` in a `#{SUBSCRIBER_MODULE_NAME}`.".freeze + REQUIRE_HANDLE_EVENT = "A `#{SUBSCRIBER_MODULE_NAME}` must implement `#handle_event(event)`.".freeze def_node_matcher :includes_subscriber?, <<~PATTERN (send nil? :include (const (const (const nil? :Gitlab) :EventStore) :Subscriber)) diff --git a/rubocop/cop/graphql/descriptions.rb b/rubocop/cop/graphql/descriptions.rb index 239f5b966a4b8c7b046f909c951939a397a216aa..b096dfb148e0635c971b8a145c57b2219ac7fbb9 100644 --- a/rubocop/cop/graphql/descriptions.rb +++ b/rubocop/cop/graphql/descriptions.rb @@ -51,11 +51,12 @@ class Descriptions < RuboCop::Cop::Base extend RuboCop::Cop::AutoCorrector MSG_STYLE_GUIDE_LINK = 'See the description style guide: https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#description-style-guide' - MSG_NO_DESCRIPTION = "Please add a `description` property. #{MSG_STYLE_GUIDE_LINK}" - MSG_NO_PERIOD = "`description` strings must end with a `.`. #{MSG_STYLE_GUIDE_LINK}" - MSG_BAD_START = "`description` strings should not start with \"A...\" or \"The...\". #{MSG_STYLE_GUIDE_LINK}" + MSG_NO_DESCRIPTION = "Please add a `description` property. #{MSG_STYLE_GUIDE_LINK}".freeze + MSG_NO_PERIOD = "`description` strings must end with a `.`. #{MSG_STYLE_GUIDE_LINK}".freeze + MSG_BAD_START = "`description` strings should not start with \"A...\" or \"The...\"."\ + " #{MSG_STYLE_GUIDE_LINK}".freeze MSG_CONTAINS_THIS = "`description` strings should not contain the demonstrative \"this\"."\ - " #{MSG_STYLE_GUIDE_LINK}" + " #{MSG_STYLE_GUIDE_LINK}".freeze def_node_matcher :graphql_describable?, <<~PATTERN (send nil? {:field :argument :value} ...) diff --git a/rubocop/cop/graphql/enum_names.rb b/rubocop/cop/graphql/enum_names.rb index 74847cb8d17093d14e74ef5fce338c626d3e3552..19ba426fdeb7c98518b5a84fe64bae2712393fff 100644 --- a/rubocop/cop/graphql/enum_names.rb +++ b/rubocop/cop/graphql/enum_names.rb @@ -34,9 +34,9 @@ module Cop module Graphql class EnumNames < RuboCop::Cop::Base SEE_SG_MSG = "See https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#enums" - CLASS_NAME_SUFFIX_MSG = "Enum class names must end with `Enum`. #{SEE_SG_MSG}" - GRAPHQL_NAME_MISSING_MSG = "A `graphql_name` must be defined for a GraphQL enum. #{SEE_SG_MSG}" - GRAPHQL_NAME_WITH_ENUM_MSG = "The `graphql_name` must not contain the string \"Enum\". #{SEE_SG_MSG}" + CLASS_NAME_SUFFIX_MSG = "Enum class names must end with `Enum`. #{SEE_SG_MSG}".freeze + GRAPHQL_NAME_MISSING_MSG = "A `graphql_name` must be defined for a GraphQL enum. #{SEE_SG_MSG}".freeze + GRAPHQL_NAME_WITH_ENUM_MSG = "The `graphql_name` must not contain the string \"Enum\". #{SEE_SG_MSG}".freeze def_node_matcher :enum_subclass, <<~PATTERN (class $(const nil? _) (const {nil? cbase} /.*Enum$/) ...) diff --git a/rubocop/cop/migration/prevent_index_creation.rb b/rubocop/cop/migration/prevent_index_creation.rb index 185f36cb24ba2b2bdeff992cf0855a1fc6ea4230..4c39032eb0fec4a3a4a2e58e6ef4176bc52231e7 100644 --- a/rubocop/cop/migration/prevent_index_creation.rb +++ b/rubocop/cop/migration/prevent_index_creation.rb @@ -10,7 +10,7 @@ class PreventIndexCreation < RuboCop::Cop::Base FORBIDDEN_TABLES = %i[ci_builds].freeze - MSG = "Adding new index to #{FORBIDDEN_TABLES.join(", ")} is forbidden, see https://gitlab.com/gitlab-org/gitlab/-/issues/332886" + MSG = "Adding new index to #{FORBIDDEN_TABLES.join(", ")} is forbidden, see https://gitlab.com/gitlab-org/gitlab/-/issues/332886".freeze def on_new_investigation super diff --git a/rubocop/cop/migration/versioned_migration_class.rb b/rubocop/cop/migration/versioned_migration_class.rb index 27f1c0e16a190a6a529fbb761492aed485ef8a1f..d078acedb37f113be734243af3d5f9001ba82d7f 100644 --- a/rubocop/cop/migration/versioned_migration_class.rb +++ b/rubocop/cop/migration/versioned_migration_class.rb @@ -12,10 +12,10 @@ class VersionedMigrationClass < RuboCop::Cop::Base DOC_LINK = "https://docs.gitlab.com/ee/development/migration_style_guide.html#migration-helpers-and-versioning" MSG_INHERIT = "Don't inherit from ActiveRecord::Migration or old versions of Gitlab::Database::Migration. " \ - "Use Gitlab::Database::Migration[2.1] instead. See #{DOC_LINK}." + "Use Gitlab::Database::Migration[2.1] instead. See #{DOC_LINK}.".freeze MSG_INCLUDE = "Don't include migration helper modules directly. " \ - "Inherit from Gitlab::Database::Migration[2.1] instead. See #{DOC_LINK}." + "Inherit from Gitlab::Database::Migration[2.1] instead. See #{DOC_LINK}.".freeze GITLAB_MIGRATION_CLASS = 'Gitlab::Database::Migration' ACTIVERECORD_MIGRATION_CLASS = 'ActiveRecord::Migration' diff --git a/rubocop/cop/migration/with_lock_retries_disallowed_method.rb b/rubocop/cop/migration/with_lock_retries_disallowed_method.rb index 5c96b38dcdc8e7ebd5d1063a0c634a962b283143..1b0d5ed9324deee4b3bd15215c116ff738c84fa9 100644 --- a/rubocop/cop/migration/with_lock_retries_disallowed_method.rb +++ b/rubocop/cop/migration/with_lock_retries_disallowed_method.rb @@ -31,7 +31,7 @@ class WithLockRetriesDisallowedMethod < RuboCop::Cop::Base create_trigger_to_sync_tables ].sort.freeze - MSG = "The method is not allowed to be called within the `with_lock_retries` block, the only allowed methods are: #{ALLOWED_MIGRATION_METHODS.join(', ')}" + MSG = "The method is not allowed to be called within the `with_lock_retries` block, the only allowed methods are: #{ALLOWED_MIGRATION_METHODS.join(', ')}".freeze MSG_ONLY_ONE_FK_ALLOWED = "Avoid adding more than one foreign key within the `with_lock_retries`. See https://docs.gitlab.com/ee/development/migration_style_guide.html#examples" def_node_matcher :send_node?, <<~PATTERN diff --git a/rubocop/cop/scalability/idempotent_worker.rb b/rubocop/cop/scalability/idempotent_worker.rb index 88b5d796def5bdb35c80110eb10dd4f692d5a8cf..fee9e952105e457834cb2ffa46e49846e8c83309 100644 --- a/rubocop/cop/scalability/idempotent_worker.rb +++ b/rubocop/cop/scalability/idempotent_worker.rb @@ -28,7 +28,7 @@ class IdempotentWorker < RuboCop::Cop::Base HELP_LINK = 'https://github.com/mperham/sidekiq/wiki/Best-Practices#2-make-your-job-idempotent-and-transactional' - MSG = <<~MSG + MSG = <<~MSG.freeze Avoid adding not idempotent workers. A worker is considered idempotent if: diff --git a/rubocop/cop/sidekiq_load_balancing/worker_data_consistency.rb b/rubocop/cop/sidekiq_load_balancing/worker_data_consistency.rb index badd81ff1381ec9afab01c783187af6db59eaf54..1d421a5d017075d74a56baa9ba2571cb4c161582 100644 --- a/rubocop/cop/sidekiq_load_balancing/worker_data_consistency.rb +++ b/rubocop/cop/sidekiq_load_balancing/worker_data_consistency.rb @@ -28,13 +28,13 @@ class WorkerDataConsistency < RuboCop::Cop::Base HELP_LINK = 'https://docs.gitlab.com/ee/development/sidekiq/worker_attributes.html#job-data-consistency-strategies' - MISSING_DATA_CONSISTENCY_MSG = <<~MSG + MISSING_DATA_CONSISTENCY_MSG = <<~MSG.freeze Should define data_consistency expectation. See #{HELP_LINK} for a more detailed explanation of these settings. MSG DISCOURAGE_ALWAYS_MSG = "Refrain from using `:always` if possible." \ - "See #{HELP_LINK} for a more detailed explanation of these settings." + "See #{HELP_LINK} for a more detailed explanation of these settings.".freeze def_node_search :application_worker?, <<~PATTERN `(send nil? :include (const nil? :ApplicationWorker))