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.
This commit is contained in:
gfyoung 2018-11-16 16:37:17 -08:00
parent 29d8179ba0
commit 7ec8af5017
103 changed files with 213 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
title: Enable even more frozen string for lib/gitlab
merge_request:
author: gfyoung
type: performance

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class IssuableBuilder < BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class IssueBuilder < BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class MergeRequestBuilder < BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class NoteBuilder < BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module HookData
class WikiPageBuilder < BaseBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module I18n
class MetadataEntry

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module I18n
class PoLinter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module I18n
class TranslationEntry

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Import
class Logger < ::Gitlab::JsonLogger

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
module AfterExportStrategies

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
module AfterExportStrategies

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
module AfterExportStrategies

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class AfterExportStrategyBuilder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class AttributeCleaner

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class AttributesFinder

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class AvatarRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class AvatarSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
module CommandLineUtil

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
Error = Class.new(StandardError)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class FileImporter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
# Given a class, it finds or creates a new object

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class HashUtil

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class Importer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
# Generates a hash that conforms with http://apidock.com/rails/Hash/to_json

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class LfsRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class LfsSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class MembersMapper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class MergeRequestParser

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class ProjectTreeRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class ProjectTreeSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class Reader

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class RelationFactory
@ -211,7 +213,7 @@ module Gitlab
def update_note_for_missing_author(author_name)
@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
def admin_user?

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class RepoRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class RepoSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class Saver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class Shared

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class StatisticsRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class UploadsManager

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class UploadsRestorer < UploadsSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class UploadsSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class VersionChecker

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class VersionSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class WikiRepoSaver < RepoSaver

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ImportExport
class WikiRestorer < RepoRestorer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
class ConfigMap

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
class Namespace

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Pod

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class BranchFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class Client

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class CommentFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class Importer

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class IssuableFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class IssueFormatter < IssuableFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class LabelFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class MilestoneFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class ProjectCreator

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class PullRequestFormatter < IssuableFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class ReleaseFormatter < BaseFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class UserFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module LegacyGithubImport
class WikiFormatter

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Class to parse manifest file and build a list of repositories for import
#
# <manifest>

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module ManifestImport
class ProjectCreator

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
class BackgroundTransaction < Transaction

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Class for calculating the difference between two numeric values.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module InfluxDb

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Module for instrumenting methods.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Class for tracking timing information about method calls

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# rubocop:disable Style/ClassVars
module Gitlab

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Methods

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Class for storing details of a single metric (label, value, etc).

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Mocks ::Prometheus::Client::Metric and all derived metrics

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'prometheus/client'
module Gitlab

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Rack middleware for tracking Rails and Grape requests.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
class RequestsRackMiddleware

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'logger'
module Gitlab

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Samplers

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'prometheus/client/support/unicorn'
module Gitlab

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Samplers

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'webrick'
require 'prometheus/client/rack/exporter'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Sidekiq middleware for tracking jobs.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Subscribers

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Subscribers

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
module Subscribers

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Module for gathering system/process statistics such as the memory usage.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
# Class for storing metrics information of a single transaction.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Metrics
class WebTransaction < Transaction
@ -40,7 +42,7 @@ module Gitlab
# increasing the cardinality of our metrics, we limit the number of
# possible suffixes.
if suffix && ALLOWED_SUFFIXES.include?(suffix)
action += ".#{suffix}"
action = "#{action}.#{suffix}"
end
{ controller: controller.class.name, action: action }

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# A dumb middleware that returns a Go HTML document if the go-get=1 query string
# is used irrespective if the namespace/project exists
module Gitlab

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Gitlab::Middleware::Multipart - a Rack::Multipart replacement
#
# Rack::Multipart leaves behind tempfiles in /tmp and uses valuable Ruby

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This Rack middleware is intended to measure the latency between
# gitlab-workhorse forwarding a request to the Rails application and the
# time this middleware is reached.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Middleware
class ReadOnly

Some files were not shown because too many files have changed in this diff Show more