Skip to content
Snippets Groups Projects
Commit e908e117 authored by dineshpanda's avatar dineshpanda
Browse files

Avoid calling freeze on already frozen strings in lib/gitlab

parent df6f1dd9
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 37 deletions
Loading
Loading
@@ -3,7 +3,7 @@
module Gitlab
module Auth
class UniqueIpsLimiter
USER_UNIQUE_IPS_PREFIX = 'user_unique_ips'.freeze
USER_UNIQUE_IPS_PREFIX = 'user_unique_ips'
 
class << self
def limit_user_id!(user_id)
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@ module Gitlab
module UserAuthFinders
include Gitlab::Utils::StrongMemoize
 
PRIVATE_TOKEN_HEADER = 'HTTP_PRIVATE_TOKEN'.freeze
PRIVATE_TOKEN_HEADER = 'HTTP_PRIVATE_TOKEN'
PRIVATE_TOKEN_PARAM = :private_token
 
# Check the Rails session for valid authentication details
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize
 
RESCHEDULE_DELAY = 3.hours
WORKER = 'PopulateMergeRequestAssigneesTable'.freeze
WORKER = 'PopulateMergeRequestAssigneesTable'
DeadJobsError = Class.new(StandardError)
 
def perform
Loading
Loading
Loading
Loading
@@ -10,15 +10,15 @@ module Gitlab
include ::Gitlab::Utils::StrongMemoize
 
