Commit 32bf2667 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'frozen-string-lib-gitlab-more' into 'master'

Enable even more frozen string in lib/gitlab

See merge request gitlab-org/gitlab-ce!22863
parents 04c55292 7e6f6e16
---
title: Enable even more frozen string in lib/gitlab/**/*.rb
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module Gitlab
module Conflict
class File
......
# frozen_string_literal: true
module Gitlab
module Conflict
class FileCollection
......
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
class CheckCollection
......
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
class CheckInfo
......
# frozen_string_literal: true
module Gitlab
class CrossProjectAccess
module ClassMethods
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module BaseQuery
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class CodeEventFetcher < BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class CodeStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module EventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class IssueEventFetcher < BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class IssueStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module MetricsTables
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class Permissions
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class PlanEventFetcher < BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class PlanStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ProductionEventFetcher < IssueEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module ProductionHelper
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ProductionStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ReviewEventFetcher < BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class ReviewStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Stage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StageSummary
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StagingEventFetcher < BaseEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class StagingStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module Summary
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class TestEventFetcher < StagingEventFetcher
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class TestStage < BaseStage
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class Updater
......
# frozen_string_literal: true
module Gitlab
module CycleAnalytics
class UsageData
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Build
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Note
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Pipeline
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Push
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module Repository
......
# frozen_string_literal: true
module Gitlab
module DataBuilder
module WikiPage
......
# frozen_string_literal: true
module Gitlab
module Database
module ArelMethods
......
# 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
......
# frozen_string_literal: true
module Gitlab
module Database
module DateTime
......
# frozen_string_literal: true
module Gitlab
module Database
# Model that can be used for querying permissions of a SQL user.
......
# frozen_string_literal: true
# https://www.periscopedata.com/blog/medians-in-sql.html
module Gitlab
module Database
......
# frozen_string_literal: true
module Gitlab
module Database
module MigrationHelpers
......
# frozen_string_literal: true
module Gitlab
module Database
module MultiThreadedMigration
......
# frozen_string_literal: true
module Gitlab
module Database
# Module that can be injected into a ActiveRecord::Relation to make it
......
# 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`.
#
......
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration
......
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration
......
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration
......
# frozen_string_literal: true
module Gitlab
module Database
module RenameReservedPathsMigration
......
# frozen_string_literal: true
module Gitlab
module Database
BINARY_TYPE =
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class BaseLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class CartfileLinker < MethodLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
module Cocoapods
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class ComposerJsonLinker < PackageJsonLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GemfileLinker < MethodLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GemspecLinker < MethodLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class GodepsJsonLinker < JsonLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class JsonLinker < BaseLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class MethodLinker < BaseLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PackageJsonLinker < JsonLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodfileLinker < GemfileLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodspecJsonLinker < JsonLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class PodspecLinker < MethodLinker
......
# frozen_string_literal: true
module Gitlab
module DependencyLinker
class RequirementsTxtLinker < BaseLinker
......
# frozen_string_literal: true
module Gitlab
module Diff
class DiffRefs
......
# frozen_string_literal: true
module Gitlab
module Diff
class File
......
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection
......
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection
......
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection
......
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection
......
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters
......
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters
......
# frozen_string_literal: true
module Gitlab
module Diff
module Formatters
......
# frozen_string_literal: true
module Gitlab
module Diff
class Highlight
......
# frozen_string_literal: true
module Gitlab
module Diff
class ImagePoint
......
# 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
......
# frozen_string_literal: true
module Gitlab
module Diff
class InlineDiffMarkdownMarker < Gitlab::StringRangeMarker
......
# frozen_string_literal: true
module Gitlab
module Diff
class InlineDiffMarker < Gitlab::StringRangeMarker
......
# frozen_string_literal: true
module Gitlab
module Diff
class Line
......
# 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.
......
# frozen_string_literal: true
module Gitlab
module Diff
class ParallelDiff
......
# frozen_string_literal: true
module Gitlab
module Diff
class Parser
......
# 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
......
# 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
......
# 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?
......
# frozen_string_literal: true
module Gitlab
module Email
class AttachmentUploader
......
# frozen_string_literal: true
module Gitlab
module Email
module Hook
......
# frozen_string_literal: true
module Gitlab
module Email
module Hook
......
# frozen_string_literal: true
module Gitlab
module Email
module Hook
......
# frozen_string_literal: true
module Gitlab
module Email
module Hook
......
# frozen_string_literal: true
module Gitlab
module Email
class HTMLParser
......
# 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
......
# frozen_string_literal: true
require_dependency 'gitlab/email/handler'
# Inspired in great part by Discourse's Email::Receiver
......
# frozen_string_literal: true
# Inspired in great part by Discourse's Email::Receiver
module Gitlab
module Email
......