Commit e166e574 authored by gfyoung's avatar gfyoung

Enable some frozen string in lib/gitlab

Enable frozen string for the following files:

* lib/gitlab/auth/**/*.rb
* lib/gitlab/badge/**/*.rb
* lib/gitlab/bare_repository_import/**/*.rb
* lib/gitlab/bitbucket_import/**/*.rb
* lib/gitlab/bitbucket_server_import/**/*.rb
* lib/gitlab/cache/**/*.rb
* lib/gitlab/checks/**/*.rb

Partially addresses #47424.
parent 79ba3892
---
title: Enable some frozen string in lib/gitlab
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
## ##
......
# frozen_string_literal: true
# These calls help to authenticate to OAuth provider by providing username and password # These calls help to authenticate to OAuth provider by providing username and password
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
class IpRateLimiter class IpRateLimiter
......
# frozen_string_literal: true
# LDAP authorization model # LDAP authorization model
# #
# * Check if we are allowed access (not blocked) # * Check if we are allowed access (not blocked)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module LDAP module LDAP
......
# frozen_string_literal: true
# Class to parse and transform the info provided by omniauth # Class to parse and transform the info provided by omniauth
# #
module Gitlab module Gitlab
......
# frozen_string_literal: true
# These calls help to authenticate to LDAP by providing username and password # These calls help to authenticate to LDAP by providing username and password
# #
# Since multiple LDAP servers are supported, it will loop through all of them # Since multiple LDAP servers are supported, it will loop through all of them
......
# frozen_string_literal: true
# Load a specific server configuration # Load a specific server configuration
module Gitlab module Gitlab
module Auth module Auth
......
# -*- ruby encoding: utf-8 -*- # -*- ruby encoding: utf-8 -*-
# frozen_string_literal: true
# Based on the `ruby-net-ldap` gem's `Net::LDAP::DN` # Based on the `ruby-net-ldap` gem's `Net::LDAP::DN`
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module LDAP module LDAP
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module LDAP module LDAP
......
# frozen_string_literal: true
# LDAP extension for User model # LDAP extension for User model
# #
# * Find or create user from omniauth.auth data # * Find or create user from omniauth.auth data
......
# frozen_string_literal: true
# Class to parse and transform the info provided by omniauth # Class to parse and transform the info provided by omniauth
# #
module Gitlab module Gitlab
......
# frozen_string_literal: true
# These calls help to authenticate to OAuth provider by providing username and password # These calls help to authenticate to OAuth provider by providing username and password
# #
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module OAuth module OAuth
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module OAuth module OAuth
......
# frozen_string_literal: true
# :nocov: # :nocov:
module Gitlab module Gitlab
module Auth module Auth
......
# frozen_string_literal: true
# OAuth extension for User model # OAuth extension for User model
# #
# * Find GitLab user based on omniauth uid and provider # * Find GitLab user based on omniauth uid and provider
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
class OmniauthIdentityLinkerBase class OmniauthIdentityLinkerBase
......
# frozen_string_literal: true
# Use for authentication only, in particular for Rack::Attack. # Use for authentication only, in particular for Rack::Attack.
# Does not perform authorization of scopes, etc. # Does not perform authorization of scopes, etc.
module Gitlab module Gitlab
......
module Gitlab # rubocop:disable Naming/FileName # rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab
module Auth module Auth
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
def ci?(for_project) def ci?(for_project)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module Saml module Saml
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module Saml module Saml
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
module Saml module Saml
......
# frozen_string_literal: true
# SAML extension for User model # SAML extension for User model
# #
# * Find GitLab user based on SAML uid and provider # * Find GitLab user based on SAML uid and provider
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
class TooManyIps < StandardError class TooManyIps < StandardError
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
class UniqueIpsLimiter class UniqueIpsLimiter
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
class UserAccessDeniedReason class UserAccessDeniedReason
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Auth module Auth
AuthenticationError = Class.new(StandardError) AuthenticationError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
class Base class Base
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Coverage module Coverage
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Coverage module Coverage
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Coverage module Coverage
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
## ##
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Pipeline module Pipeline
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Pipeline module Pipeline
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
module Pipeline module Pipeline
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Badge module Badge
## ##
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BareRepositoryImport module BareRepositoryImport
class Importer class Importer
NoAdminError = Class.new(StandardError) NoAdminError = Class.new(StandardError)
def self.execute(import_path) def self.execute(import_path)
import_path << '/' unless import_path.ends_with?('/') unless import_path.ends_with?('/')
import_path = "#{import_path}/"
end
repos_to_import = Dir.glob(import_path + '**/*.git') repos_to_import = Dir.glob(import_path + '**/*.git')
unless user = User.admins.order_id_asc.first unless user = User.admins.order_id_asc.first
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BareRepositoryImport module BareRepositoryImport
class Repository class Repository
...@@ -6,9 +8,12 @@ module Gitlab ...@@ -6,9 +8,12 @@ module Gitlab
attr_reader :group_path, :project_name, :repo_path attr_reader :group_path, :project_name, :repo_path
def initialize(root_path, repo_path) def initialize(root_path, repo_path)
unless root_path.ends_with?('/')
root_path = "#{root_path}/"
end
@root_path = root_path @root_path = root_path
@repo_path = repo_path @repo_path = repo_path
@root_path << '/' unless root_path.ends_with?('/')
full_path = full_path =
if hashed? && !wiki? if hashed? && !wiki?
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BitbucketImport module BitbucketImport
class Importer class Importer
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BitbucketImport module BitbucketImport
class ProjectCreator class ProjectCreator
......
# frozen_string_literal: true
module Gitlab module Gitlab
module BitbucketServerImport module BitbucketServerImport
class ProjectCreator class ProjectCreator
......
# frozen_string_literal: true
# This class is not backed by a table in the main database. # This class is not backed by a table in the main database.
# It loads the latest Pipeline for the HEAD of a repository, and caches that # It loads the latest Pipeline for the HEAD of a repository, and caches that
# in Redis. # in Redis.
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Cache module Cache
# See https://docs.gitlab.com/ee/development/utilities.html#requestcache # See https://docs.gitlab.com/ee/development/utilities.html#requestcache
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class ChangeAccess class ChangeAccess
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class CommitCheck class CommitCheck
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class ForcePush class ForcePush
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class LfsIntegrity class LfsIntegrity
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class MatchingMergeRequest class MatchingMergeRequest
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class PostPushMessage class PostPushMessage
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class ProjectCreated < PostPushMessage class ProjectCreated < PostPushMessage
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Checks module Checks
class ProjectMoved < PostPushMessage class ProjectMoved < PostPushMessage
......
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