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