FIND_BATCH_SIZE = 500
RELATIVE_UPLOAD_DIR = "uploads".freeze
RELATIVE_UPLOAD_DIR = "uploads"
ABSOLUTE_UPLOAD_DIR = File.join(
Gitlab.config.uploads.storage_path,
RELATIVE_UPLOAD_DIR
)
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'
START_WITH_ROOT_REGEX = %r{\A#{Gitlab.config.uploads.storage_path}/}.freeze
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*".freeze
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*".freeze
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*"
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*"
 
# This class is used to iterate over batches of
# `untracked_files_for_uploads` rows.
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module Gitlab
attr_reader :project, :project_key, :repository_slug, :client, :errors, :users
attr_accessor :logger
 
REMOTE_NAME = 'bitbucket_server'.freeze
REMOTE_NAME = 'bitbucket_server'
BATCH_SIZE = 100
 
TempBranch = Struct.new(:name, :sha)
Loading
Loading
Loading
Loading
@@ -3,8 +3,8 @@
module Gitlab
module Checks
class LfsCheck < BaseChecker
LOG_MESSAGE = "Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...".freeze
ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'.freeze
LOG_MESSAGE = 'Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...'
ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'
 
def validate!
return unless Feature.enabled?(:lfs_check, default_enabled: true)
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
module Gitlab
module Checks
class ProjectCreated < PostPushMessage
PROJECT_CREATED = "project_created".freeze
PROJECT_CREATED = "project_created"
 
def message
<<~MESSAGE
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
module Gitlab
module Checks
class ProjectMoved < PostPushMessage
REDIRECT_NAMESPACE = "redirect_namespace".freeze
REDIRECT_NAMESPACE = "redirect_namespace"
 
def initialize(project, user, protocol, redirected_path)
@redirected_path = redirected_path
Loading
Loading
Loading
Loading
@@ -4,8 +4,8 @@ module Gitlab
module Ci
module Build
class Port
DEFAULT_PORT_NAME = 'default_port'.freeze
DEFAULT_PORT_PROTOCOL = 'http'.freeze
DEFAULT_PORT_NAME = 'default_port'
DEFAULT_PORT_PROTOCOL = 'http'
 
attr_reader :number, :protocol, :name
 
Loading
Loading
Loading
Loading
@@ -4,9 +4,9 @@ module Gitlab
module Ci
module Build
class Step
WHEN_ON_FAILURE = 'on_failure'.freeze
WHEN_ON_SUCCESS = 'on_success'.freeze
WHEN_ALWAYS = 'always'.freeze
WHEN_ON_FAILURE = 'on_failure'
WHEN_ON_SUCCESS = 'on_success'
WHEN_ALWAYS = 'always'
 
attr_reader :name
attr_accessor :script, :timeout, :when, :allow_failure
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Attributable
 
ALLOWED_KEYS = %i[key untracked paths policy].freeze
DEFAULT_POLICY = 'pull-push'.freeze
DEFAULT_POLICY = 'pull-push'
 
validations do
validates :config, allowed_keys: ALLOWED_KEYS
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ module Gitlab
class Template < Base
attr_reader :location, :project
 
SUFFIX = '.gitlab-ci.yml'.freeze
SUFFIX = '.gitlab-ci.yml'
 
def initialize(params, context)
@location = params[:template]
Loading
Loading
Loading
Loading
@@ -3,8 +3,8 @@
module Gitlab
module Ci
class CronParser
VALID_SYNTAX_SAMPLE_TIME_ZONE = 'UTC'.freeze
VALID_SYNTAX_SAMPLE_CRON = '* * * * *'.freeze
VALID_SYNTAX_SAMPLE_TIME_ZONE = 'UTC'
VALID_SYNTAX_SAMPLE_CRON = '* * * * *'
 
def initialize(cron, cron_timezone = 'UTC')
@cron = cron
Loading
Loading
Loading
Loading
@@ -4,10 +4,10 @@ module Gitlab
module Ci
module Reports
class TestCase
STATUS_SUCCESS = 'success'.freeze
STATUS_FAILED = 'failed'.freeze
STATUS_SKIPPED = 'skipped'.freeze
STATUS_ERROR = 'error'.freeze
STATUS_SUCCESS = 'success'
STATUS_FAILED = 'failed'
STATUS_SKIPPED = 'skipped'
STATUS_ERROR = 'error'
STATUS_TYPES = [STATUS_SUCCESS, STATUS_FAILED, STATUS_SKIPPED, STATUS_ERROR].freeze
 
attr_reader :name, :classname, :execution_time, :status, :file, :system_output, :stack_trace, :key
Loading
Loading
Loading
Loading
@@ -5,9 +5,9 @@ module Gitlab
class ProjectUploadFileFinder
FIND_BATCH_SIZE = 500
ABSOLUTE_UPLOAD_DIR = FileUploader.root.freeze
EXCLUDED_SYSTEM_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/-/*".freeze
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*".freeze
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*".freeze
EXCLUDED_SYSTEM_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/-/*"
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*"
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*"
 
# Paths are relative to the upload directory
def each_file_batch(batch_size: FIND_BATCH_SIZE, &block)
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module Gitlab
# using them as if they were stored as string values. This gives you the
# ease of use of string values, but without the storage overhead.
class ShaAttribute < BINARY_TYPE
PACK_FORMAT = 'H*'.freeze
PACK_FORMAT = 'H*'
 
# Casts binary data to a SHA1 in hexadecimal.
def deserialize(value)
Loading
Loading
Loading
Loading
@@ -5,8 +5,8 @@ module Gitlab
class Message
attr_reader :path, :offline
 
OFFLINE = "\e[31moffline\e[0m".freeze
ONLINE = "\e[32monline\e[0m".freeze
OFFLINE = "\e[31moffline\e[0m"
ONLINE = "\e[32monline\e[0m"
 
# path - The file path of the migration.
# offline - When set to `true` the migration will require downtime.
Loading
Loading
# coding: utf-8
# frozen_string_literal: true
 
# rubocop: disable Rails/Output
module Gitlab
# Checks if a set of migrations requires downtime or not.
class EeCompatCheck
CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze
CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'.freeze
CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'
CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'
CHECK_DIR = Rails.root.join('ee_compat_check')
IGNORED_FILES_REGEX = /VERSION|CHANGELOG\.md|doc\/.+/i.freeze
PLEASE_READ_THIS_BANNER = %Q{
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ module Gitlab
module EtagCaching
class Store
EXPIRY_TIME = 20.minutes
SHARED_STATE_NAMESPACE = 'etag:'.freeze
SHARED_STATE_NAMESPACE = 'etag:'
 
def get(key)
Gitlab::Redis::SharedState.with { |redis| redis.get(redis_shared_state_key(key)) }
Loading
Loading
Loading
Loading
@@ -7,11 +7,11 @@ module Gitlab
# The ID of empty tree.
# See http://stackoverflow.com/a/40884093/1856239 and
# https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012
EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze
EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
BLANK_SHA = ('0' * 40).freeze
COMMIT_ID = /\A[0-9a-f]{40}\z/.freeze
TAG_REF_PREFIX = "refs/tags/".freeze
BRANCH_REF_PREFIX = "refs/heads/".freeze
TAG_REF_PREFIX = "refs/tags/"
BRANCH_REF_PREFIX = "refs/heads/"
 
BaseError = Class.new(StandardError)
CommandError = Class.new(BaseError)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment