Avoid calling freeze on already frozen strings in app/services

This commit is contained in:
dineshpanda 2019-09-01 00:52:19 +05:30
parent df6f1dd93f
commit ee1633e383
11 changed files with 14 additions and 14 deletions

View file

@ -2,7 +2,7 @@
module Auth module Auth
class ContainerRegistryAuthenticationService < BaseService class ContainerRegistryAuthenticationService < BaseService
AUDIENCE = 'container_registry'.freeze AUDIENCE = 'container_registry'
def execute(authentication_abilities:) def execute(authentication_abilities:)
@authentication_abilities = authentication_abilities @authentication_abilities = authentication_abilities

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class AutoMergeService < BaseService class AutoMergeService < BaseService
STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS = 'merge_when_pipeline_succeeds'.freeze STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS = 'merge_when_pipeline_succeeds'
STRATEGIES = [STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS].freeze STRATEGIES = [STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS].freeze
class << self class << self

View file

@ -2,7 +2,7 @@
module MergeRequests module MergeRequests
class RebaseService < MergeRequests::WorkingCopyBaseService class RebaseService < MergeRequests::WorkingCopyBaseService
REBASE_ERROR = 'Rebase failed. Please rebase locally'.freeze REBASE_ERROR = 'Rebase failed. Please rebase locally'
def execute(merge_request) def execute(merge_request)
@merge_request = merge_request @merge_request = merge_request

View file

@ -6,7 +6,7 @@ module Projects
DestroyError = Class.new(StandardError) DestroyError = Class.new(StandardError)
DELETED_FLAG = '+deleted'.freeze DELETED_FLAG = '+deleted'
REPO_REMOVAL_DELAY = 5.minutes.to_i REPO_REMOVAL_DELAY = 5.minutes.to_i
def async_execute def async_execute

View file

@ -5,7 +5,7 @@
module Projects module Projects
module LfsPointers module LfsPointers
class LfsDownloadLinkListService < BaseService class LfsDownloadLinkListService < BaseService
DOWNLOAD_ACTION = 'download'.freeze DOWNLOAD_ACTION = 'download'
DownloadLinksError = Class.new(StandardError) DownloadLinksError = Class.new(StandardError)
DownloadLinkNotFound = Class.new(StandardError) DownloadLinkNotFound = Class.new(StandardError)

View file

@ -4,7 +4,7 @@
module Projects module Projects
module LfsPointers module LfsPointers
class LfsListService < BaseService class LfsListService < BaseService
REV = 'HEAD'.freeze REV = 'HEAD'
# Retrieve all lfs blob pointers and returns a hash # Retrieve all lfs blob pointers and returns a hash
# with the structure { lfs_file_oid => lfs_file_size } # with the structure { lfs_file_oid => lfs_file_size }

View file

@ -8,9 +8,9 @@ module Projects
class LfsObjectDownloadListService < BaseService class LfsObjectDownloadListService < BaseService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
HEAD_REV = 'HEAD'.freeze HEAD_REV = 'HEAD'
LFS_ENDPOINT_PATTERN = /^\t?url\s*=\s*(.+)$/.freeze LFS_ENDPOINT_PATTERN = /^\t?url\s*=\s*(.+)$/.freeze
LFS_BATCH_API_ENDPOINT = '/info/lfs/objects/batch'.freeze LFS_BATCH_API_ENDPOINT = '/info/lfs/objects/batch'
LfsObjectDownloadListError = Class.new(StandardError) LfsObjectDownloadListError = Class.new(StandardError)

View file

@ -7,8 +7,8 @@ module Projects
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
# Cache keys used to store issues count # Cache keys used to store issues count
PUBLIC_COUNT_KEY = 'public_open_issues_count'.freeze PUBLIC_COUNT_KEY = 'public_open_issues_count'
TOTAL_COUNT_KEY = 'total_open_issues_count'.freeze TOTAL_COUNT_KEY = 'total_open_issues_count'
def initialize(project, user = nil) def initialize(project, user = nil)
@user = user @user = user

View file

@ -7,11 +7,11 @@ module Projects
BLOCK_SIZE = 32.kilobytes BLOCK_SIZE = 32.kilobytes
MAX_SIZE = 1.terabyte MAX_SIZE = 1.terabyte
PUBLIC_DIR = 'public'.freeze PUBLIC_DIR = 'public'
# this has to be invalid group name, # this has to be invalid group name,
# as it shares the namespace with groups # as it shares the namespace with groups
TMP_EXTRACT_PATH = '@pages.tmp'.freeze TMP_EXTRACT_PATH = '@pages.tmp'
attr_reader :build attr_reader :build

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class SubmitUsagePingService class SubmitUsagePingService
URL = 'https://version.gitlab.com/usage_data'.freeze URL = 'https://version.gitlab.com/usage_data'
METRICS = %w[leader_issues instance_issues percentage_issues leader_notes instance_notes METRICS = %w[leader_issues instance_issues percentage_issues leader_notes instance_notes
percentage_notes leader_milestones instance_milestones percentage_milestones percentage_notes leader_milestones instance_milestones percentage_milestones

View file

@ -2,7 +2,7 @@
module Wikis module Wikis
class CreateAttachmentService < Files::CreateService class CreateAttachmentService < Files::CreateService
ATTACHMENT_PATH = 'uploads'.freeze ATTACHMENT_PATH = 'uploads'
MAX_FILENAME_LENGTH = 255 MAX_FILENAME_LENGTH = 255
delegate :wiki, to: :project delegate :wiki, to: :project