Commit d598e4fd authored by gfyoung's avatar gfyoung 🤔

Enable more frozen string in lib/**/*.rb

Enables frozen for the following:

* lib/*.rb
* lib/banzai/**/*.rb
* lib/bitbucket/**/*.rb
* lib/constraints/**/*.rb
* lib/container_registry/**/*.rb
* lib/declarative_policy/**/*.rb

Partially addresses #47424.
parent c3389c80
---
title: Enable more frozen string in lib/**/*.rb
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module AfterCommitQueue module AfterCommitQueue
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Backup module Backup
Error = Class.new(StandardError) Error = Class.new(StandardError)
end end
# frozen_string_literal: true
module Banzai module Banzai
# if you need to render markdown, then you probably need to post_process as well, # if you need to render markdown, then you probably need to post_process as well,
# such as removing references that the current user doesn't have # such as removing references that the current user doesn't have
......
# frozen_string_literal: true
module Banzai module Banzai
module ColorParser module ColorParser
ALPHA = /0(?:\.\d+)?|\.\d+|1(?:\.0+)?/ # 0.0..1.0 ALPHA = /0(?:\.\d+)?|\.\d+|1(?:\.0+)?/ # 0.0..1.0
......
# frozen_string_literal: true
module Banzai module Banzai
module CommitRenderer module CommitRenderer
ATTRIBUTES = [:description, :title].freeze ATTRIBUTES = [:description, :title].freeze
......
# frozen_string_literal: true
module Banzai module Banzai
# Common methods for ReferenceFilters that support an optional cross-project # Common methods for ReferenceFilters that support an optional cross-project
# reference. # reference.
......
# frozen_string_literal: true
module Banzai module Banzai
module Filter module Filter
def self.[](name) def self.[](name)
......
# frozen_string_literal: true
# `CommonMark` markdown engine for GitLab's Banzai markdown filter. # `CommonMark` markdown engine for GitLab's Banzai markdown filter.
# This module is used in Banzai::Filter::MarkdownFilter. # This module is used in Banzai::Filter::MarkdownFilter.
# Used gem is `commonmarker` which is a ruby wrapper for libcmark (CommonMark parser) # Used gem is `commonmarker` which is a ruby wrapper for libcmark (CommonMark parser)
......
# frozen_string_literal: true
# `Redcarpet` markdown engine for GitLab's Banzai markdown filter. # `Redcarpet` markdown engine for GitLab's Banzai markdown filter.
# This module is used in Banzai::Filter::MarkdownFilter. # This module is used in Banzai::Filter::MarkdownFilter.
# Used gem is `redcarpet` which is a ruby library for markdown processing. # Used gem is `redcarpet` which is a ruby library for markdown processing.
......
# frozen_string_literal: true
module Banzai module Banzai
module Filter module Filter
class WikiLinkFilter < HTML::Pipeline::Filter class WikiLinkFilter < HTML::Pipeline::Filter
......
# frozen_string_literal: true
module Banzai module Banzai
class FilterArray < Array class FilterArray < Array
# Insert a value immediately after another value # Insert a value immediately after another value
......
# frozen_string_literal: true
module Banzai module Banzai
# Extract references to issuables from multiple documents # Extract references to issuables from multiple documents
......
# frozen_string_literal: true
module Banzai module Banzai
# Class for rendering multiple objects (e.g. Note instances) in a single pass, # Class for rendering multiple objects (e.g. Note instances) in a single pass,
# using +render_field+ to benefit from caching in the database. Rendering and # using +render_field+ to benefit from caching in the database. Rendering and
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
def self.[](name) def self.[](name)
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class AsciiDocPipeline < BasePipeline class AsciiDocPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class AtomPipeline < FullPipeline class AtomPipeline < FullPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class BasePipeline class BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class BroadcastMessagePipeline < DescriptionPipeline class BroadcastMessagePipeline < DescriptionPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
module CombinedPipeline module CombinedPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class CommitDescriptionPipeline < SingleLinePipeline class CommitDescriptionPipeline < SingleLinePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class DescriptionPipeline < FullPipeline class DescriptionPipeline < FullPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class EmailPipeline < FullPipeline class EmailPipeline < FullPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class FullPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GfmPipeline) class FullPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GfmPipeline)
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class GfmPipeline < BasePipeline class GfmPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class MarkupPipeline < BasePipeline class MarkupPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class NotePipeline < FullPipeline class NotePipeline < FullPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class PlainMarkdownPipeline < BasePipeline class PlainMarkdownPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class PostProcessPipeline < BasePipeline class PostProcessPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class PreProcessPipeline < BasePipeline class PreProcessPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class RelativeLinkPipeline < BasePipeline class RelativeLinkPipeline < BasePipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class SingleLinePipeline < GfmPipeline class SingleLinePipeline < GfmPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Pipeline module Pipeline
class WikiPipeline < FullPipeline class WikiPipeline < FullPipeline
......
# frozen_string_literal: true
module Banzai module Banzai
module Querying module Querying
module_function module_function
......
# frozen_string_literal: true
module Banzai module Banzai
# Class for removing Markdown references a certain user is not allowed to # Class for removing Markdown references a certain user is not allowed to
# view. # view.
......
# frozen_string_literal: true
module Banzai module Banzai
# Extract possible GFM references from an arbitrary String for further processing. # Extract possible GFM references from an arbitrary String for further processing.
class ReferenceExtractor class ReferenceExtractor
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
# Returns the reference parser class for the given type # Returns the reference parser class for the given type
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
# Base class for reference parsing classes. # Base class for reference parsing classes.
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class CommitParser < BaseParser class CommitParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class CommitRangeParser < BaseParser class CommitRangeParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class DirectlyAddressedUserParser < UserParser class DirectlyAddressedUserParser < UserParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
# The actual parser is implemented in the EE mixin # The actual parser is implemented in the EE mixin
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class ExternalIssueParser < BaseParser class ExternalIssueParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class IssuableParser < BaseParser class IssuableParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class IssueParser < IssuableParser class IssueParser < IssuableParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class LabelParser < BaseParser class LabelParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class MergeRequestParser < IssuableParser class MergeRequestParser < IssuableParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class MilestoneParser < BaseParser class MilestoneParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class SnippetParser < BaseParser class SnippetParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module ReferenceParser module ReferenceParser
class UserParser < BaseParser class UserParser < BaseParser
......
# frozen_string_literal: true
module Banzai module Banzai
module Renderer module Renderer
# Convert a Markdown String into an HTML-safe String of HTML # Convert a Markdown String into an HTML-safe String of HTML
......
# frozen_string_literal: true
module Banzai module Banzai
module Renderer module Renderer
module CommonMark module CommonMark
......
# frozen_string_literal: true
module Banzai module Banzai
module Renderer module Renderer
module Redcarpet module Redcarpet
......
# frozen_string_literal: true
module Banzai module Banzai
module RequestStoreReferenceCache module RequestStoreReferenceCache
def cached_call(request_store_key, cache_key, path: []) def cached_call(request_store_key, cache_key, path: [])
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
class Client class Client
attr_reader :connection attr_reader :connection
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
class Collection < Enumerator class Collection < Enumerator
def initialize(paginator) def initialize(paginator)
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
class Connection class Connection
DEFAULT_API_VERSION = '2.0'.freeze DEFAULT_API_VERSION = '2.0'.freeze
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Error module Error
Unauthorized = Class.new(StandardError) Unauthorized = Class.new(StandardError)
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
class Page class Page
attr_reader :attrs, :items attr_reader :attrs, :items
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
class Paginator class Paginator
PAGE_LENGTH = 50 # The minimum length is 10 and the maximum is 100. PAGE_LENGTH = 50 # The minimum length is 10 and the maximum is 100.
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class Base class Base
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class Comment < Representation::Base class Comment < Representation::Base
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class Issue < Representation::Base class Issue < Representation::Base
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class PullRequest < Representation::Base class PullRequest < Representation::Base
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class PullRequestComment < Comment class PullRequestComment < Comment
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class Repo < Representation::Base class Repo < Representation::Base
......
# frozen_string_literal: true
module Bitbucket module Bitbucket
module Representation module Representation
class User < Representation::Base class User < Representation::Base
......
# frozen_string_literal: true
class CarrierWaveStringFile < StringIO class CarrierWaveStringFile < StringIO
def original_filename def original_filename
"" ""
......
# frozen_string_literal: true
module Constraints module Constraints
class FeatureConstrainer class FeatureConstrainer
attr_reader :feature attr_reader :feature
......
# frozen_string_literal: true
module Constraints module Constraints
class GroupUrlConstrainer class GroupUrlConstrainer
def matches?(request) def matches?(request)
......
# frozen_string_literal: true
module Constraints module Constraints
class ProjectUrlConstrainer class ProjectUrlConstrainer
def matches?(request) def matches?(request)
......
# frozen_string_literal: true
module Constraints module Constraints
class UserUrlConstrainer class UserUrlConstrainer
def matches?(request) def matches?(request)
......
# frozen_string_literal: true
module ContainerRegistry module ContainerRegistry
class Blob class Blob
attr_reader :repository, :config attr_reader :repository, :config
......
# frozen_string_literal: true
require 'faraday' require 'faraday'
require 'faraday_middleware' require 'faraday_middleware'
......
# frozen_string_literal: true
module ContainerRegistry module ContainerRegistry
class Config class Config
attr_reader :tag, :blob, :data attr_reader :tag, :blob, :data
......
# frozen_string_literal: true
module ContainerRegistry module ContainerRegistry
## ##
# Class responsible for extracting project and repository name from # Class responsible for extracting project and repository name from
......
# frozen_string_literal: true
module ContainerRegistry module ContainerRegistry
class Registry class Registry
attr_reader :uri, :client, :path attr_reader :uri, :client, :path
......
# frozen_string_literal: true
module ContainerRegistry module ContainerRegistry
class Tag class Tag
attr_reader :repository, :name attr_reader :repository, :name
......