Commit 6494467a authored by Stan Hu's avatar Stan Hu

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

Enable even more frozen string in lib/gitlab

See merge request gitlab-org/gitlab-ce!22959
parents 1d165305 ebf98f27
---
title: Enable even more frozen string in lib/gitlab/**/*.rb
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
require 'fogbugz'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class Importer
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class Repository
......
# frozen_string_literal: true
module Gitlab
module Gfm
##
......
# frozen_string_literal: true
require 'fileutils'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
# Parses root .gitattributes file at a given ref
......
# frozen_string_literal: true
module Gitlab
module Git
# Class for parsing Git attribute files and extracting the attributes for
......
# frozen_string_literal: true
module Gitlab
module Git
class Blame
......
# frozen_string_literal: true
# Gitaly note: JV: seems to be completely migrated (behind feature flags).
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
class Branch < Ref
......
# frozen_string_literal: true
# Gitlab::Git::Commit is a wrapper around Gitaly::GitCommit
module Gitlab
module Git
......
# frozen_string_literal: true
# Gitlab::Git::CommitStats counts the additions, deletions, and total changes
# in a commit.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
class Diff
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
class Index
......
# frozen_string_literal: true
module Gitlab
module Git
class LfsChanges
......
# frozen_string_literal: true
module Gitlab
module Git
class LfsPointerFile
......
# frozen_string_literal: true
module Gitlab
module Git
class OperationService
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
#
......
# frozen_string_literal: true
module Gitlab
module Git
# This class behaves like a struct with fields :blob_id, :blob_size, :operation, :old_path, :new_path
......
# frozen_string_literal: true
module Gitlab
module Git
class Ref
......
# frozen_string_literal: true
module Gitlab
module Git
class RemoteMirror
......
# frozen_string_literal: true
module Gitlab
module Git
#
......
# frozen_string_literal: true
require 'tempfile'
require 'forwardable'
require "rubygems/package"
......
# frozen_string_literal: true
module Gitlab
module Git
module RepositoryMirroring
......
# frozen_string_literal: true
module Gitlab
module Git
class Tag < Ref
......
# frozen_string_literal: true
module Gitlab
module Git
class Tree
......
# frozen_string_literal: true
module Gitlab
module Git
class User
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
module Version
......
# frozen_string_literal: true
module Gitlab
module Git
class Wiki
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiFile
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiPage
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiPageVersion
......
# frozen_string_literal: true
module Gitlab
module Git
module WrapsGitalyErrors
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# This module expects an `ATTRS` const to be defined on the subclass
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class BlobService
......@@ -15,7 +17,7 @@ module Gitlab
)
response = GitalyClient.call(@gitaly_repo.storage_name, :blob_service, :get_blob, request, timeout: GitalyClient.fast_timeout)
data = ''
data = []
blob = nil
response.each do |msg|
if blob.nil?
......@@ -27,6 +29,8 @@ module Gitlab
return nil if blob.oid.blank?
data = data.join
Gitlab::Git::Blob.new(
id: blob.oid,
size: blob.size,
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class BlobsStitcher
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class CommitService
......@@ -93,7 +95,7 @@ module Gitlab
response = GitalyClient.call(@repository.storage, :commit_service, :tree_entry, request, timeout: GitalyClient.medium_timeout)
entry = nil
data = ''
data = []
response.each do |msg|
if entry.nil?
entry = msg
......@@ -103,7 +105,7 @@ module Gitlab
data << msg.data
end
entry.data = data
entry.data = data.join
entry unless entry.oid.blank?
end
......@@ -254,7 +256,7 @@ module Gitlab
)
response = GitalyClient.call(@repository.storage, :commit_service, :raw_blame, request, timeout: GitalyClient.medium_timeout)
response.reduce("") { |memo, msg| memo << msg.data }
response.reduce([]) { |memo, msg| memo << msg.data }.join
end
def find_commit(revision)
......@@ -345,8 +347,8 @@ module Gitlab
request = Gitaly::ExtractCommitSignatureRequest.new(repository: @gitaly_repo, commit_id: commit_id)
response = GitalyClient.call(@repository.storage, :commit_service, :extract_commit_signature, request)
signature = ''.b
signed_text = ''.b
signature = +''.b
signed_text = +''.b
response.each do |message|
signature << message.signature
......@@ -364,7 +366,7 @@ module Gitlab
request = Gitaly::GetCommitSignaturesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids)
response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_signatures, request, timeout: GitalyClient.fast_timeout)
signatures = Hash.new { |h, k| h[k] = [''.b, ''.b] }
signatures = Hash.new { |h, k| h[k] = [+''.b, +''.b] }
current_commit_id = nil
response.each do |message|
......@@ -383,7 +385,7 @@ module Gitlab
request = Gitaly::GetCommitMessagesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids)
response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_messages, request, timeout: GitalyClient.fast_timeout)
messages = Hash.new { |h, k| h[k] = ''.b }
messages = Hash.new { |h, k| h[k] = +''.b }
current_commit_id = nil
response.each do |rpc_message|
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class ConflictFilesStitcher
......@@ -17,7 +19,7 @@ module Gitlab
current_file = file_from_gitaly_header(gitaly_file.header)
else
current_file.raw_content << gitaly_file.content
current_file.raw_content = "#{current_file.raw_content}#{gitaly_file.content}"
end
end
end
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class ConflictsService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class Diff
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class DiffStitcher
......@@ -20,7 +22,7 @@ module Gitlab
current_diff = GitalyClient::Diff.new(diff_params)
else
current_diff.patch += diff_msg.raw_patch_data
current_diff.patch = "#{current_diff.patch}#{diff_msg.raw_patch_data}"
end
if diff_msg.end_of_patch
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class HealthCheckService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class NamespaceService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class NotificationService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class OperationService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class QueueEnumerator
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RefService
......@@ -218,7 +220,7 @@ module Gitlab
request = Gitaly::GetTagMessagesRequest.new(repository: @gitaly_repo, tag_ids: tag_ids)
response = GitalyClient.call(@repository.storage, :ref_service, :get_tag_messages, request, timeout: GitalyClient.fast_timeout)
messages = Hash.new { |h, k| h[k] = ''.b }
messages = Hash.new { |h, k| h[k] = +''.b }
current_tag_id = nil
response.each do |rpc_message|
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RemoteService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RepositoryService
......@@ -56,9 +58,9 @@ module Gitlab
request = Gitaly::GetInfoAttributesRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :repository_service, :get_info_attributes, request, timeout: GitalyClient.fast_timeout)
response.each_with_object("") do |message, attributes|
response.each_with_object([]) do |message, attributes|
attributes << message.attributes
end
end.join
end
def fetch_remote(remote, ssh_auth:, forced:, no_tags:, timeout:, prune: true)
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# Meant for extraction of server data, and later maybe to perform misc task
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class StorageService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# This is a chokepoint that is meant to help us stop remove all places
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
module Util
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class WikiFile
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class WikiPage
......
# frozen_string_literal: true
require 'stringio'
module Gitlab
......@@ -139,7 +141,7 @@ module Gitlab
next unless message.name.present? || wiki_file
if wiki_file
wiki_file.raw_data << message.raw_data
wiki_file.raw_data = "#{wiki_file.raw_data}#{message.raw_data}"
else
wiki_file = GitalyClient::WikiFile.new(message.to_h)
# All gRPC strings in a response are frozen, so we get
......@@ -160,7 +162,7 @@ module Gitlab
)
response = GitalyClient.call(@repository.storage, :wiki_service, :wiki_get_formatted_data, request)
response.reduce("") { |memo, msg| memo << msg.data }
response.reduce([]) { |memo, msg| memo << msg.data }.join
end
private
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class Client
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class Importer
......@@ -22,22 +24,22 @@ module Gitlab
issues = client.issues(project_identifier)
issues.each do |issue|
body = @formatter.author_line(issue["author"]["name"])
body += issue["description"]
body = [@formatter.author_line(issue["author"]["name"])]
body << issue["description"]
comments = client.issue_comments(project_identifier, issue["iid"])
if comments.any?
body += @formatter.comments_header
body << @formatter.comments_header
end
comments.each do |comment|
body += @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"])
body << @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"])
end
project.issues.create!(
iid: issue["iid"],
description: body,
description: body.join,
title: issue["title"],
state: issue["state"],
updated_at: issue["updated_at"],
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Client
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Importer
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Repository
......
# frozen_string_literal: true
module Gitlab
module Gpg
class Commit
......
# frozen_string_literal: true
module Gitlab
module Gpg
class InvalidGpgSignatureUpdater
......
# frozen_string_literal: true
module Gitlab
module GrapeLogging
module Formatters
......
# frozen_string_literal: true
# This grape_logging module (https://github.com/aserafin/grape_logging) makes it
# possible to log how much time an API request was queued by Workhorse.
module Gitlab
......
# frozen_string_literal: true
# This grape_logging module (https://github.com/aserafin/grape_logging) makes it
# possible to log the user who performed the Grape API action by retrieving
# the user context from the request environment.
......
# frozen_string_literal: true
module Gitlab
module Graphql
# Allow fields to declare permissions their objects must have. The field
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Authorize
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Authorize
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Connections
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Connections
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Errors
......
# frozen_string_literal: true
module Gitlab
module Graphql
module ExposePermissions
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Present
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Present
......
# frozen_string_literal: true
module Gitlab
module Graphql
class Variables
......
# frozen_string_literal: true
module Gitlab
module Graphs
class Commits
......
# frozen_string_literal: true
module Gitlab
module HashedStorage
# Hashed Storage Migrator
......
# frozen_string_literal: true
module Gitlab
module HashedStorage
module RakeHelper
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
module BaseAbstractCheck
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
class DbCheck
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
class GitalyCheck
......
module Gitlab::HealthChecks # rubocop:disable Naming/FileName
# rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab::HealthChecks
Metric = Struct.new(:name, :value, :labels)
end
# frozen_string_literal: true
module Gitlab
module HealthChecks
class PrometheusTextFormat
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
module Redis
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
module Redis
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
module Redis
......
# frozen_string_literal: true
module Gitlab
module HealthChecks
module Redis
......
module Gitlab::HealthChecks # rubocop:disable Naming/FileName
# rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab::HealthChecks
Result = Struct.new(:success, :message, :labels)
end
# frozen_string_literal: true
module Gitlab
module HealthChecks
module SimpleAbstractCheck
......
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