Enable even more frozen string in lib/gitlab

Enables frozens string for the following:

* lib/gitlab/conflict/**/*.rb
* lib/gitlab/cross_project_access/**/*.rb
* lib/gitlab/cycle_analytics/**/*.rb
* lib/gitlab/data_builder/**/*.rb
* lib/gitlab/database/**/*.rb
* lib/gitlab/dependency_linker/**/*.rb
* lib/gitlab/diff/**/*.rb
* lib/gitlab/downtime_check/**/*.rb
* lib/gitlab/email/**/*.rb
* lib/gitlab/etag_caching/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
This commit is contained in:
gfyoung 2018-11-05 20:45:35 -08:00
parent 68cb1e2393
commit 7e6f6e1603
102 changed files with 214 additions and 5 deletions

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Conflict
class File

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Conflict
class FileCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
class CheckCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
class CheckInfo

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
module ClassMethods

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module BaseQuery

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class CodeEventFetcher < BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class CodeStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module EventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class IssueEventFetcher < BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class IssueStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module MetricsTables

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class Permissions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class PlanEventFetcher < BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class PlanStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ProductionEventFetcher < IssueEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module ProductionHelper

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ProductionStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ReviewEventFetcher < BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ReviewStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Stage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StageSummary

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StagingEventFetcher < BaseEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StagingStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class TestEventFetcher < StagingEventFetcher

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class TestStage < BaseStage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class Updater

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class UsageData

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Build

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Note

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Pipeline

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Push

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Repository

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DataBuilder
module WikiPage

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module ArelMethods

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# For large tables, PostgreSQL can take a long time to count rows due to MVCC.
# We can optimize this by using the reltuples count as described in https://wiki.postgresql.org/wiki/Slow_Counting.
module Gitlab

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module DateTime

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
# Model that can be used for querying permissions of a SQL user.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# https://www.periscopedata.com/blog/medians-in-sql.html
module Gitlab
module Database

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module MigrationHelpers

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module MultiThreadedMigration

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
# Module that can be injected into a ActiveRecord::Relation to make it

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This module can be included in migrations to make it easier to rename paths
# of `Namespace` & `Project` models certain paths would become `reserved`.
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Database
BINARY_TYPE =

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class BaseLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class CartfileLinker < MethodLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
module Cocoapods

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class ComposerJsonLinker < PackageJsonLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GemfileLinker < MethodLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GemspecLinker < MethodLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GodepsJsonLinker < JsonLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class JsonLinker < BaseLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class MethodLinker < BaseLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PackageJsonLinker < JsonLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodfileLinker < GemfileLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodspecJsonLinker < JsonLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodspecLinker < MethodLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class RequirementsTxtLinker < BaseLinker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class DiffRefs

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class File

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class Highlight

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class ImagePoint

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class InlineDiff
@ -71,7 +73,7 @@ module Gitlab
def find_changed_line_pairs(lines)
# Prefixes of all diff lines, indicating their types
# For example: `" - + -+ ---+++ --+ -++"`
line_prefixes = lines.each_with_object("") { |line, s| s << (line[0] || ' ') }.gsub(/[^ +-]/, ' ')
line_prefixes = lines.each_with_object(+"") { |line, s| s << (line[0] || ' ') }.gsub(/[^ +-]/, ' ')
changed_line_pairs = []
line_prefixes.scan(LINE_PAIRS_PATTERN) do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class InlineDiffMarkdownMarker < Gitlab::StringRangeMarker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class InlineDiffMarker < Gitlab::StringRangeMarker

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class Line

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# When provided a diff for a specific file, maps old line numbers to new line
# numbers and back, to find out where a specific line in a file was moved by the
# changes.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class ParallelDiff

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Diff
class Parser

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Defines a specific location, identified by paths line numbers and image coordinates,
# within a specific diff, identified by start, head and base commit ids.
module Gitlab

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Finds the diff position in the new diff that corresponds to the same location
# specified by the provided position in the old diff.
module Gitlab

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
class DowntimeCheck
class Message
@ -18,13 +20,13 @@ module Gitlab
def to_s
label = offline ? OFFLINE : ONLINE
message = "[#{label}]: #{path}"
message = ["[#{label}]: #{path}"]
if reason?
message += ":\n\n#{reason}\n\n"
message << ":\n\n#{reason}\n\n"
end
message
message.join
end
def reason?

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
class AttachmentUploader

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
module Hook

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
module Hook

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
module Hook

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
module Hook

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
class HTMLParser

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Gitlab
module Email
module Message
@ -116,7 +118,7 @@ module Gitlab
end
def subject
subject_text = '[Git]'
subject_text = ['[Git]']
subject_text << "[#{project.full_path}]"
subject_text << "[#{ref_name}]" if @action == :push
subject_text << ' '
@ -134,6 +136,8 @@ module Gitlab
subject_action[0] = subject_action[0].capitalize
subject_text << "#{subject_action} #{ref_type} #{ref_name}"
end
subject_text.join
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_dependency 'gitlab/email/handler'
# Inspired in great part by Discourse's Email::Receiver

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Inspired in great part by Discourse's Email::Receiver
module Gitlab
module Email

View File

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

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