Commit f93f8f56 authored by gfyoung's avatar gfyoung
Browse files

Enable even more frozen string for lib/gitlab

Enables frozen string for the following:

* lib/gitlab/patch/**/*.rb
* lib/gitlab/popen/**/*.rb
* lib/gitlab/profiler/**/*.rb
* lib/gitlab/project_authorizations/**/*.rb
* lib/gitlab/prometheus/**/*.rb
* lib/gitlab/query_limiting/**/*.rb
* lib/gitlab/quick_actions/**/*.rb
* lib/gitlab/redis/**/*.rb
* lib/gitlab/request_profiler/**/*.rb
* lib/gitlab/search/**/*.rb
* lib/gitlab/sherlock/**/*.rb
* lib/gitlab/sidekiq_middleware/**/*.rb
* lib/gitlab/slash_commands/**/*.rb
* lib/gitlab/sql/**/*.rb
* lib/gitlab/template/**/*.rb
* lib/gitlab/testing/**/*.rb
* lib/gitlab/utils/**/*.rb
* lib/gitlab/webpack/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
parent 60261d9d
---
title: Enable even more frozen string for lib/gitlab
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module Gitlab
module Ci
class Config
......
# frozen_string_literal: true
# Inspired by https://github.com/peek/peek-pg/blob/master/lib/peek/views/pg.rb
# PEEK_DB_CLIENT is a constant set in config/initializers/peek.rb
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Popen
class Runner
......
# frozen_string_literal: true
module Gitlab
module Profiler
class TotalTimeFlatPrinter < RubyProf::FlatPrinter
......
# frozen_string_literal: true
module Gitlab
module ProjectAuthorizations
# Calculating new project authorizations when supporting nested groups.
......
# frozen_string_literal: true
module Gitlab
module ProjectAuthorizations
# Calculating new project authorizations when not supporting nested groups.
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module AdditionalMetricsParser
......
# frozen_string_literal: true
module Gitlab
module Prometheus
class Metric
......
# frozen_string_literal: true
module Gitlab
module Prometheus
class MetricGroup
......
# frozen_string_literal: true
module Gitlab
module Prometheus
ParsingError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module Prometheus
module Queries
......
# frozen_string_literal: true
module Gitlab
module QueryLimiting
class ActiveSupportSubscriber < ActiveSupport::Subscriber
......
# frozen_string_literal: true
module Gitlab
module QueryLimiting
class Transaction
......@@ -68,7 +70,7 @@ def threshold_exceeded?
def error_message
header = 'Too many SQL queries were executed'
header += " in #{action}" if action
header = "#{header} in #{action}" if action
"#{header}: a maximum of #{THRESHOLD} is allowed but #{count} SQL queries were executed"
end
......
# frozen_string_literal: true
module Gitlab
module QuickActions
class CommandDefinition
......
# frozen_string_literal: true
module Gitlab
module QuickActions
module Dsl
......
# frozen_string_literal: true
module Gitlab
module QuickActions
# This class takes an array of commands that should be extracted from a
......
# frozen_string_literal: true
module Gitlab
module QuickActions
# This class takes spend command argument
......
# frozen_string_literal: true
module Gitlab
module QuickActions
class SubstitutionDefinition < CommandDefinition
......
# frozen_string_literal: true
# please require all dependencies below:
require_relative 'wrapper' unless defined?(::Rails) && ::Rails.root.present?
......
# frozen_string_literal: true
# please require all dependencies below:
require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper)
......
# frozen_string_literal: true
# please require all dependencies below:
require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper)
......
# frozen_string_literal: true
# This file should only be used by sub-classes, not directly by any clients of the sub-classes
# please require all dependencies below:
require 'active_support/core_ext/hash/keys'
......
# frozen_string_literal: true
require 'ruby-prof'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module RequestProfiler
class Profile
......
# frozen_string_literal: true
module Gitlab
module Sanitizers
module SVG
......
# frozen_string_literal: true
# Generated from:
# SVG element list: https://www.w3.org/TR/SVG/eltindex.html
# SVG Attribute list: https://www.w3.org/TR/SVG/attindex.html
......
# frozen_string_literal: true
module Gitlab
module Search
class ParsedQuery
......
# frozen_string_literal: true
module Gitlab
module Search
class Query < SimpleDelegator
......
# frozen_string_literal: true
module Gitlab
module Serializer
module Ci
......
# frozen_string_literal: true
module Gitlab
module Serializer
class Pagination
......
# frozen_string_literal: true
module Gitlab
module Sherlock
# A collection of transactions recorded by Sherlock.
......
# frozen_string_literal: true
module Gitlab
module Sherlock
class FileSample
......
# frozen_string_literal: true
module Gitlab
module Sherlock
# Class for profiling code on a per line basis.
......
# frozen_string_literal: true
module Gitlab
module Sherlock
class LineSample
......
# frozen_string_literal: true
module Gitlab
module Sherlock
class Location
......
# frozen_string_literal: true
module Gitlab
module Sherlock
# Rack middleware used for tracking request metrics.
......
# frozen_string_literal: true
module Gitlab
module Sherlock
class Query
......@@ -48,7 +50,7 @@ def initialize(query, started_at, finished_at)
end
unless @query.end_with?(';')
@query += ';'
@query = "#{@query};"
end
end
......
# frozen_string_literal: true
module Gitlab
module Sherlock
class Transaction
......
# frozen_string_literal: true
module Gitlab
module SidekiqLogging
class JSONFormatter
......
# frozen_string_literal: true
module Gitlab
module SidekiqLogging
class StructuredLogger
......
# frozen_string_literal: true
module Gitlab
module SidekiqMiddleware
class ArgumentsLogger
......
# frozen_string_literal: true
module Gitlab
module SidekiqMiddleware
class RequestStoreMiddleware
......
# frozen_string_literal: true
require 'mutex_m'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module SidekiqStatus
class ClientMiddleware
......
# frozen_string_literal: true
module Gitlab
module SidekiqStatus
class ServerMiddleware
......
# frozen_string_literal: true
module Gitlab
module SidekiqVersioning
module Manager
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class BaseCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class Command < BaseCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class Deploy < BaseCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class Help < BaseCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueCommand < BaseCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueMove < IssueCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueNew < IssueCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueSearch < IssueCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueShow < IssueCommand
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# coding: utf-8
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
......@@ -38,10 +40,10 @@ def show_issue
end
def text
message = "**#{status_text(@resource)}**"
message = ["**#{status_text(@resource)}**"]
if @resource.upvotes.zero? && @resource.downvotes.zero? && @resource.user_notes_count.zero?
return message
return message.join
end
message << " · "
......@@ -49,7 +51,7 @@ def text
message << ":-1: #{@resource.downvotes} " unless @resource.downvotes.zero?
message << ":speech_balloon: #{@resource.user_notes_count}" unless @resource.user_notes_count.zero?
message
message.join
end
def pretext
......
module Gitlab # rubocop:disable Naming/FileName
# rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab
module SlashCommands
Result = Struct.new(:type, :message)
end
......
# frozen_string_literal: true
module Gitlab
module SQL
# Class for easily building CTE statements.
......
# frozen_string_literal: true
module Gitlab
module SQL
module Glob
......
# frozen_string_literal: true
module Gitlab
module SQL
module Pattern
......
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