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