Commit c858f70d authored by gfyoung's avatar gfyoung Committed by Rémy Coutable

Enable frozen string for lib/gitlab/*.rb

parent 173b1436
---
title: Enable frozen string for lib/gitlab/*.rb
merge_request:
author: gfyoung
type: performance
...@@ -164,7 +164,7 @@ module Backup ...@@ -164,7 +164,7 @@ module Backup
def tar_version def tar_version
tar_version, _ = Gitlab::Popen.popen(%w(tar --version)) tar_version, _ = Gitlab::Popen.popen(%w(tar --version))
tar_version.force_encoding('locale').split("\n").first tar_version.dup.force_encoding('locale').split("\n").first
end end
def skipped?(item) def skipped?(item)
......
# frozen_string_literal: true
# Gitlab::Access module # Gitlab::Access module
# #
# Define allowed roles that can be used # Define allowed roles that can be used
......
# frozen_string_literal: true
module Gitlab module Gitlab
# This class implements a simple rate limiter that can be used to throttle # This class implements a simple rate limiter that can be used to throttle
# certain actions. Unlike Rack Attack and Rack::Throttle, which operate at # certain actions. Unlike Rack Attack and Rack::Throttle, which operate at
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Allowable module Allowable
def can?(*args) def can?(*args)
......
# frozen_string_literal: true
module Gitlab module Gitlab
class AppLogger < Gitlab::Logger class AppLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
require 'asciidoctor' require 'asciidoctor'
require 'asciidoctor/converter/html5' require 'asciidoctor/converter/html5'
require "asciidoctor-plantuml" require "asciidoctor-plantuml"
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
MissingPersonalAccessTokenError = Class.new(StandardError) MissingPersonalAccessTokenError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BackgroundMigration module BackgroundMigration
def self.queue def self.queue
......
# frozen_string_literal: true
# This is a base controller for doorkeeper. # This is a base controller for doorkeeper.
# It adds the `can?` helper used in the views. # It adds the `can?` helper used in the views.
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Blame class Blame
attr_accessor :blob, :commit attr_accessor :blob, :commit
......
# frozen_string_literal: true
# This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb # This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb
module Gitlab module Gitlab
module BlobHelper module BlobHelper
......
# frozen_string_literal: true
module Gitlab module Gitlab
class BuildAccess < UserAccess class BuildAccess < UserAccess
attr_accessor :user, :project attr_accessor :user, :project
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ChangesList class ChangesList
include Enumerable include Enumerable
......
# frozen_string_literal: true
require 'json' require 'json'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
# For backwards compatibility, generic CI (which is a build without a user) is # For backwards compatibility, generic CI (which is a build without a user) is
# allowed to :build_download_code without any other checks. # allowed to :build_download_code without any other checks.
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ClosingIssueExtractor class ClosingIssueExtractor
ISSUE_CLOSING_REGEX = begin ISSUE_CLOSING_REGEX = begin
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Module containing GitLab's syntax color scheme definitions and helper # Module containing GitLab's syntax color scheme definitions and helper
# methods for accessing them. # methods for accessing them.
......
# frozen_string_literal: true
module Gitlab::ConfigHelper module Gitlab::ConfigHelper
def gitlab_config_features def gitlab_config_features
Gitlab.config.gitlab.default_projects_features Gitlab.config.gitlab.default_projects_features
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ContributionsCalendar class ContributionsCalendar
attr_reader :contributor attr_reader :contributor
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Contributor class Contributor
attr_accessor :email, :name, :commits, :additions, :deletions attr_accessor :email, :name, :commits, :additions, :deletions
......
# frozen_string_literal: true
module Gitlab module Gitlab
class CrossProjectAccess class CrossProjectAccess
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module CurrentSettings module CurrentSettings
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Daemon class Daemon
def self.initialize_instance(*args) def self.initialize_instance(*args)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Database module Database
# The max value of INTEGER type is the same between MySQL and PostgreSQL: # The max value of INTEGER type is the same between MySQL and PostgreSQL:
...@@ -99,11 +101,11 @@ module Gitlab ...@@ -99,11 +101,11 @@ module Gitlab
order = "#{field} #{direction}" order = "#{field} #{direction}"
if postgresql? if postgresql?
order << ' NULLS LAST' order = "#{order} NULLS LAST"
else else
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL # `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# columns. In the (default) ascending order, `0` comes first. # columns. In the (default) ascending order, `0` comes first.
order.prepend("#{field} IS NULL, ") if direction == 'ASC' order = "#{field} IS NULL, #{order}" if direction == 'ASC'
end end
order order
...@@ -113,11 +115,11 @@ module Gitlab ...@@ -113,11 +115,11 @@ module Gitlab
order = "#{field} #{direction}" order = "#{field} #{direction}"
if postgresql? if postgresql?
order << ' NULLS FIRST' order = "#{order} NULLS FIRST"
else else
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL # `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# columns. In the (default) ascending order, `0` comes first. # columns. In the (default) ascending order, `0` comes first.
order.prepend("#{field} IS NULL, ") if direction == 'DESC' order = "#{field} IS NULL, #{order}" if direction == 'DESC'
end end
order order
...@@ -184,7 +186,7 @@ module Gitlab ...@@ -184,7 +186,7 @@ module Gitlab
EOF EOF
if return_ids if return_ids
sql << 'RETURNING id' sql = "#{sql}RETURNING id"
end end
result = connection.execute(sql) result = connection.execute(sql)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module DependencyLinker module DependencyLinker
LINKERS = [ LINKERS = [
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Checks if a set of migrations requires downtime or not. # Checks if a set of migrations requires downtime or not.
class DowntimeCheck class DowntimeCheck
......
# frozen_string_literal: true
# rubocop: disable Rails/Output # rubocop: disable Rails/Output
module Gitlab module Gitlab
# Checks if a set of migrations requires downtime or not. # Checks if a set of migrations requires downtime or not.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Emoji module Emoji
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module EncodingHelper module EncodingHelper
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Environment module Environment
def self.hostname def self.hostname
......
# frozen_string_literal: true
module Gitlab module Gitlab
class EnvironmentLogger < Gitlab::Logger class EnvironmentLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
require 'securerandom' require 'securerandom'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
# This module provides helper methods which are intregrated with GitLab::ExclusiveLease # This module provides helper methods which are intregrated with GitLab::ExclusiveLease
module ExclusiveLeaseHelpers module ExclusiveLeaseHelpers
......
# frozen_string_literal: true
# This class extends an OpenStruct object by adding predicate methods to mimic # This class extends an OpenStruct object by adding predicate methods to mimic
# ActiveRecord access. We rely on the initial values being true or false to # ActiveRecord access. We rely on the initial values being true or false to
# determine whether to define a predicate method because for a newly-added # determine whether to define a predicate method because for a newly-added
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Favicon class Favicon
class << self class << self
......
# frozen_string_literal: true
require 'set' require 'set'
module Gitlab module Gitlab
......
# frozen_string_literal: true
# This class finds files in a repository by name and content # This class finds files in a repository by name and content
# the result is joined and sorted by file name # the result is joined and sorted by file name
module Gitlab module Gitlab
......
# frozen_string_literal: true
# Builds the markdown link of a file # Builds the markdown link of a file
# It needs the methods filename and secure_url (final destination url) to be defined. # It needs the methods filename and secure_url (final destination url) to be defined.
module Gitlab module Gitlab
...@@ -8,7 +10,7 @@ module Gitlab ...@@ -8,7 +10,7 @@ module Gitlab
return unless name = markdown_name return unless name = markdown_name
markdown = "[#{name.gsub(']', '\\]')}](#{secure_url})" markdown = "[#{name.gsub(']', '\\]')}](#{secure_url})"
markdown.prepend("!") if image_or_video? || dangerous? markdown = "!#{markdown}" if image_or_video? || dangerous?
markdown markdown
end end
......
# frozen_string_literal: true
require_dependency 'gitlab/encoding_helper' require_dependency 'gitlab/encoding_helper'
module Gitlab module Gitlab
......
# frozen_string_literal: true
# Check a user's access to perform a git action. All public methods in this # Check a user's access to perform a git action. All public methods in this
# class return an instance of `GitlabAccessStatus` # class return an instance of `GitlabAccessStatus`
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
class GitAccessWiki < GitAccess class GitAccessWiki < GitAccess
ERROR_MESSAGES = { ERROR_MESSAGES = {
......
# frozen_string_literal: true
module Gitlab module Gitlab
class GitLogger < Gitlab::Logger class GitLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
# Gitaly note: JV: does not need to be migrated, works without a repo. # Gitaly note: JV: does not need to be migrated, works without a repo.
module Gitlab module Gitlab
......
# frozen_string_literal: true
require 'base64' require 'base64'
require 'gitaly' require 'gitaly'
...@@ -23,7 +25,7 @@ module Gitlab ...@@ -23,7 +25,7 @@ module Gitlab
stacks = most_invoked_stack.join('\n') if most_invoked_stack stacks = most_invoked_stack.join('\n') if most_invoked_stack
msg = "GitalyClient##{call_site} called #{invocation_count} times from single request. Potential n+1?" msg = "GitalyClient##{call_site} called #{invocation_count} times from single request. Potential n+1?"
msg << "\nThe following call site called into Gitaly #{max_call_stack} times:\n#{stacks}\n" if stacks msg = "#{msg}\nThe following call site called into Gitaly #{max_call_stack} times:\n#{stacks}\n" if stacks
super(msg) super(msg)
end end
......
# frozen_string_literal: true
module Gitlab module Gitlab
module GithubImport module GithubImport
def self.refmap def self.refmap
......
# frozen_string_literal: true
module Gitlab module Gitlab
module GlId module GlId
def self.gl_id(user) def self.gl_id(user)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module GlRepository module GlRepository
def self.gl_repository(project, is_wiki) def self.gl_repository(project, is_wiki)
......
# frozen_string_literal: true
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Gpg module Gpg
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Graphql module Graphql
StandardGraphqlError = Class.new(StandardError) StandardGraphqlError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Retrieving of parent or child groups based on a base ActiveRecord relation. # Retrieving of parent or child groups based on a base ActiveRecord relation.
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Highlight class Highlight
TIMEOUT_BACKGROUND = 30.seconds TIMEOUT_BACKGROUND = 30.seconds
......
# frozen_string_literal: true
# This class is used as a proxy for all outbounding http connection # This class is used as a proxy for all outbounding http connection
# coming from callbacks, services and hooks. The direct use of the HTTParty # coming from callbacks, services and hooks. The direct use of the HTTParty
# is discouraged because it can lead to several security problems, like SSRF # is discouraged because it can lead to several security problems, like SSRF
......
# frozen_string_literal: true
## ##
# This class is compatible with IO class (https://ruby-doc.org/core-2.3.1/IO.html) # This class is compatible with IO class (https://ruby-doc.org/core-2.3.1/IO.html)
# source: https://gitlab.com/snippets/1685610 # source: https://gitlab.com/snippets/1685610
...@@ -73,8 +75,8 @@ module Gitlab ...@@ -73,8 +75,8 @@ module Gitlab
end end
end end
def read(length = nil, outbuf = "") def read(length = nil, outbuf = nil)
out = "" out = []
length ||= size - tell length ||= size - tell
...@@ -90,17 +92,18 @@ module Gitlab ...@@ -90,17 +92,18 @@ module Gitlab
length -= chunk_data.bytesize length -= chunk_data.bytesize
end end
out = out.join
# If outbuf is passed, we put the output into the buffer. This supports IO.copy_stream functionality # If outbuf is passed, we put the output into the buffer. This supports IO.copy_stream functionality
if outbuf if outbuf
outbuf.slice!(0, outbuf.bytesize) outbuf.replace(out)
outbuf << out
end end
out out
end end
def readline def readline
out = "" out = []
until eof? until eof?
data = get_chunk data = get_chunk
...@@ -116,7 +119,7 @@ module Gitlab ...@@ -116,7 +119,7 @@ module Gitlab
end end
end end
out out.join
end end
def write(data) def write(data)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module I18n module I18n
extend self extend self
......
# frozen_string_literal: true
# Detect user based on identifier like # Detect user based on identifier like
# key-13 or user-36 or last commit # key-13 or user-36 or last commit
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ImportFormatter class ImportFormatter
def comment(author, date, body) def comment(author, date, body)
......
# frozen_string_literal: true
# Gitlab::ImportSources module # Gitlab::ImportSources module
# #
# Define import sources that can be used # Define import sources that can be used
......
# frozen_string_literal: true
module Gitlab module Gitlab
module IncomingEmail module IncomingEmail
UNSUBSCRIBE_SUFFIX = '+unsubscribe'.freeze UNSUBSCRIBE_SUFFIX = '+unsubscribe'.freeze
......
# frozen_string_literal: true
module Gitlab module Gitlab
# #
# Calculates the fingerprint of a given key without using # Calculates the fingerprint of a given key without using
......
# frozen_string_literal: true
module Gitlab module Gitlab
module IssuableMetadata module IssuableMetadata
def issuable_meta_data(issuable_collection, collection_type) def issuable_meta_data(issuable_collection, collection_type)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module IssuableSorter module IssuableSorter
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Class for counting and caching the number of issuables per state. # Class for counting and caching the number of issuables per state.
class IssuablesCountForState class IssuablesCountForState
......
# frozen_string_literal: true
module Gitlab module Gitlab
class IssuesLabels class IssuesLabels
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
# JobWaiter can be used to wait for a number of Sidekiq jobs to complete. # JobWaiter can be used to wait for a number of Sidekiq jobs to complete.
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
class JsonLogger < ::Gitlab::Logger class JsonLogger < ::Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Helper methods to do with Kubernetes network services & resources # Helper methods to do with Kubernetes network services & resources
module Kubernetes module Kubernetes
......
# frozen_string_literal: true
module Gitlab module Gitlab
class LanguageDetection class LanguageDetection
MAX_LANGUAGES = 5 MAX_LANGUAGES = 5
......
# frozen_string_literal: true
module Gitlab module Gitlab
# A class that can be wrapped around an expensive method call so it's only # A class that can be wrapped around an expensive method call so it's only
# executed when actually needed. # executed when actually needed.
......
# frozen_string_literal: true
module Gitlab module Gitlab
class LfsToken class LfsToken
attr_accessor :actor attr_accessor :actor
......
# frozen_string_literal: true
module Gitlab module Gitlab
class Logger < ::Logger class Logger < ::Logger
def self.file_name def self.file_name
......
# frozen_string_literal: true
require 'yaml' require 'yaml'
require 'json' require 'json'
require_relative 'redis/queues' unless defined?(Gitlab::Redis::Queues) require_relative 'redis/queues' unless defined?(Gitlab::Redis::Queues)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module MarkupHelper module MarkupHelper
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
include Gitlab::Metrics::InfluxDb include Gitlab::Metrics::InfluxDb
......
# frozen_string_literal: true
module Gitlab module Gitlab
class MultiCollectionPaginator class MultiCollectionPaginator
attr_reader :first_collection, :second_collection, :per_page attr_reader :first_collection, :second_collection, :per_page
......
# frozen_string_literal: true
module Gitlab module Gitlab
class OmniauthInitializer class OmniauthInitializer
def initialize(devise_config) def initialize(devise_config)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module OptimisticLocking module OptimisticLocking
module_function module_function
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Parser/renderer for markups without other special support code. # Parser/renderer for markups without other special support code.
module OtherMarkup module OtherMarkup
......
# frozen_string_literal: true
module Gitlab module Gitlab
# The +otp_key_base+ param is used to encrypt the User#otp_secret attribute. # The +otp_key_base+ param is used to encrypt the User#otp_secret attribute.
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Pages module Pages
VERSION = File.read(Rails.root.join("GITLAB_PAGES_VERSION")).strip.freeze VERSION = File.read(Rails.root.join("GITLAB_PAGES_VERSION")).strip.freeze
......
# frozen_string_literal: true
module Gitlab module Gitlab
class PagesClient class PagesClient
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
class PagesTransfer < ProjectTransfer class PagesTransfer < ProjectTransfer
def root_dir def root_dir
......
# frozen_string_literal: true
module Gitlab module Gitlab
module PathRegex module PathRegex
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module PerformanceBar module PerformanceBar
ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Plugin module Plugin
def self.files def self.files
......
# frozen_string_literal: true
module Gitlab module Gitlab
class PluginLogger < Gitlab::Logger class PluginLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
module Gitlab module Gitlab
class PollingInterval class PollingInterval
HEADER_NAME = 'Poll-Interval'.freeze HEADER_NAME = 'Poll-Interval'.freeze
......
# frozen_string_literal: true
require 'fileutils' require 'fileutils'
require 'open3' require 'open3'
...@@ -11,7 +13,7 @@ module Gitlab ...@@ -11,7 +13,7 @@ module Gitlab
def popen(cmd, path = nil, vars = {}, &block) def popen(cmd, path = nil, vars = {}, &block)
result = popen_with_detail(cmd, path, vars, &block) result = popen_with_detail(cmd, path, vars, &block)
[result.stdout << result.stderr, result.status&.exitstatus] ["#{result.stdout}#{result.stderr}", result.status&.exitstatus]
end end
# Returns Result # Returns Result
......
# coding: utf-8 # coding: utf-8
# frozen_string_literal: true
module Gitlab module Gitlab
module Profiler module Profiler
FILTERED_STRING = '[FILTERED]'.freeze FILTERED_STRING = '[FILTERED]'.freeze
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ProjectSearchResults < SearchResults class ProjectSearchResults < SearchResults
attr_reader :project, :repository_ref attr_reader :project, :repository_ref
...@@ -57,7 +59,8 @@ module Gitlab ...@@ -57,7 +59,8 @@ module Gitlab
ref = nil ref = nil
filename = nil filename = nil
basename = nil basename = nil
data = ""
data = []
startline = 0 startline = 0
result.each_line.each_with_index do |line, index| result.each_line.each_with_index do |line, index|
...@@ -78,7 +81,7 @@ module Gitlab ...@@ -78,7 +81,7 @@ module Gitlab
basename: basename, basename: basename,
ref: ref, ref: ref,
startline: startline, startline: startline,
data: data, data: data.join,
project_id: project ? project.id : nil project_id: project ? project.id : nil
) )
end end
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ProjectServiceLogger < Gitlab::JsonLogger class ProjectServiceLogger < Gitlab::JsonLogger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ProjectTemplate class ProjectTemplate
attr_reader :title, :name, :description, :preview attr_reader :title, :name, :description, :preview
......
# frozen_string_literal: true
module Gitlab module Gitlab
# This class is used to move local, unhashed files owned by projects to their new location # This class is used to move local, unhashed files owned by projects to their new location
class ProjectTransfer class ProjectTransfer
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Helper methods to interact with Prometheus network services & resources # Helper methods to interact with Prometheus network services & resources
class PrometheusClient class PrometheusClient
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ProtocolAccess module ProtocolAccess
def self.allowed?(protocol) def self.allowed?(protocol)
......
# frozen_string_literal: true
# This class is part of the Gitlab::HTTP wrapper. Depending on the value # This class is part of the Gitlab::HTTP wrapper. Depending on the value
# of the global setting allow_local_requests_from_hooks_and_services this adapter # of the global setting allow_local_requests_from_hooks_and_services this adapter
# will allow/block connection to internal IPs and/or urls. # will allow/block connection to internal IPs and/or urls.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module QueryLimiting module QueryLimiting
# Returns true if we should enable tracking of query counts. # Returns true if we should enable tracking of query counts.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Recaptcha module Recaptcha
def self.load_configurations! def self.load_configurations!
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ReferenceCounter class ReferenceCounter
REFERENCE_EXPIRE_TIME = 600 REFERENCE_EXPIRE_TIME = 600
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Extract possible GFM references from an arbitrary String for further processing. # Extract possible GFM references from an arbitrary String for further processing.
class ReferenceExtractor < Banzai::ReferenceExtractor class ReferenceExtractor < Banzai::ReferenceExtractor
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Regex module Regex
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module RepoPath module RepoPath
NotFoundError = Class.new(StandardError) NotFoundError = Class.new(StandardError)
......
# frozen_string_literal: true
# Interface to the Redis-backed cache store # Interface to the Redis-backed cache store
module Gitlab module Gitlab
class RepositoryCache class RepositoryCache
...@@ -6,7 +8,7 @@ module Gitlab ...@@ -6,7 +8,7 @@ module Gitlab
def initialize(repository, extra_namespace: nil, backend: Rails.cache) def initialize(repository, extra_namespace: nil, backend: Rails.cache)
@repository = repository @repository = repository
@namespace = "#{repository.full_path}:#{repository.project.id}" @namespace = "#{repository.full_path}:#{repository.project.id}"
@namespace += ":#{extra_namespace}" if extra_namespace @namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace
@backend = backend @backend = backend
end end
......
# frozen_string_literal: true
module Gitlab module Gitlab
module RepositoryCacheAdapter module RepositoryCacheAdapter
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Gitlab module Gitlab
class RepositoryCheckLogger < Gitlab::Logger class RepositoryCheckLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
module Gitlab module Gitlab
class RequestContext class RequestContext
class << self class << self
......
# frozen_string_literal: true
# A module to check CSRF tokens in requests. # A module to check CSRF tokens in requests.
# It's used in API helpers and OmniAuth. # It's used in API helpers and OmniAuth.
# Usage: GitLab::RequestForgeryProtection.call(env) # Usage: GitLab::RequestForgeryProtection.call(env)
......
# frozen_string_literal: true
require 'fileutils' require 'fileutils'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
class RouteMap class RouteMap
FormatError = Class.new(StandardError) FormatError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Routing module Routing
extend ActiveSupport::Concern extend ActiveSupport::Concern
...@@ -47,7 +49,7 @@ module Gitlab ...@@ -47,7 +49,7 @@ module Gitlab
# #
# `request.fullpath` includes the querystring # `request.fullpath` includes the querystring
new_path = request.path.sub(%r{/#{path}(/*)(?!.*#{path})}, "/-/#{path}\\1") new_path = request.path.sub(%r{/#{path}(/*)(?!.*#{path})}, "/-/#{path}\\1")
new_path << "?#{request.query_string}" if request.query_string.present? new_path = "#{new_path}?#{request.query_string}" if request.query_string.present?
new_path new_path
end end
......
# frozen_string_literal: true
module Gitlab module Gitlab
class SearchResults class SearchResults
class FoundBlob class FoundBlob
......
# frozen_string_literal: true
# :nocov: # :nocov:
module DeliverNever module DeliverNever
def deliver_later def deliver_later
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Sentry module Sentry
def self.enabled? def self.enabled?
......
# frozen_string_literal: true
require 'toml-rb' require 'toml-rb'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
class ShardHealthCache class ShardHealthCache
HEALTHY_SHARDS_KEY = 'gitlab-healthy-shards'.freeze HEALTHY_SHARDS_KEY = 'gitlab-healthy-shards'.freeze
......
# frozen_string_literal: true
# Gitaly note: SSH key operations are not part of Gitaly so will never be migrated. # Gitaly note: SSH key operations are not part of Gitaly so will never be migrated.
require 'securerandom' require 'securerandom'
......
# frozen_string_literal: true
# == GitLab Shell mixin # == GitLab Shell mixin
# #
# Provide a shortcut to Gitlab::Shell instance by gitlab_shell # Provide a shortcut to Gitlab::Shell instance by gitlab_shell
......
# frozen_string_literal: true
require 'securerandom' require 'securerandom'
module Gitlab module Gitlab
......
# frozen_string_literal: true
require 'yaml' require 'yaml'
require 'set' require 'set'
......
# frozen_string_literal: true
module Gitlab module Gitlab
class SidekiqLogger < Gitlab::Logger class SidekiqLogger < Gitlab::Logger
def self.file_name_noext def self.file_name_noext
......
# frozen_string_literal: true
module Gitlab module Gitlab
# The SidekiqStatus module and its child classes can be used for checking if a # The SidekiqStatus module and its child classes can be used for checking if a
# Sidekiq job has been processed or not. # Sidekiq job has been processed or not.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module SidekiqVersioning module SidekiqVersioning
def self.install! def self.install!
......
# frozen_string_literal: true
module Gitlab module Gitlab
class SnippetSearchResults < SearchResults class SnippetSearchResults < SearchResults
include SnippetsHelper include SnippetsHelper
......
# frozen_string_literal: true
module Gitlab module Gitlab
class SSHPublicKey class SSHPublicKey
Technology = Struct.new(:name, :key_class, :supported_sizes) Technology = Struct.new(:name, :key_class, :supported_sizes)
...@@ -26,7 +28,7 @@ module Gitlab ...@@ -26,7 +28,7 @@ module Gitlab
return key_content if parts.empty? return key_content if parts.empty?
parts.each_with_object("#{ssh_type} ").with_index do |(part, content), index| parts.each_with_object(+"#{ssh_type} ").with_index do |(part, content), index|
content << part content << part
if Gitlab::SSHPublicKey.new(content).valid? if Gitlab::SSHPublicKey.new(content).valid?
......
# frozen_string_literal: true
module Gitlab module Gitlab
class StringPlaceholderReplacer class StringPlaceholderReplacer
# This method accepts the following paras # This method accepts the following paras
......
# frozen_string_literal: true
module Gitlab module Gitlab
class StringRangeMarker class StringRangeMarker
attr_accessor :raw_line, :rich_line, :html_escaped attr_accessor :raw_line, :rich_line, :html_escaped
......
# frozen_string_literal: true
module Gitlab module Gitlab
class StringRegexMarker < StringRangeMarker class StringRegexMarker < StringRangeMarker
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
# frozen_string_literal: true
require 'rainbow/ext/string' require 'rainbow/ext/string'
require 'gitlab/utils/strong_memoize' require 'gitlab/utils/strong_memoize'
...@@ -39,7 +41,7 @@ module Gitlab ...@@ -39,7 +41,7 @@ module Gitlab
File.read('/etc/os-release').match(/PRETTY_NAME=\"(.+)\"/)[1] File.read('/etc/os-release').match(/PRETTY_NAME=\"(.+)\"/)[1]
end end
os_name.try(:squish!) os_name.try(:squish)
end end
# Prompt the user to input something # Prompt the user to input something
......
# frozen_string_literal: true
module Gitlab module Gitlab
class TcpChecker class TcpChecker
attr_reader :remote_host, :remote_port, :local_host, :local_port, :error attr_reader :remote_host, :remote_port, :local_host, :local_port, :error
......
# frozen_string_literal: true
module Gitlab module Gitlab
module TemplateHelper module TemplateHelper
def prepare_template_environment(file) def prepare_template_environment(file)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module TemporarilyAllow module TemporarilyAllow
TEMPORARILY_ALLOW_MUTEX = Mutex.new TEMPORARILY_ALLOW_MUTEX = Mutex.new
......
# frozen_string_literal: true
module Gitlab module Gitlab
# Module containing GitLab's application theme definitions and helper methods # Module containing GitLab's application theme definitions and helper methods
# for accessing them. # for accessing them.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module TimeTrackingFormatter module TimeTrackingFormatter
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Timeless module Timeless
def self.timeless(model, &block) def self.timeless(model, &block)
......
# frozen_string_literal: true
module Gitlab module Gitlab
class TreeSummary class TreeSummary
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module Gitlab module Gitlab
# An untrusted regular expression is any regexp containing patterns sourced # An untrusted regular expression is any regexp containing patterns sourced
# from user input. # from user input.
......
# frozen_string_literal: true
module Gitlab module Gitlab
UpdatePathError = Class.new(StandardError) UpdatePathError = Class.new(StandardError)
end end
# frozen_string_literal: true
module Gitlab module Gitlab
class Upgrader class Upgrader
def execute def execute
......
# frozen_string_literal: true
module Gitlab module Gitlab
class UploadsTransfer < ProjectTransfer class UploadsTransfer < ProjectTransfer
def root_dir def root_dir
......
# frozen_string_literal: true
require 'resolv' require 'resolv'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
class UrlBuilder class UrlBuilder
include Gitlab::Routing include Gitlab::Routing
......
# frozen_string_literal: true
module Gitlab module Gitlab
class UrlSanitizer class UrlSanitizer
ALLOWED_SCHEMES = %w[http https ssh git].freeze ALLOWED_SCHEMES = %w[http https ssh git].freeze
......
# frozen_string_literal: true
module Gitlab module Gitlab
class UsageData class UsageData
class << self class << self
......
# frozen_string_literal: true
module Gitlab module Gitlab
class UserAccess class UserAccess
extend Gitlab::Cache::RequestCache extend Gitlab::Cache::RequestCache
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Utils module Utils
extend self extend self
......
# frozen_string_literal: true
module Gitlab module Gitlab
class VersionInfo class VersionInfo
include Comparable include Comparable
......
# frozen_string_literal: true
# Gitlab::VisibilityLevel module # Gitlab::VisibilityLevel module
# #
# Define allowed public modes that can be used for # Define allowed public modes that can be used for
......
# frozen_string_literal: true
module Gitlab module Gitlab
class WikiFileFinder < FileFinder class WikiFileFinder < FileFinder
attr_reader :repository attr_reader :repository
......
# frozen_string_literal: true
require 'base64' require 'base64'
require 'json' require 'json'
require 'securerandom' require 'securerandom'
...@@ -63,7 +65,7 @@ module Gitlab ...@@ -63,7 +65,7 @@ module Gitlab
def send_git_archive(repository, ref:, format:, append_sha:) def send_git_archive(repository, ref:, format:, append_sha:)
format ||= 'tar.gz' format ||= 'tar.gz'
format.downcase! format = format.downcase
params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha: append_sha) params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha: append_sha)
raise "Repository or ref not found" if params.empty? raise "Repository or ref not found" if params.empty?
......
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