diff --git a/changelogs/unreleased/31343-remove-unnecessary-use-of-freeze4.yml b/changelogs/unreleased/31343-remove-unnecessary-use-of-freeze4.yml new file mode 100644 index 0000000000000000000000000000000000000000..22e685729e32109440ccfc6431b9ed2ad0a06021 --- /dev/null +++ b/changelogs/unreleased/31343-remove-unnecessary-use-of-freeze4.yml @@ -0,0 +1,5 @@ +--- +title: Remove unnecessary use of freeze +merge_request: 57059 +author: Lee Tickett @leetickett +type: other diff --git a/lib/gitlab/jira/dvcs.rb b/lib/gitlab/jira/dvcs.rb index 4415f98fc7f8405fbb1a4e4fcc7a0c40f43b0ef3..ddf2cd76709c5af78866a7562e134e94f26a7d7e 100644 --- a/lib/gitlab/jira/dvcs.rb +++ b/lib/gitlab/jira/dvcs.rb @@ -3,8 +3,8 @@ module Gitlab module Jira module Dvcs - ENCODED_SLASH = '@'.freeze - SLASH = '/'.freeze + ENCODED_SLASH = '@' + SLASH = '/' ENCODED_ROUTE_REGEX = /[a-zA-Z0-9_\-\.#{ENCODED_SLASH}]+/.freeze def self.encode_slash(path) diff --git a/lib/gitlab/kubernetes/deployment.rb b/lib/gitlab/kubernetes/deployment.rb index 55ed9a7517ead4e6216a79915b699dc395ebf89f..f2e3a0e6810f560bda53206ca9229f9f04ab4de3 100644 --- a/lib/gitlab/kubernetes/deployment.rb +++ b/lib/gitlab/kubernetes/deployment.rb @@ -5,7 +5,7 @@ module Kubernetes class Deployment include Gitlab::Utils::StrongMemoize - STABLE_TRACK_VALUE = 'stable'.freeze + STABLE_TRACK_VALUE = 'stable' def initialize(attributes = {}, pods: []) @attributes = attributes diff --git a/lib/gitlab/tracking/standard_context.rb b/lib/gitlab/tracking/standard_context.rb index 8ce16c11267fcc4ca7dfa633be8f57983737e008..5880116132a8b67164c056d744b5107e2be792d9 100644 --- a/lib/gitlab/tracking/standard_context.rb +++ b/lib/gitlab/tracking/standard_context.rb @@ -3,8 +3,8 @@ module Gitlab module Tracking class StandardContext - GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-3'.freeze - GITLAB_RAILS_SOURCE = 'gitlab-rails'.freeze + GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-3' + GITLAB_RAILS_SOURCE = 'gitlab-rails' def initialize(namespace: nil, project: nil, user: nil, **data) @data = data diff --git a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb index 772a462328010499d495da1c6af88d3fdbd49b7c..f6b78d0ccb1fa9f9953f599b97595e845b6c55d2 100644 --- a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb @@ -2,7 +2,7 @@ module Gitlab::UsageDataCounters class CiTemplateUniqueCounter - REDIS_SLOT = 'ci_templates'.freeze + REDIS_SLOT = 'ci_templates' # NOTE: Events originating from implicit Auto DevOps pipelines get prefixed with `implicit_` TEMPLATE_TO_EVENT = { diff --git a/qa/qa/runtime/api/request.rb b/qa/qa/runtime/api/request.rb index b58be3541030b93ac3485fea51da04c54ed75994..28bae541cb81736da5c0b0ee3915060c6538f9f0 100644 --- a/qa/qa/runtime/api/request.rb +++ b/qa/qa/runtime/api/request.rb @@ -4,7 +4,7 @@ module QA module Runtime module API class Request - API_VERSION = 'v4'.freeze + API_VERSION = 'v4' def initialize(api_client, path, **query_string) query_string[:private_token] ||= api_client.personal_access_token unless query_string[:oauth_access_token] diff --git a/qa/spec/support/helpers/stub_env.rb b/qa/spec/support/helpers/stub_env.rb index 8ad864dbec8f4c183d0d0fc73cdd94949d8cbab8..de8d2f47adfd69bc241df14e91cb30f39e8ad9b7 100644 --- a/qa/spec/support/helpers/stub_env.rb +++ b/qa/spec/support/helpers/stub_env.rb @@ -15,7 +15,7 @@ def stub_env(key_or_hash, value = nil) private - STUBBED_KEY = '__STUBBED__'.freeze + STUBBED_KEY = '__STUBBED__' def add_stubbed_value(key, value) allow(ENV).to receive(:[]).with(key).and_return(value) diff --git a/rubocop/cop/gitlab/rails_logger.rb b/rubocop/cop/gitlab/rails_logger.rb index ad35d2ccfbb29024ee1affbf22fb14137981a6f0..5a1695ce56e8c32bdffc73a103a3fdb5099e1059 100644 --- a/rubocop/cop/gitlab/rails_logger.rb +++ b/rubocop/cop/gitlab/rails_logger.rb @@ -21,7 +21,7 @@ class RailsLogger < ::RuboCop::Cop::Cop # # OK # Rails.logger.level MSG = 'Use a structured JSON logger instead of `Rails.logger`. ' \ - 'https://docs.gitlab.com/ee/development/logging.html'.freeze + 'https://docs.gitlab.com/ee/development/logging.html' # See supported log methods: # https://ruby-doc.org/stdlib-2.6.6/libdoc/logger/rdoc/Logger.html diff --git a/rubocop/cop/graphql/json_type.rb b/rubocop/cop/graphql/json_type.rb index 1e3e3d7a7ff5ac29d36fd6e4f3d6e7dd80f103fc..a8c383585353bf6f062662407a509144906f8a00 100644 --- a/rubocop/cop/graphql/json_type.rb +++ b/rubocop/cop/graphql/json_type.rb @@ -20,7 +20,7 @@ module Cop module Graphql class JSONType < RuboCop::Cop::Cop MSG = 'Avoid using GraphQL::Types::JSON. See: ' \ - 'https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#json'.freeze + 'https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#json' def_node_matcher :has_json_type?, <<~PATTERN (send nil? {:field :argument} diff --git a/rubocop/cop/include_sidekiq_worker.rb b/rubocop/cop/include_sidekiq_worker.rb index e69bc018add58d97fbadb36044fe1f12f0d1dc60..e39b8bf92c2bf70007706db78c16deef62c36d75 100644 --- a/rubocop/cop/include_sidekiq_worker.rb +++ b/rubocop/cop/include_sidekiq_worker.rb @@ -4,7 +4,7 @@ module RuboCop module Cop # Cop that makes sure workers include `ApplicationWorker`, not `Sidekiq::Worker`. class IncludeSidekiqWorker < RuboCop::Cop::Cop - MSG = 'Include `ApplicationWorker`, not `Sidekiq::Worker`.'.freeze + MSG = 'Include `ApplicationWorker`, not `Sidekiq::Worker`.' def_node_matcher :includes_sidekiq_worker?, <<~PATTERN (send nil? :include (const (const nil? :Sidekiq) :Worker)) diff --git a/rubocop/cop/lint/last_keyword_argument.rb b/rubocop/cop/lint/last_keyword_argument.rb index 9652c1ace8deb378f480524f294aff7da0251274..80f4660eeb87758ec90533635a0506a07a6019fd 100644 --- a/rubocop/cop/lint/last_keyword_argument.rb +++ b/rubocop/cop/lint/last_keyword_argument.rb @@ -10,7 +10,7 @@ module Lint # 1. Downloading the complete set of deprecations/ files from a CI # pipeline (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47720) class LastKeywordArgument < Cop - MSG = 'Using the last argument as keyword parameters is deprecated'.freeze + MSG = 'Using the last argument as keyword parameters is deprecated' DEPRECATIONS_GLOB = File.expand_path('../../../deprecations/**/*.yml', __dir__) KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call' diff --git a/rubocop/cop/migration/add_column_with_default.rb b/rubocop/cop/migration/add_column_with_default.rb index 355319b0dfe6e255ef5bfe496beacd89be8d23de..afd7d93cd4731055f3f9c0d065287678f0931924 100644 --- a/rubocop/cop/migration/add_column_with_default.rb +++ b/rubocop/cop/migration/add_column_with_default.rb @@ -8,7 +8,7 @@ module Migration class AddColumnWithDefault < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_column_with_default` is deprecated, use `add_column` instead'.freeze + MSG = '`add_column_with_default` is deprecated, use `add_column` instead' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_concurrent_foreign_key.rb b/rubocop/cop/migration/add_concurrent_foreign_key.rb index 957bd30af63d4a9da3d82890a6e1b936945de2b1..ebab6aa653ec286771fc1243b6497d8c9f38abef 100644 --- a/rubocop/cop/migration/add_concurrent_foreign_key.rb +++ b/rubocop/cop/migration/add_concurrent_foreign_key.rb @@ -10,7 +10,7 @@ module Migration class AddConcurrentForeignKey < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead'.freeze + MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead' def_node_matcher :false_node?, <<~PATTERN (false) diff --git a/rubocop/cop/migration/add_concurrent_index.rb b/rubocop/cop/migration/add_concurrent_index.rb index 510f98ce3734598606af5b4c186a6375213cc38a..bfe7c15bfdf0440e923c9ec5894434143c9d9a01 100644 --- a/rubocop/cop/migration/add_concurrent_index.rb +++ b/rubocop/cop/migration/add_concurrent_index.rb @@ -11,7 +11,7 @@ class AddConcurrentIndex < RuboCop::Cop::Cop include MigrationHelpers MSG = '`add_concurrent_index` is not reversible so you must manually define ' \ - 'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`'.freeze + 'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_index.rb b/rubocop/cop/migration/add_index.rb index 7415880e554c28be9529e9583b725b7ea7516c19..327e89fb040fe002e82e90f41a71c8b4cb0f754c 100644 --- a/rubocop/cop/migration/add_index.rb +++ b/rubocop/cop/migration/add_index.rb @@ -9,7 +9,7 @@ module Migration class AddIndex < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_index` requires downtime, use `add_concurrent_index` instead'.freeze + MSG = '`add_index` requires downtime, use `add_concurrent_index` instead' def on_def(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_limit_to_text_columns.rb b/rubocop/cop/migration/add_limit_to_text_columns.rb index 126e4e21f2206cc52180730dae17ce935773501e..f45551e60a4263dfc79c7006fed8b0959b0893d3 100644 --- a/rubocop/cop/migration/add_limit_to_text_columns.rb +++ b/rubocop/cop/migration/add_limit_to_text_columns.rb @@ -14,7 +14,7 @@ class AddLimitToTextColumns < RuboCop::Cop::Cop include MigrationHelpers MSG = 'Text columns should always have a limit set (255 is suggested). ' \ - 'You can add a limit to a `text` column by using `add_text_limit`'.freeze + 'You can add a limit to a `text` column by using `add_text_limit`' def_node_matcher :reverting?, <<~PATTERN (def :down ...) diff --git a/rubocop/cop/migration/add_timestamps.rb b/rubocop/cop/migration/add_timestamps.rb index d16e8b1f45bac65f094af89c1d59e52a1cff6ff8..01d3f01ef4f8788e7d9471343e6e8b2a32aa19b9 100644 --- a/rubocop/cop/migration/add_timestamps.rb +++ b/rubocop/cop/migration/add_timestamps.rb @@ -9,7 +9,7 @@ module Migration class AddTimestamps < RuboCop::Cop::Cop include MigrationHelpers - MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead'.freeze + MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead' # Check methods. def on_send(node) diff --git a/rubocop/cop/migration/datetime.rb b/rubocop/cop/migration/datetime.rb index 51e0c3e5a22707e384d8afefdad1e953aa4684d0..c605c8e1b6e9a06ace49639240995dbfda60d199 100644 --- a/rubocop/cop/migration/datetime.rb +++ b/rubocop/cop/migration/datetime.rb @@ -9,7 +9,7 @@ module Migration class Datetime < RuboCop::Cop::Cop include MigrationHelpers - MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead'.freeze + MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead' # Check methods in table creation. def on_def(node) diff --git a/rubocop/cop/project_path_helper.rb b/rubocop/cop/project_path_helper.rb index bc2454e5b1f947e4f952f763a225ee44e71b6158..ec3f847faf9b76506738e937fc5e7de011d858af 100644 --- a/rubocop/cop/project_path_helper.rb +++ b/rubocop/cop/project_path_helper.rb @@ -5,7 +5,7 @@ module Cop class ProjectPathHelper < RuboCop::Cop::Cop MSG = 'Use short project path helpers without explicitly passing the namespace: ' \ '`foo_project_bar_path(project, bar)` instead of ' \ - '`foo_namespace_project_bar_path(project.namespace, project, bar)`.'.freeze + '`foo_namespace_project_bar_path(project.namespace, project, bar)`.' METHOD_NAME_PATTERN = /\A([a-z_]+_)?namespace_project(?:_[a-z_]+)?_(?:url|path)\z/.freeze diff --git a/rubocop/cop/safe_params.rb b/rubocop/cop/safe_params.rb index 250c16232e4bc538be6cdb557799b4ff83af0751..2720732c1614a798185dd4d60a8d353cd6af30f8 100644 --- a/rubocop/cop/safe_params.rb +++ b/rubocop/cop/safe_params.rb @@ -3,7 +3,7 @@ module RuboCop module Cop class SafeParams < RuboCop::Cop::Cop - MSG = 'Use `safe_params` instead of `params` in url_for.'.freeze + MSG = 'Use `safe_params` instead of `params` in url_for.' METHOD_NAME_PATTERN = :url_for UNSAFE_PARAM = :params diff --git a/rubocop/cop/sidekiq_options_queue.rb b/rubocop/cop/sidekiq_options_queue.rb index 499c712175ecb58140e1f557ab16b45afdde0462..2574a229ec20f9fe942283ac8cc43041dab8e395 100644 --- a/rubocop/cop/sidekiq_options_queue.rb +++ b/rubocop/cop/sidekiq_options_queue.rb @@ -4,7 +4,7 @@ module RuboCop module Cop # Cop that prevents manually setting a queue in Sidekiq workers. class SidekiqOptionsQueue < RuboCop::Cop::Cop - MSG = 'Do not manually set a queue; `ApplicationWorker` sets one automatically.'.freeze + MSG = 'Do not manually set a queue; `ApplicationWorker` sets one automatically.' def_node_matcher :sidekiq_options?, <<~PATTERN (send nil? :sidekiq_options $...)