Commit f514f9df authored by gfyoung's avatar gfyoung

Enable some frozen string in ee/lib

Enables frozen string in the following:

* ee/lib/*.rb
* ee/lib/api/**/*.rb
* ee/lib/audit/**/*.rb
* ee/lib/banzai/**/*.rb
* ee/lib/ee/**/*.rb
* ee/lib/elasticsearch/**/*.rb
* ee/lib/generators/**/*.rb

Also enables frozen string in some vestigial
files of the ee/app directory.

Partially addresses gitlab-org/gitlab-ce/#47424.
parent a0d4f2cb
# frozen_string_literal: true
class ParentGroupsFinder
attr_accessor :user, :group
......
# frozen_string_literal: true
module EE
module UserPreference
extend ActiveSupport::Concern
......
# frozen_string_literal: true
class GitlabSubscription < ActiveRecord::Base
belongs_to :namespace
belongs_to :hosted_plan, class_name: 'Plan'
......
# frozen_string_literal: true
module EE
module Projects
module CleanupService
......
# frozen_string_literal: true
class UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker
include ApplicationWorker
include CronjobQueue
......
---
title: Enable some frozen string in ee/lib
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module API
class EpicIssues < Grape::API
before do
......
# frozen_string_literal: true
module API
class Epics < Grape::API
before do
......
# frozen_string_literal: true
require 'base64'
module API
......
# frozen_string_literal: true
module API
class GeoNodes < Grape::API
include PaginationParams
......
# frozen_string_literal: true
# Simplified version of Github API entities.
# It's mainly used to mimic Github API and integrate with Jira Development Panel.
#
......
# frozen_string_literal: true
module API
class IssueLinks < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Ldap < Grape::API
# Admin users by default should be able to access these API endpoints.
......
# frozen_string_literal: true
module API
class LdapGroupLinks < Grape::API
before { authenticate! }
......
# frozen_string_literal: true
module API
class License < Grape::API
before { authenticated_as_admin! }
......
# frozen_string_literal: true
module API
class MergeRequestApprovals < ::Grape::API
before { authenticate_non_get! }
......
# frozen_string_literal: true
module API
class ProjectApprovals < ::Grape::API
before { authenticate! }
......
# frozen_string_literal: true
require_dependency 'declarative_policy'
module API
......
# frozen_string_literal: true
module API
class ProjectPushRule < Grape::API
before { authenticate! }
......
# frozen_string_literal: true
module API
class Unleash < Grape::API
include PaginationParams
......
# frozen_string_literal: true
# These endpoints partially mimic Github API behavior in order to successfully
# integrate with Jira Development Panel.
# Endpoints returning an empty list were temporarily added to avoid 404's
......
# frozen_string_literal: true
module Audit
class Details
ACTIONS = %i[add remove failed_login change custom_message].freeze
......@@ -39,10 +41,12 @@ module Audit
end
def text_for_change(value)
"Changed #{value}".tap do |changed_string|
changed_string << " from #{@details[:from]}" if @details[:from]
changed_string << " to #{@details[:to]}" if @details[:to]
end
changed = ["Changed #{value}"]
changed << "from #{@details[:from]}" if @details[:from]
changed << "to #{@details[:to]}" if @details[:to]
changed.join(' ')
end
end
end
# frozen_string_literal: true
module Banzai
module Filter
# HTML filter that removes sensitive information from cross project
......
# frozen_string_literal: true
module Banzai
module ReferenceParser
module EE
......
# frozen_string_literal: true
# Generates CSV when given a collection and a mapping.
#
# Example:
......
# frozen_string_literal: true
module Delay
# Progressive backoff. It's copied from Sidekiq as is
def delay(retry_count = 0)
......
# frozen_string_literal: true
module EE
SUBSCRIPTIONS_URL = 'https://customers.gitlab.com'.freeze
SUBSCRIPTIONS_PLANS_URL = "#{SUBSCRIPTIONS_URL}/plans".freeze
......
# frozen_string_literal: true
module EE
module API
module APIGuard
......
# frozen_string_literal: true
module EE
module API
class Boards < ::Grape::API
......
# frozen_string_literal: true
module EE
module API
module BoardsResponses
......
# frozen_string_literal: true
module EE
module API
module Entities
......
# frozen_string_literal: true
module EE
module API
class GroupBoards < ::Grape::API
......
# frozen_string_literal: true
module EE
module API
module Helpers
......
# frozen_string_literal: true
module EE
module API
module Helpers
......
# frozen_string_literal: true
module EE
module API
module Helpers
......
# frozen_string_literal: true
module EE
module API
module Helpers
......
# frozen_string_literal: true
module EE
module API
module Issues
......
# frozen_string_literal: true
module EE
module API
module JobArtifacts
......
# frozen_string_literal: true
module EE
module API
module MergeRequests
......
# frozen_string_literal: true
module EE
module API
module Namespaces
......
# frozen_string_literal: true
module EE
module API
module Todos
......
# frozen_string_literal: true
module EE
module Audit
class BaseChangesAuditor
......
# frozen_string_literal: true
module EE
module Audit
module Changes
......
# frozen_string_literal: true
module EE
module Audit
class GroupChangesAuditor < BaseChangesAuditor
......
# frozen_string_literal: true
module EE
module Audit
class ProjectChangesAuditor < BaseChangesAuditor
......
# frozen_string_literal: true
module EE
module Banzai
module Filter
......
# frozen_string_literal: true
module EE
module Banzai
module Pipeline
......
# frozen_string_literal: true
module EE
module Banzai
module Pipeline
......
# frozen_string_literal: true
module EE
module Banzai
module Pipeline
......
# frozen_string_literal: true
module EE
module Banzai
module ReferenceParser
......
# frozen_string_literal: true
# Gitlab::Access module
#
# Define allowed roles that can be used
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
# LDAP connection adapter EE mixin
#
# This module is intended to encapsulate EE-specific adapter methods
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
require 'net/ldap/dn'
module EE
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
require 'net/ldap/dn'
module EE
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
# LDAP User EE mixin
#
# This module is intended to encapsulate EE-specific User methods
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......@@ -18,7 +20,7 @@ module EE
# does not normalize them as of version 0.3.0, so add the default
# realm ourselves if appropriate
if provider == 'kerberos' && ee_uid.present?
ee_uid += "@#{kerberos_default_realm}" unless ee_uid.include?('@')
ee_uid = "#{ee_uid}@#{kerberos_default_realm}" unless ee_uid.include?('@')
end
ee_uid
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Auth
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Ci
......
# frozen_string_literal: true
module EE
module Gitlab
module Database
......
# frozen_string_literal: true
module EE
module Gitlab
module EtagCaching
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
......
# frozen_string_literal: true
Excon.defaults[:ssl_verify_peer] = false
module EE
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
class Logger < ::Gitlab::Logger
def self.log_access(access, project_path)
status = access.has_access? ? "GRANTED" : "DENIED"
message = "#{status} #{access.user.email} access to '#{access.label}'"
message = ["#{status} #{access.user.email} access to '#{access.label}'"]
message << " (#{project_path})" if project_path.present?
message << " - #{access.load_type} #{access.loaded_at}" if access.load_type == :cache
message << "(#{project_path})" if project_path.present?
message << "- #{access.load_type} #{access.loaded_at}" if access.load_type == :cache
info(message)
info(message.join(' '))
end
def self.file_name_noext
......
# frozen_string_literal: true
module EE
module Gitlab
module ExternalAuthorization
......
# frozen_string_literal: true
module EE
module Gitlab
module GeoGitAccess
......@@ -50,7 +52,7 @@ module EE
message = super
if ::Gitlab::Geo.secondary_with_primary?
message += "\nPlease use the primary node URL instead: #{geo_primary_url_to_repo}.\nFor more information: #{GEO_SERVER_DOCS_URL}"
message = "#{message}\nPlease use the primary node URL instead: #{geo_primary_url_to_repo}.\nFor more information: #{GEO_SERVER_DOCS_URL}"
end
message
......
# frozen_string_literal: true
module EE
module Gitlab
module GitAccess
......
# frozen_string_literal: true
module EE
module Gitlab
module GitAccessWiki
......
# frozen_string_literal: true
module EE
module Gitlab
module GithubImport
......
# frozen_string_literal: true
module EE
module Gitlab
module ImportExport
......
# frozen_string_literal: true
module EE
module Gitlab
module ImportExport
......
# frozen_string_literal: true
module EE
module Gitlab
module ImportSources
......
# frozen_string_literal: true
module EE
module Gitlab
module Middleware
......
# frozen_string_literal: true
module EE
module Gitlab
module OmniauthInitializer
......
# frozen_string_literal: true
module EE
module Gitlab
module Prometheus
......
# frozen_string_literal: true
module EE
module Gitlab
module Prometheus
......
# frozen_string_literal: true
module EE
module Gitlab
module Rack
......
# frozen_string_literal: true
module EE
module Gitlab
module Regex
......
# frozen_string_literal: true
module EE
module Gitlab
module Search
......
# frozen_string_literal: true
module EE
module Gitlab
module ServiceDesk
......
# frozen_string_literal: true
module EE
module Gitlab
module SlashCommands
......
# frozen_string_literal: true
module EE
module Gitlab
module SlashCommands
......
# frozen_string_literal: true
module EE
module Gitlab
module TreeSummary
......
# frozen_string_literal: true
module EE
module LegacyModel
def table_name_prefix
......
# frozen_string_literal: true
module EE
module Model
def table_name_prefix
......
# frozen_string_literal: true
module EE
module Workers
# Geo specific code for cache re-generation
......
# frozen_string_literal: true
module Elasticsearch
module Git
end
......
# frozen_string_literal: true
module Elasticsearch
module Git
module EncoderHelper
......
# frozen_string_literal: true
module Elasticsearch
module Git
class LiteBlob
......
# frozen_string_literal: true
module Elasticsearch
module Git
module Model
......
# frozen_string_literal: true
module Elasticsearch
module Git
module Repository
......
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/active_record'
require 'rails/generators/active_record/migration/migration_generator'
......
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