Commit 7ec8af50 authored by gfyoung's avatar gfyoung

Enable even more frozen string for lib/gitlab

Enables frozen string for the following:

* lib/gitlab/hook_data/**/*.rb
* lib/gitlab/i18n/**/*.rb
* lib/gitlab/import/**/*.rb
* lib/gitlab/import_export/**/*.rb
* lib/gitlab/kubernetes/**/*.rb
* lib/gitlab/legacy_github_import/**/*.rb
* lib/gitlab/manifest_import/**/*.rb
* lib/gitlab/metrics/**/*.rb
* lib/gitlab/middleware/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
parent 29d8179b
---
title: Enable even more frozen string for lib/gitlab
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class BaseBuilder class BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class IssuableBuilder < BaseBuilder class IssuableBuilder < BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class IssueBuilder < BaseBuilder class IssueBuilder < BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class MergeRequestBuilder < BaseBuilder class MergeRequestBuilder < BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class NoteBuilder < BaseBuilder class NoteBuilder < BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module HookData module HookData
class WikiPageBuilder < BaseBuilder class WikiPageBuilder < BaseBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module I18n module I18n
class MetadataEntry class MetadataEntry
......
# frozen_string_literal: true
module Gitlab module Gitlab
module I18n module I18n
class PoLinter class PoLinter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module I18n module I18n
class TranslationEntry class TranslationEntry
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Import module Import
class Logger < ::Gitlab::JsonLogger class Logger < ::Gitlab::JsonLogger
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
module AfterExportStrategies module AfterExportStrategies
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
module AfterExportStrategies module AfterExportStrategies
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
module AfterExportStrategies module AfterExportStrategies
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class AfterExportStrategyBuilder class AfterExportStrategyBuilder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class AttributeCleaner class AttributeCleaner
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class AttributesFinder class AttributesFinder
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class AvatarRestorer class AvatarRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class AvatarSaver class AvatarSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
module CommandLineUtil module CommandLineUtil
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
Error = Class.new(StandardError) Error = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class FileImporter class FileImporter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
# Given a class, it finds or creates a new object # Given a class, it finds or creates a new object
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class HashUtil class HashUtil
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class Importer class Importer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
# Generates a hash that conforms with http://apidock.com/rails/Hash/to_json # Generates a hash that conforms with http://apidock.com/rails/Hash/to_json
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class LfsRestorer class LfsRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class LfsSaver class LfsSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class MembersMapper class MembersMapper
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class MergeRequestParser class MergeRequestParser
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class ProjectTreeRestorer class ProjectTreeRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class ProjectTreeSaver class ProjectTreeSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class Reader class Reader
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class RelationFactory class RelationFactory
...@@ -211,7 +213,7 @@ module Gitlab ...@@ -211,7 +213,7 @@ module Gitlab
def update_note_for_missing_author(author_name) def update_note_for_missing_author(author_name)
@relation_hash['note'] = '*Blank note*' if @relation_hash['note'].blank? @relation_hash['note'] = '*Blank note*' if @relation_hash['note'].blank?
@relation_hash['note'] += missing_author_note(@relation_hash['updated_at'], author_name) @relation_hash['note'] = "#{@relation_hash['note']}#{missing_author_note(@relation_hash['updated_at'], author_name)}"
end end
def admin_user? def admin_user?
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class RepoRestorer class RepoRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class RepoSaver class RepoSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class Saver class Saver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class Shared class Shared
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class StatisticsRestorer class StatisticsRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class UploadsManager class UploadsManager
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class UploadsRestorer < UploadsSaver class UploadsRestorer < UploadsSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class UploadsSaver class UploadsSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class VersionChecker class VersionChecker
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class VersionSaver class VersionSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class WikiRepoSaver < RepoSaver class WikiRepoSaver < RepoSaver
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ImportExport module ImportExport
class WikiRestorer < RepoRestorer class WikiRestorer < RepoRestorer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
class ConfigMap class ConfigMap
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
class Namespace class Namespace
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Pod module Pod
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class BaseFormatter class BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class BranchFormatter < BaseFormatter class BranchFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class Client class Client
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class CommentFormatter < BaseFormatter class CommentFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class Importer class Importer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class IssuableFormatter < BaseFormatter class IssuableFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class IssueFormatter < IssuableFormatter class IssueFormatter < IssuableFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class LabelFormatter < BaseFormatter class LabelFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class MilestoneFormatter < BaseFormatter class MilestoneFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class ProjectCreator class ProjectCreator
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class PullRequestFormatter < IssuableFormatter class PullRequestFormatter < IssuableFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class ReleaseFormatter < BaseFormatter class ReleaseFormatter < BaseFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class UserFormatter class UserFormatter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module LegacyGithubImport module LegacyGithubImport
class WikiFormatter class WikiFormatter
......
# frozen_string_literal: true
# Class to parse manifest file and build a list of repositories for import # Class to parse manifest file and build a list of repositories for import
# #
# <manifest> # <manifest>
......
# frozen_string_literal: true
module Gitlab module Gitlab
module ManifestImport module ManifestImport
class ProjectCreator class ProjectCreator
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
class BackgroundTransaction < Transaction class BackgroundTransaction < Transaction
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Class for calculating the difference between two numeric values. # Class for calculating the difference between two numeric values.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module InfluxDb module InfluxDb
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Module for instrumenting methods. # Module for instrumenting methods.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Class for tracking timing information about method calls # Class for tracking timing information about method calls
......
# frozen_string_literal: true
# rubocop:disable Style/ClassVars # rubocop:disable Style/ClassVars
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Methods module Methods
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Class for storing details of a single metric (label, value, etc). # Class for storing details of a single metric (label, value, etc).
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Mocks ::Prometheus::Client::Metric and all derived metrics # Mocks ::Prometheus::Client::Metric and all derived metrics
......
# frozen_string_literal: true
require 'prometheus/client' require 'prometheus/client'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Rack middleware for tracking Rails and Grape requests. # Rack middleware for tracking Rails and Grape requests.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
class RequestsRackMiddleware class RequestsRackMiddleware
......
# frozen_string_literal: true
require 'logger' require 'logger'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Samplers module Samplers
......
# frozen_string_literal: true
require 'prometheus/client/support/unicorn' require 'prometheus/client/support/unicorn'
module Gitlab module Gitlab
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Samplers module Samplers
......
# frozen_string_literal: true
require 'webrick' require 'webrick'
require 'prometheus/client/rack/exporter' require 'prometheus/client/rack/exporter'
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Sidekiq middleware for tracking jobs. # Sidekiq middleware for tracking jobs.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Subscribers module Subscribers
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Subscribers module Subscribers
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
module Subscribers module Subscribers
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Module for gathering system/process statistics such as the memory usage. # Module for gathering system/process statistics such as the memory usage.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
# Class for storing metrics information of a single transaction. # Class for storing metrics information of a single transaction.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Metrics module Metrics
class WebTransaction < Transaction class WebTransaction < Transaction
...@@ -40,7 +42,7 @@ module Gitlab ...@@ -40,7 +42,7 @@ module Gitlab
# increasing the cardinality of our metrics, we limit the number of # increasing the cardinality of our metrics, we limit the number of
# possible suffixes. # possible suffixes.
if suffix && ALLOWED_SUFFIXES.include?(suffix) if suffix && ALLOWED_SUFFIXES.include?(suffix)
action += ".#{suffix}" action = "#{action}.#{suffix}"
end end
{ controller: controller.class.name, action: action } { controller: controller.class.name, action: action }
......
# frozen_string_literal: true
# A dumb middleware that returns a Go HTML document if the go-get=1 query string # A dumb middleware that returns a Go HTML document if the go-get=1 query string
# is used irrespective if the namespace/project exists # is used irrespective if the namespace/project exists
module Gitlab module Gitlab
......
# frozen_string_literal: true
# Gitlab::Middleware::Multipart - a Rack::Multipart replacement # Gitlab::Middleware::Multipart - a Rack::Multipart replacement
# #
# Rack::Multipart leaves behind tempfiles in /tmp and uses valuable Ruby # Rack::Multipart leaves behind tempfiles in /tmp and uses valuable Ruby
......
# frozen_string_literal: true
# This Rack middleware is intended to measure the latency between # This Rack middleware is intended to measure the latency between
# gitlab-workhorse forwarding a request to the Rails application and the # gitlab-workhorse forwarding a request to the Rails application and the
# time this middleware is reached. # time this middleware is reached.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Middleware module Middleware
class ReadOnly class ReadOnly
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Middleware module Middleware
class ReadOnly class ReadOnly
......
module Gitlab # rubocop:disable Naming/FileName # rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab
module Middleware module Middleware
# Some of middleware would hold env for no good reason even after the # Some of middleware would hold env for no good reason even after the
# request had already been processed, and we could not garbage collect # request had already been processed, and we could not garbage collect
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Middleware module Middleware
class Static < ActionDispatch::Static class Static < ActionDispatch::Static
......
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