Commit 265478ad authored by gfyoung's avatar gfyoung

Enable frozen string in apps/services/**/*.rb

For directories application_settings --> labels.

Partially addresses #47424.
parent 7f0431dd
# frozen_string_literal: true
module ApplicationSettings module ApplicationSettings
class BaseService < ::BaseService class BaseService < ::BaseService
def initialize(application_setting, user, params = {}) def initialize(application_setting, user, params = {})
......
# frozen_string_literal: true
module ApplicationSettings module ApplicationSettings
class UpdateService < ApplicationSettings::BaseService class UpdateService < ApplicationSettings::BaseService
attr_reader :params, :application_setting attr_reader :params, :application_setting
......
# frozen_string_literal: true
module Applications module Applications
class CreateService class CreateService
def initialize(current_user, params) def initialize(current_user, params)
......
# frozen_string_literal: true
module Auth module Auth
class ContainerRegistryAuthenticationService < BaseService class ContainerRegistryAuthenticationService < BaseService
AUDIENCE = 'container_registry'.freeze AUDIENCE = 'container_registry'.freeze
......
# frozen_string_literal: true
module Badges module Badges
class BaseService class BaseService
protected protected
......
# frozen_string_literal: true
module Badges module Badges
class BuildService < Badges::BaseService class BuildService < Badges::BaseService
# returns the created badge # returns the created badge
......
# frozen_string_literal: true
module Badges module Badges
class CreateService < Badges::BaseService class CreateService < Badges::BaseService
# returns the created badge # returns the created badge
......
# frozen_string_literal: true
module Badges module Badges
class UpdateService < Badges::BaseService class UpdateService < Badges::BaseService
# returns the updated badge # returns the updated badge
......
# frozen_string_literal: true
module Boards module Boards
class BaseService < ::BaseService class BaseService < ::BaseService
# Parent can either a group or a project # Parent can either a group or a project
......
# frozen_string_literal: true
module Boards module Boards
class CreateService < Boards::BaseService class CreateService < Boards::BaseService
def execute def execute
......
# frozen_string_literal: true
module Boards module Boards
module Issues module Issues
class CreateService < Boards::BaseService class CreateService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Issues module Issues
class ListService < Boards::BaseService class ListService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Issues module Issues
class MoveService < Boards::BaseService class MoveService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
class ListService < Boards::BaseService class ListService < Boards::BaseService
def execute def execute
......
# frozen_string_literal: true
module Boards module Boards
module Lists module Lists
class CreateService < Boards::BaseService class CreateService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Lists module Lists
class DestroyService < Boards::BaseService class DestroyService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Lists module Lists
class GenerateService < Boards::BaseService class GenerateService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Lists module Lists
class ListService < Boards::BaseService class ListService < Boards::BaseService
......
# frozen_string_literal: true
module Boards module Boards
module Lists module Lists
class MoveService < Boards::BaseService class MoveService < Boards::BaseService
......
# frozen_string_literal: true
module ChatNames module ChatNames
class AuthorizeUserService class AuthorizeUserService
include Gitlab::Routing include Gitlab::Routing
......
# frozen_string_literal: true
module ChatNames module ChatNames
class FindUserService class FindUserService
def initialize(service, params) def initialize(service, params)
......
# frozen_string_literal: true
module Ci module Ci
class CreatePipelineScheduleService < BaseService class CreatePipelineScheduleService < BaseService
def execute def execute
......
# frozen_string_literal: true
module Ci module Ci
class CreatePipelineService < BaseService class CreatePipelineService < BaseService
attr_reader :pipeline attr_reader :pipeline
......
# frozen_string_literal: true
module Ci module Ci
## ##
# We call this service everytime we persist a CI/CD job. # We call this service everytime we persist a CI/CD job.
......
# frozen_string_literal: true
module Ci module Ci
class ExtractSectionsFromBuildTraceService < BaseService class ExtractSectionsFromBuildTraceService < BaseService
def execute(build) def execute(build)
......
# frozen_string_literal: true
## ##
# TODO: # TODO:
# Almost components in this class were copied from app/models/project_services/kubernetes_service.rb # Almost components in this class were copied from app/models/project_services/kubernetes_service.rb
......
# frozen_string_literal: true
module Ci module Ci
class PipelineTriggerService < BaseService class PipelineTriggerService < BaseService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module Ci module Ci
class PlayBuildService < ::BaseService class PlayBuildService < ::BaseService
def execute(build) def execute(build)
......
# frozen_string_literal: true
module Ci module Ci
class ProcessPipelineService < BaseService class ProcessPipelineService < BaseService
attr_reader :pipeline attr_reader :pipeline
......
# frozen_string_literal: true
module Ci module Ci
# This class responsible for assigning # This class responsible for assigning
# proper pending build to runner on runner API request # proper pending build to runner on runner API request
......
# frozen_string_literal: true
module Ci module Ci
class RetryBuildService < ::BaseService class RetryBuildService < ::BaseService
CLONE_ACCESSORS = %i[pipeline project ref tag options commands name CLONE_ACCESSORS = %i[pipeline project ref tag options commands name
......
# frozen_string_literal: true
module Ci module Ci
class RetryPipelineService < ::BaseService class RetryPipelineService < ::BaseService
include Gitlab::OptimisticLocking include Gitlab::OptimisticLocking
......
# frozen_string_literal: true
module Ci module Ci
class StopEnvironmentsService < BaseService class StopEnvironmentsService < BaseService
attr_reader :ref attr_reader :ref
......
# frozen_string_literal: true
module Ci module Ci
class UpdateBuildQueueService class UpdateBuildQueueService
def execute(build) def execute(build)
......
# frozen_string_literal: true
module Ci module Ci
class UpdateRunnerService class UpdateRunnerService
attr_reader :runner attr_reader :runner
......
# frozen_string_literal: true
module Clusters module Clusters
module Applications module Applications
class BaseHelmService class BaseHelmService
......
# frozen_string_literal: true
module Clusters module Clusters
module Applications module Applications
class CheckIngressIpAddressService < BaseHelmService class CheckIngressIpAddressService < BaseHelmService
......
# frozen_string_literal: true
module Clusters module Clusters
module Applications module Applications
class CheckInstallationProgressService < BaseHelmService class CheckInstallationProgressService < BaseHelmService
......
# frozen_string_literal: true
module Clusters module Clusters
module Applications module Applications
class InstallService < BaseHelmService class InstallService < BaseHelmService
......
# frozen_string_literal: true
module Clusters module Clusters
module Applications module Applications
class ScheduleInstallationService < ::BaseService class ScheduleInstallationService < ::BaseService
......
# frozen_string_literal: true
module Clusters module Clusters
class CreateService < BaseService class CreateService < BaseService
attr_reader :access_token attr_reader :access_token
......
# frozen_string_literal: true
module Clusters module Clusters
module Gcp module Gcp
class FetchOperationService class FetchOperationService
......
# frozen_string_literal: true
module Clusters module Clusters
module Gcp module Gcp
class FinalizeCreationService class FinalizeCreationService
......
# frozen_string_literal: true
module Clusters module Clusters
module Gcp module Gcp
class ProvisionService class ProvisionService
......
# frozen_string_literal: true
module Clusters module Clusters
module Gcp module Gcp
class VerifyProvisionStatusService class VerifyProvisionStatusService
......
# frozen_string_literal: true
module Clusters module Clusters
class UpdateService < BaseService class UpdateService < BaseService
def execute(cluster) def execute(cluster)
......
# frozen_string_literal: true
module Commits module Commits
class ChangeService < Commits::CreateService class ChangeService < Commits::CreateService
def initialize(*args) def initialize(*args)
......
# frozen_string_literal: true
module Commits module Commits
class CherryPickService < ChangeService class CherryPickService < ChangeService
def create_commit! def create_commit!
......
# frozen_string_literal: true
module Commits module Commits
class CreateService < ::BaseService class CreateService < ::BaseService
ValidationError = Class.new(StandardError) ValidationError = Class.new(StandardError)
......
# frozen_string_literal: true
module Commits module Commits
class RevertService < ChangeService class RevertService < ChangeService
def create_commit! def create_commit!
......
# frozen_string_literal: true
# #
# Concern that helps with getting an exclusive lease for running a block # Concern that helps with getting an exclusive lease for running a block
# of code. # of code.
......
# frozen_string_literal: true
module Issues module Issues
module ResolveDiscussions module ResolveDiscussions
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module UpdateVisibilityLevel module UpdateVisibilityLevel
def valid_visibility_level_change?(target, new_visibility) def valid_visibility_level_change?(target, new_visibility)
# check that user is allowed to set specified visibility_level # check that user is allowed to set specified visibility_level
......
# frozen_string_literal: true
module Users module Users
module NewUserNotifier module NewUserNotifier
def notify_new_user(user, reset_token) def notify_new_user(user, reset_token)
......
# frozen_string_literal: true
module Users module Users
module ParticipableService module ParticipableService
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module DeployKeys module DeployKeys
class CreateService < Keys::BaseService class CreateService < Keys::BaseService
def execute def execute
......
# frozen_string_literal: true
module DeployTokens module DeployTokens
class CreateService < BaseService class CreateService < BaseService
def execute def execute
......
# frozen_string_literal: true
module Discussions module Discussions
class BaseService < ::BaseService class BaseService < ::BaseService
end end
......
# frozen_string_literal: true
module Discussions module Discussions
class ResolveService < Discussions::BaseService class ResolveService < Discussions::BaseService
def execute(one_or_more_discussions) def execute(one_or_more_discussions)
......
# frozen_string_literal: true
module Discussions module Discussions
class UpdateDiffPositionService < BaseService class UpdateDiffPositionService < BaseService
def execute(discussion) def execute(discussion)
......
# frozen_string_literal: true
module Emails module Emails
class BaseService class BaseService
def initialize(current_user, params = {}) def initialize(current_user, params = {})
......
# frozen_string_literal: true
module Emails module Emails
class ConfirmService < ::Emails::BaseService class ConfirmService < ::Emails::BaseService
def execute(email) def execute(email)
......
# frozen_string_literal: true
module Emails module Emails
class CreateService < ::Emails::BaseService class CreateService < ::Emails::BaseService
def execute(extra_params = {}) def execute(extra_params = {})
......
# frozen_string_literal: true
module Emails module Emails
class DestroyService < ::Emails::BaseService class DestroyService < ::Emails::BaseService
def execute(email) def execute(email)
......
# frozen_string_literal: true
module Events module Events
class RenderService < BaseRenderer class RenderService < BaseRenderer
def execute(events, atom_request: false) def execute(events, atom_request: false)
......
# frozen_string_literal: true
module Files module Files
class BaseService < Commits::CreateService class BaseService < Commits::CreateService
FileChangedError = Class.new(StandardError) FileChangedError = Class.new(StandardError)
......
# frozen_string_literal: true
module Files module Files
class CreateDirService < Files::BaseService class CreateDirService < Files::BaseService
def create_commit! def create_commit!
......
# frozen_string_literal: true
module Files module Files
class CreateService < Files::BaseService class CreateService < Files::BaseService
def create_commit! def create_commit!
......
# frozen_string_literal: true
module Files module Files
class DeleteService < Files::BaseService class DeleteService < Files::BaseService
def create_commit! def create_commit!
......
# frozen_string_literal: true
module Files module Files
class MultiService < Files::BaseService class MultiService < Files::BaseService
UPDATE_FILE_ACTIONS = %w(update move delete).freeze UPDATE_FILE_ACTIONS = %w(update move delete).freeze
......
# frozen_string_literal: true
module Files module Files
class UpdateService < Files::BaseService class UpdateService < Files::BaseService
def create_commit! def create_commit!
......
# frozen_string_literal: true
module GpgKeys module GpgKeys
class CreateService < Keys::BaseService class CreateService < Keys::BaseService
def execute def execute
......
# frozen_string_literal: true
module Groups module Groups
class BaseService < ::BaseService class BaseService < ::BaseService
attr_accessor :group, :current_user, :params attr_accessor :group, :current_user, :params
......
# frozen_string_literal: true
module Groups module Groups
class CreateService < Groups::BaseService class CreateService < Groups::BaseService
def initialize(user, params = {}) def initialize(user, params = {})
......
# frozen_string_literal: true
module Groups module Groups
class DestroyService < Groups::BaseService class DestroyService < Groups::BaseService
def async_execute def async_execute
......
# frozen_string_literal: true
module Groups module Groups
class NestedCreateService < Groups::BaseService class NestedCreateService < Groups::BaseService
attr_reader :group_path, :visibility_level attr_reader :group_path, :visibility_level
......
# frozen_string_literal: true
module Groups module Groups
class TransferService < Groups::BaseService class TransferService < Groups::BaseService
ERROR_MESSAGES = { ERROR_MESSAGES = {
......
# frozen_string_literal: true
module Groups module Groups
class UpdateService < Groups::BaseService class UpdateService < Groups::BaseService
include UpdateVisibilityLevel include UpdateVisibilityLevel
......
# frozen_string_literal: true
module Issuable module Issuable
class BulkUpdateService < IssuableBaseService class BulkUpdateService < IssuableBaseService
def execute(type) def execute(type)
......
# frozen_string_literal: true
module Issuable module Issuable
class CommonSystemNotesService < ::BaseService class CommonSystemNotesService < ::BaseService
attr_reader :issuable attr_reader :issuable
......
# frozen_string_literal: true
module Issuable module Issuable
class DestroyService < IssuableBaseService class DestroyService < IssuableBaseService
def execute(issuable) def execute(issuable)
......
# frozen_string_literal: true
module Issues module Issues
class BaseService < ::IssuableBaseService class BaseService < ::IssuableBaseService
def hook_data(issue, action, old_associations: {}) def hook_data(issue, action, old_associations: {})
......
# frozen_string_literal: true
module Issues module Issues
class BuildService < Issues::BaseService class BuildService < Issues::BaseService
include ResolveDiscussions include ResolveDiscussions
...@@ -44,14 +46,14 @@ module Issues ...@@ -44,14 +46,14 @@ module Issues
other_note_count = discussion.notes.size - 1 other_note_count = discussion.notes.size - 1
discussion_info = "- [ ] #{first_note_to_resolve.author.to_reference} #{action} a [discussion](#{note_url}): " discussion_info = ["- [ ] #{first_note_to_resolve.author.to_reference} #{action} a [discussion](#{note_url}): "]
discussion_info << " (+#{other_note_count} #{'comment'.pluralize(other_note_count)})" if other_note_count > 0 discussion_info << "(+#{other_note_count} #{'comment'.pluralize(other_note_count)})" if other_note_count > 0
note_without_block_quotes = Banzai::Filter::BlockquoteFenceFilter.new(first_note_to_resolve.note).call note_without_block_quotes = Banzai::Filter::BlockquoteFenceFilter.new(first_note_to_resolve.note).call
spaces = ' ' * 4 spaces = ' ' * 4
quote = note_without_block_quotes.lines.map { |line| "#{spaces}> #{line}" }.join quote = note_without_block_quotes.lines.map { |line| "#{spaces}> #{line}" }.join
[discussion_info, quote].join("\n\n") [discussion_info.join(' '), quote].join("\n\n")
end end
def issue_params def issue_params
......
# frozen_string_literal: true
module Issues module Issues
class CloseService < Issues::BaseService class CloseService < Issues::BaseService
# Closes the supplied issue if the current user is able to do so. # Closes the supplied issue if the current user is able to do so.
......
# frozen_string_literal: true
module Issues module Issues
class CreateService < Issues::BaseService class CreateService < Issues::BaseService
include SpamCheckService include SpamCheckService
......
# frozen_string_literal: true
module Issues module Issues
class DuplicateService < Issues::BaseService class DuplicateService < Issues::BaseService
def execute(duplicate_issue, canonical_issue) def execute(duplicate_issue, canonical_issue)
......
# frozen_string_literal: true
module Issues module Issues
class FetchReferencedMergeRequestsService < Issues::BaseService class FetchReferencedMergeRequestsService < Issues::BaseService
def execute(issue) def execute(issue)
......
# frozen_string_literal: true
module Issues module Issues
class MoveService < Issues::BaseService class MoveService < Issues::BaseService
MoveError = Class.new(StandardError) MoveError = Class.new(StandardError)
......
# frozen_string_literal: true
module Issues module Issues
class ReopenService < Issues::BaseService class ReopenService < Issues::BaseService
def execute(issue) def execute(issue)
......
# frozen_string_literal: true
module Issues module Issues
class UpdateService < Issues::BaseService class UpdateService < Issues::BaseService
include SpamCheckService include SpamCheckService
......
# frozen_string_literal: true
module Keys module Keys
class BaseService class BaseService
attr_accessor :user, :params attr_accessor :user, :params
......
# frozen_string_literal: true
module Keys module Keys
class CreateService < ::Keys::BaseService class CreateService < ::Keys::BaseService
def execute def execute
......
# frozen_string_literal: true
module Keys module Keys
class DestroyService < ::Keys::BaseService class DestroyService < ::Keys::BaseService
def execute(key) def execute(key)
......
# frozen_string_literal: true
module Keys module Keys
class LastUsedService class LastUsedService
TIMEOUT = 1.day.to_i TIMEOUT = 1.day.to_i
......
# frozen_string_literal: true
module Labels module Labels
class BaseService < ::BaseService class BaseService < ::BaseService
COLOR_NAME_TO_HEX = { COLOR_NAME_TO_HEX = {
......
# frozen_string_literal: true
module Labels module Labels
class CreateService < Labels::BaseService class CreateService < Labels::BaseService
def initialize(params = {}) def initialize(params = {})
......
# frozen_string_literal: true
module Labels module Labels
class FindOrCreateService class FindOrCreateService
def initialize(current_user, parent, params = {}) def initialize(current_user, parent, params = {})
......
# frozen_string_literal: true
module Labels module Labels
class PromoteService < BaseService class PromoteService < BaseService
BATCH_SIZE = 1000 BATCH_SIZE = 1000
......
# frozen_string_literal: true
# Labels::TransferService class # Labels::TransferService class
# #
# User for recreate the missing group labels at project level # User for recreate the missing group labels at project level
......
# frozen_string_literal: true
module Labels module Labels
class UpdateService < Labels::BaseService class UpdateService < Labels::BaseService
def initialize(params = {}) def initialize(params = {})
......
---
title: Enable frozen string in app/services/**/*.rb
merge_request: 20656
author: gfyoung
type: performance
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