Commit 33702b3f authored by Sean McGivern's avatar Sean McGivern

Merge branch '31343-remove-unnecessary-use-of-freeze4' into 'master'

Remove unnecessary use of freeze

See merge request gitlab-org/gitlab!57059
parents 7ed64fd6 7def2a81
---
title: Remove unnecessary use of freeze
merge_request: 57059
author: Lee Tickett @leetickett
type: other
......@@ -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)
......
......@@ -5,7 +5,7 @@ module Gitlab
class Deployment
include Gitlab::Utils::StrongMemoize
STABLE_TRACK_VALUE = 'stable'.freeze
STABLE_TRACK_VALUE = 'stable'
def initialize(attributes = {}, pods: [])
@attributes = attributes
......
......@@ -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
......
......@@ -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 = {
......
......@@ -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]
......
......@@ -15,7 +15,7 @@ module Helpers
private
STUBBED_KEY = '__STUBBED__'.freeze
STUBBED_KEY = '__STUBBED__'
def add_stubbed_value(key, value)
allow(ENV).to receive(:[]).with(key).and_return(value)
......
......@@ -21,7 +21,7 @@ module RuboCop
# # 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
......
......@@ -20,7 +20,7 @@ module RuboCop
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}
......
......@@ -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))
......
......@@ -10,7 +10,7 @@ module RuboCop
# 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'
......
......@@ -8,7 +8,7 @@ module RuboCop
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)
......
......@@ -10,7 +10,7 @@ module RuboCop
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)
......
......@@ -11,7 +11,7 @@ module RuboCop
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)
......
......@@ -9,7 +9,7 @@ module RuboCop
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)
......
......@@ -14,7 +14,7 @@ module RuboCop
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 ...)
......
......@@ -9,7 +9,7 @@ module RuboCop
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)
......
......@@ -9,7 +9,7 @@ module RuboCop
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)
......
......@@ -5,7 +5,7 @@ module RuboCop
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
......
......@@ -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
......
......@@ -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 $...)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment