From fbde83540449ddcf9cae6ac13d8e078695b100d4 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Tue, 17 Jul 2018 09:50:37 -0700 Subject: [PATCH] Enable more frozen string in app/services/**/*.rb Partially addresses #47424. --- app/services/lfs/file_transformer.rb | 2 ++ app/services/lfs/lock_file_service.rb | 2 ++ app/services/lfs/locks_finder_service.rb | 2 ++ app/services/lfs/unlock_file_service.rb | 2 ++ app/services/mattermost/create_team_service.rb | 2 ++ .../members/approve_access_request_service.rb | 2 ++ app/services/members/base_service.rb | 2 ++ app/services/members/create_service.rb | 2 ++ app/services/members/destroy_service.rb | 2 ++ app/services/members/request_access_service.rb | 2 ++ app/services/members/update_service.rb | 2 ++ .../add_todo_when_build_fails_service.rb | 2 ++ app/services/merge_requests/assign_issues_service.rb | 2 ++ app/services/merge_requests/base_service.rb | 2 ++ app/services/merge_requests/build_service.rb | 11 ++++++++--- app/services/merge_requests/close_service.rb | 2 ++ app/services/merge_requests/conflicts/base_service.rb | 2 ++ app/services/merge_requests/conflicts/list_service.rb | 2 ++ .../merge_requests/conflicts/resolve_service.rb | 2 ++ .../merge_requests/create_from_issue_service.rb | 2 ++ app/services/merge_requests/create_service.rb | 2 ++ .../merge_requests/delete_non_latest_diffs_service.rb | 2 ++ app/services/merge_requests/ff_merge_service.rb | 2 ++ app/services/merge_requests/get_urls_service.rb | 2 ++ app/services/merge_requests/merge_service.rb | 2 ++ .../merge_when_pipeline_succeeds_service.rb | 2 ++ app/services/merge_requests/post_merge_service.rb | 2 ++ app/services/merge_requests/rebase_service.rb | 2 ++ app/services/merge_requests/refresh_service.rb | 2 ++ app/services/merge_requests/reload_diffs_service.rb | 2 ++ app/services/merge_requests/reopen_service.rb | 2 ++ .../resolved_discussion_notification_service.rb | 2 ++ app/services/merge_requests/squash_service.rb | 2 ++ app/services/merge_requests/update_service.rb | 2 ++ .../merge_requests/working_copy_base_service.rb | 2 ++ app/services/milestones/base_service.rb | 2 ++ app/services/milestones/close_service.rb | 2 ++ app/services/milestones/create_service.rb | 2 ++ app/services/milestones/destroy_service.rb | 2 ++ app/services/milestones/promote_service.rb | 2 ++ app/services/milestones/reopen_service.rb | 2 ++ app/services/milestones/update_service.rb | 2 ++ app/services/notes/build_service.rb | 2 ++ app/services/notes/create_service.rb | 2 ++ app/services/notes/destroy_service.rb | 2 ++ app/services/notes/post_process_service.rb | 2 ++ app/services/notes/quick_actions_service.rb | 2 ++ app/services/notes/render_service.rb | 2 ++ app/services/notes/resolve_service.rb | 2 ++ app/services/notes/update_service.rb | 2 ++ app/services/projects/after_import_service.rb | 2 ++ app/services/projects/autocomplete_service.rb | 2 ++ app/services/projects/base_move_relations_service.rb | 2 ++ app/services/projects/batch_count_service.rb | 2 ++ app/services/projects/batch_forks_count_service.rb | 2 ++ .../projects/batch_open_issues_count_service.rb | 2 ++ app/services/projects/count_service.rb | 2 ++ app/services/projects/create_from_template_service.rb | 2 ++ app/services/projects/create_service.rb | 2 ++ app/services/projects/destroy_service.rb | 2 ++ app/services/projects/download_service.rb | 2 ++ app/services/projects/enable_deploy_key_service.rb | 2 ++ app/services/projects/fork_service.rb | 2 ++ app/services/projects/forks_count_service.rb | 2 ++ .../projects/gitlab_projects_import_service.rb | 2 ++ app/services/projects/group_links/create_service.rb | 2 ++ app/services/projects/group_links/destroy_service.rb | 2 ++ .../hashed_storage/migrate_attachments_service.rb | 2 ++ .../hashed_storage/migrate_repository_service.rb | 2 ++ .../projects/hashed_storage_migration_service.rb | 2 ++ app/services/projects/housekeeping_service.rb | 2 ++ app/services/projects/import_export/export_service.rb | 2 ++ app/services/projects/import_service.rb | 2 ++ .../lfs_pointers/lfs_download_link_list_service.rb | 2 ++ .../projects/lfs_pointers/lfs_download_service.rb | 2 ++ .../projects/lfs_pointers/lfs_import_service.rb | 2 ++ .../projects/lfs_pointers/lfs_link_service.rb | 2 ++ .../projects/lfs_pointers/lfs_list_service.rb | 2 ++ app/services/projects/move_access_service.rb | 2 ++ .../projects/move_deploy_keys_projects_service.rb | 2 ++ app/services/projects/move_forks_service.rb | 2 ++ .../projects/move_lfs_objects_projects_service.rb | 2 ++ .../projects/move_notification_settings_service.rb | 2 ++ .../projects/move_project_authorizations_service.rb | 2 ++ .../projects/move_project_group_links_service.rb | 2 ++ app/services/projects/move_project_members_service.rb | 2 ++ .../projects/move_users_star_projects_service.rb | 2 ++ app/services/projects/open_issues_count_service.rb | 2 ++ .../projects/open_merge_requests_count_service.rb | 2 ++ app/services/projects/overwrite_project_service.rb | 2 ++ app/services/projects/participants_service.rb | 2 ++ app/services/projects/propagate_service_template.rb | 2 ++ app/services/projects/transfer_service.rb | 2 ++ app/services/projects/unlink_fork_service.rb | 2 ++ .../projects/update_pages_configuration_service.rb | 2 ++ app/services/projects/update_pages_service.rb | 2 ++ app/services/projects/update_remote_mirror_service.rb | 2 ++ app/services/projects/update_service.rb | 2 ++ .../frozen-string-enable-apps-services-inner-more.yml | 5 +++++ 99 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/frozen-string-enable-apps-services-inner-more.yml diff --git a/app/services/lfs/file_transformer.rb b/app/services/lfs/file_transformer.rb index 69281ee3137..c8eccb8e6cd 100644 --- a/app/services/lfs/file_transformer.rb +++ b/app/services/lfs/file_transformer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Lfs # Usage: Calling `new_file` check to see if a file should be in LFS and # return a transformed result with `content` and `encoding` to commit. diff --git a/app/services/lfs/lock_file_service.rb b/app/services/lfs/lock_file_service.rb index bbe10f84ef4..78434909d68 100644 --- a/app/services/lfs/lock_file_service.rb +++ b/app/services/lfs/lock_file_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Lfs class LockFileService < BaseService def execute diff --git a/app/services/lfs/locks_finder_service.rb b/app/services/lfs/locks_finder_service.rb index 13c6cc6f81c..d52cf0e3cc4 100644 --- a/app/services/lfs/locks_finder_service.rb +++ b/app/services/lfs/locks_finder_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Lfs class LocksFinderService < BaseService def execute diff --git a/app/services/lfs/unlock_file_service.rb b/app/services/lfs/unlock_file_service.rb index 7e3edf21d54..4d1443bf772 100644 --- a/app/services/lfs/unlock_file_service.rb +++ b/app/services/lfs/unlock_file_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Lfs class UnlockFileService < BaseService def execute diff --git a/app/services/mattermost/create_team_service.rb b/app/services/mattermost/create_team_service.rb index e3206810f3a..afcd6439a14 100644 --- a/app/services/mattermost/create_team_service.rb +++ b/app/services/mattermost/create_team_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Mattermost class CreateTeamService < ::BaseService def initialize(group, current_user) diff --git a/app/services/members/approve_access_request_service.rb b/app/services/members/approve_access_request_service.rb index 6be08b590bc..52b890d1821 100644 --- a/app/services/members/approve_access_request_service.rb +++ b/app/services/members/approve_access_request_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class ApproveAccessRequestService < Members::BaseService def execute(access_requester, skip_authorization: false, skip_log_audit_event: false) diff --git a/app/services/members/base_service.rb b/app/services/members/base_service.rb index 74556fb20cf..8248f1441d7 100644 --- a/app/services/members/base_service.rb +++ b/app/services/members/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class BaseService < ::BaseService # current_user - The user that performs the action diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index bc6a9405aac..714b8586737 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class CreateService < Members::BaseService DEFAULT_LIMIT = 100 diff --git a/app/services/members/destroy_service.rb b/app/services/members/destroy_service.rb index 5b51e1982f1..aca0ba66646 100644 --- a/app/services/members/destroy_service.rb +++ b/app/services/members/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class DestroyService < Members::BaseService def execute(member, skip_authorization: false) diff --git a/app/services/members/request_access_service.rb b/app/services/members/request_access_service.rb index 24293b30005..b9b0550e290 100644 --- a/app/services/members/request_access_service.rb +++ b/app/services/members/request_access_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class RequestAccessService < Members::BaseService def execute(source) diff --git a/app/services/members/update_service.rb b/app/services/members/update_service.rb index cb19cf01dd7..1f5618dae53 100644 --- a/app/services/members/update_service.rb +++ b/app/services/members/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Members class UpdateService < Members::BaseService # returns the updated member diff --git a/app/services/merge_requests/add_todo_when_build_fails_service.rb b/app/services/merge_requests/add_todo_when_build_fails_service.rb index 6805b2f7d1c..79c43b8e7d5 100644 --- a/app/services/merge_requests/add_todo_when_build_fails_service.rb +++ b/app/services/merge_requests/add_todo_when_build_fails_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class AddTodoWhenBuildFailsService < MergeRequests::BaseService # Adds a todo to the parent merge_request when a CI build fails diff --git a/app/services/merge_requests/assign_issues_service.rb b/app/services/merge_requests/assign_issues_service.rb index 8c6c4841020..e9107b9998e 100644 --- a/app/services/merge_requests/assign_issues_service.rb +++ b/app/services/merge_requests/assign_issues_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class AssignIssuesService < BaseService def assignable_issues diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 4c420b38258..e6dd0e12a3a 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class BaseService < ::IssuableBaseService def create_note(merge_request, state = merge_request.state) diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index a98bbdf74dd..bc988eb2a26 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class BuildService < MergeRequests::BaseService include Gitlab::Utils::StrongMemoize @@ -140,7 +142,8 @@ module MergeRequests closes_issue = "Closes #{issue.to_reference}" if description.present? - merge_request.description += closes_issue.prepend("\n\n") + descr_parts = [merge_request.description, closes_issue] + merge_request.description = descr_parts.join("\n\n") else merge_request.description = closes_issue end @@ -164,9 +167,11 @@ module MergeRequests return if merge_request.title.present? if issue_iid.present? - merge_request.title = "Resolve #{issue.to_reference}" + title_parts = ["Resolve #{issue.to_reference}"] branch_title = source_branch.downcase.remove(issue_iid.downcase).titleize.humanize - merge_request.title += " \"#{branch_title}\"" if branch_title.present? + + title_parts << "\"#{branch_title}\"" if branch_title.present? + merge_request.title = title_parts.join(' ') end end diff --git a/app/services/merge_requests/close_service.rb b/app/services/merge_requests/close_service.rb index db701c1145d..04527bb9713 100644 --- a/app/services/merge_requests/close_service.rb +++ b/app/services/merge_requests/close_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class CloseService < MergeRequests::BaseService def execute(merge_request, commit = nil) diff --git a/app/services/merge_requests/conflicts/base_service.rb b/app/services/merge_requests/conflicts/base_service.rb index b50875347d9..402f6c4e4c0 100644 --- a/app/services/merge_requests/conflicts/base_service.rb +++ b/app/services/merge_requests/conflicts/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests module Conflicts class BaseService diff --git a/app/services/merge_requests/conflicts/list_service.rb b/app/services/merge_requests/conflicts/list_service.rb index 72cbc49adb2..c6b3a6a1a69 100644 --- a/app/services/merge_requests/conflicts/list_service.rb +++ b/app/services/merge_requests/conflicts/list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests module Conflicts class ListService < MergeRequests::Conflicts::BaseService diff --git a/app/services/merge_requests/conflicts/resolve_service.rb b/app/services/merge_requests/conflicts/resolve_service.rb index 27cafd2d7d9..b9f734310be 100644 --- a/app/services/merge_requests/conflicts/resolve_service.rb +++ b/app/services/merge_requests/conflicts/resolve_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests module Conflicts class ResolveService < MergeRequests::Conflicts::BaseService diff --git a/app/services/merge_requests/create_from_issue_service.rb b/app/services/merge_requests/create_from_issue_service.rb index 3407b312700..fd91dc4acd0 100644 --- a/app/services/merge_requests/create_from_issue_service.rb +++ b/app/services/merge_requests/create_from_issue_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class CreateFromIssueService < MergeRequests::CreateService def initialize(project, user, params) diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb index fe1ac70781e..c36a2ecbfe3 100644 --- a/app/services/merge_requests/create_service.rb +++ b/app/services/merge_requests/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class CreateService < MergeRequests::BaseService def execute diff --git a/app/services/merge_requests/delete_non_latest_diffs_service.rb b/app/services/merge_requests/delete_non_latest_diffs_service.rb index 40079b21189..2a8ea316921 100644 --- a/app/services/merge_requests/delete_non_latest_diffs_service.rb +++ b/app/services/merge_requests/delete_non_latest_diffs_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class DeleteNonLatestDiffsService BATCH_SIZE = 10 diff --git a/app/services/merge_requests/ff_merge_service.rb b/app/services/merge_requests/ff_merge_service.rb index bffc09c34f0..479e0fe6699 100644 --- a/app/services/merge_requests/ff_merge_service.rb +++ b/app/services/merge_requests/ff_merge_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests # MergeService class # diff --git a/app/services/merge_requests/get_urls_service.rb b/app/services/merge_requests/get_urls_service.rb index 668a1741736..7c88c9abb41 100644 --- a/app/services/merge_requests/get_urls_service.rb +++ b/app/services/merge_requests/get_urls_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class GetUrlsService < BaseService attr_reader :project diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 3d587f97906..fb44f809c41 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests # MergeService class # diff --git a/app/services/merge_requests/merge_when_pipeline_succeeds_service.rb b/app/services/merge_requests/merge_when_pipeline_succeeds_service.rb index 9a4e6eb2e88..973e5b64e88 100644 --- a/app/services/merge_requests/merge_when_pipeline_succeeds_service.rb +++ b/app/services/merge_requests/merge_when_pipeline_succeeds_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class MergeWhenPipelineSucceedsService < MergeRequests::BaseService # Marks the passed `merge_request` to be merged when the pipeline succeeds or diff --git a/app/services/merge_requests/post_merge_service.rb b/app/services/merge_requests/post_merge_service.rb index 7606d68ff29..3d2aea4e9b6 100644 --- a/app/services/merge_requests/post_merge_service.rb +++ b/app/services/merge_requests/post_merge_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests # PostMergeService class # diff --git a/app/services/merge_requests/rebase_service.rb b/app/services/merge_requests/rebase_service.rb index c741e913860..31b3ebf311e 100644 --- a/app/services/merge_requests/rebase_service.rb +++ b/app/services/merge_requests/rebase_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class RebaseService < MergeRequests::WorkingCopyBaseService REBASE_ERROR = 'Rebase failed. Please rebase locally'.freeze diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 0127d781686..48da796505f 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class RefreshService < MergeRequests::BaseService def execute(oldrev, newrev, ref) diff --git a/app/services/merge_requests/reload_diffs_service.rb b/app/services/merge_requests/reload_diffs_service.rb index 2ec7b403903..8d85dc9eb5f 100644 --- a/app/services/merge_requests/reload_diffs_service.rb +++ b/app/services/merge_requests/reload_diffs_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class ReloadDiffsService def initialize(merge_request, current_user) diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb index 8f1c95ac1b7..f2fc13ad028 100644 --- a/app/services/merge_requests/reopen_service.rb +++ b/app/services/merge_requests/reopen_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class ReopenService < MergeRequests::BaseService def execute(merge_request) diff --git a/app/services/merge_requests/resolved_discussion_notification_service.rb b/app/services/merge_requests/resolved_discussion_notification_service.rb index 66a0cbc81d4..03ded1512f9 100644 --- a/app/services/merge_requests/resolved_discussion_notification_service.rb +++ b/app/services/merge_requests/resolved_discussion_notification_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class ResolvedDiscussionNotificationService < MergeRequests::BaseService def execute(merge_request) diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb index a40fb2786bd..a439a380255 100644 --- a/app/services/merge_requests/squash_service.rb +++ b/app/services/merge_requests/squash_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class SquashService < MergeRequests::WorkingCopyBaseService def execute(merge_request) diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index 7350725e223..b112edbce7f 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class UpdateService < MergeRequests::BaseService def execute(merge_request) diff --git a/app/services/merge_requests/working_copy_base_service.rb b/app/services/merge_requests/working_copy_base_service.rb index 186e05bf966..2d2be1f4c25 100644 --- a/app/services/merge_requests/working_copy_base_service.rb +++ b/app/services/merge_requests/working_copy_base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequests class WorkingCopyBaseService < MergeRequests::BaseService attr_reader :merge_request diff --git a/app/services/milestones/base_service.rb b/app/services/milestones/base_service.rb index cce0863d611..f30194c0bfe 100644 --- a/app/services/milestones/base_service.rb +++ b/app/services/milestones/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class BaseService < ::BaseService # Parent can either a group or a project diff --git a/app/services/milestones/close_service.rb b/app/services/milestones/close_service.rb index 5b06c4b601d..a252f5c144e 100644 --- a/app/services/milestones/close_service.rb +++ b/app/services/milestones/close_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class CloseService < Milestones::BaseService def execute(milestone) diff --git a/app/services/milestones/create_service.rb b/app/services/milestones/create_service.rb index ed2e833d833..6c3edd2e147 100644 --- a/app/services/milestones/create_service.rb +++ b/app/services/milestones/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class CreateService < Milestones::BaseService def execute diff --git a/app/services/milestones/destroy_service.rb b/app/services/milestones/destroy_service.rb index b18651476a8..15c04525075 100644 --- a/app/services/milestones/destroy_service.rb +++ b/app/services/milestones/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class DestroyService < Milestones::BaseService def execute(milestone) diff --git a/app/services/milestones/promote_service.rb b/app/services/milestones/promote_service.rb index 2187f26d1ed..37aa6d3a9bc 100644 --- a/app/services/milestones/promote_service.rb +++ b/app/services/milestones/promote_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class PromoteService < Milestones::BaseService PromoteMilestoneError = Class.new(StandardError) diff --git a/app/services/milestones/reopen_service.rb b/app/services/milestones/reopen_service.rb index 3efb33157c5..125a3ec1367 100644 --- a/app/services/milestones/reopen_service.rb +++ b/app/services/milestones/reopen_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class ReopenService < Milestones::BaseService def execute(milestone) diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb index 74edbf9b41d..81b20943bab 100644 --- a/app/services/milestones/update_service.rb +++ b/app/services/milestones/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Milestones class UpdateService < Milestones::BaseService def execute(milestone) diff --git a/app/services/notes/build_service.rb b/app/services/notes/build_service.rb index 77e7b8a5ea7..df5fe65de3c 100644 --- a/app/services/notes/build_service.rb +++ b/app/services/notes/build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class BuildService < ::BaseService def execute diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index 9ea28733f5f..049e6c5a871 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class CreateService < ::BaseService def execute diff --git a/app/services/notes/destroy_service.rb b/app/services/notes/destroy_service.rb index fb78420d324..64e9accd97f 100644 --- a/app/services/notes/destroy_service.rb +++ b/app/services/notes/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class DestroyService < BaseService def execute(note) diff --git a/app/services/notes/post_process_service.rb b/app/services/notes/post_process_service.rb index 199b8028dbc..48722cc2a79 100644 --- a/app/services/notes/post_process_service.rb +++ b/app/services/notes/post_process_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class PostProcessService attr_accessor :note diff --git a/app/services/notes/quick_actions_service.rb b/app/services/notes/quick_actions_service.rb index 0a33d5f3f3d..7280449bb1c 100644 --- a/app/services/notes/quick_actions_service.rb +++ b/app/services/notes/quick_actions_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class QuickActionsService < BaseService UPDATE_SERVICES = { diff --git a/app/services/notes/render_service.rb b/app/services/notes/render_service.rb index efc9d6da2aa..0e1a55ae2ff 100644 --- a/app/services/notes/render_service.rb +++ b/app/services/notes/render_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class RenderService < BaseRenderer # Renders a collection of Note instances. diff --git a/app/services/notes/resolve_service.rb b/app/services/notes/resolve_service.rb index 0db8ee809a9..cf24795f050 100644 --- a/app/services/notes/resolve_service.rb +++ b/app/services/notes/resolve_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class ResolveService < ::BaseService def execute(note) diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb index e16ef398184..35db409eb27 100644 --- a/app/services/notes/update_service.rb +++ b/app/services/notes/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Notes class UpdateService < BaseService def execute(note) diff --git a/app/services/projects/after_import_service.rb b/app/services/projects/after_import_service.rb index 3047268b2d1..bbdde4408d2 100644 --- a/app/services/projects/after_import_service.rb +++ b/app/services/projects/after_import_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class AfterImportService RESERVED_REF_PREFIXES = Repository::RESERVED_REFS_NAMES.map { |n| File.join('refs', n, '/') } diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb index 9d0eaaf3152..10eb2cea4a2 100644 --- a/app/services/projects/autocomplete_service.rb +++ b/app/services/projects/autocomplete_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class AutocompleteService < BaseService def issues diff --git a/app/services/projects/base_move_relations_service.rb b/app/services/projects/base_move_relations_service.rb index e8fd3ef57e5..78cc2869b72 100644 --- a/app/services/projects/base_move_relations_service.rb +++ b/app/services/projects/base_move_relations_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class BaseMoveRelationsService < BaseService attr_reader :source_project diff --git a/app/services/projects/batch_count_service.rb b/app/services/projects/batch_count_service.rb index 178ebc5a143..aec3b32da89 100644 --- a/app/services/projects/batch_count_service.rb +++ b/app/services/projects/batch_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Service class for getting and caching the number of elements of several projects # Warning: do not user this service with a really large set of projects # because the service use maps to retrieve the project ids. diff --git a/app/services/projects/batch_forks_count_service.rb b/app/services/projects/batch_forks_count_service.rb index e61fe6c86b2..9bf369df999 100644 --- a/app/services/projects/batch_forks_count_service.rb +++ b/app/services/projects/batch_forks_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Service class for getting and caching the number of forks of several projects # Warning: do not user this service with a really large set of projects # because the service use maps to retrieve the project ids diff --git a/app/services/projects/batch_open_issues_count_service.rb b/app/services/projects/batch_open_issues_count_service.rb index 3b0ade2419b..d375fcf9dbd 100644 --- a/app/services/projects/batch_open_issues_count_service.rb +++ b/app/services/projects/batch_open_issues_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Service class for getting and caching the number of issues of several projects # Warning: do not user this service with a really large set of projects # because the service use maps to retrieve the project ids diff --git a/app/services/projects/count_service.rb b/app/services/projects/count_service.rb index 4c8e000928f..3cee80c7bbc 100644 --- a/app/services/projects/count_service.rb +++ b/app/services/projects/count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects # Base class for the various service classes that count project data (e.g. # issues or forks). diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 29b133cc466..f5c48e56880 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class CreateFromTemplateService < BaseService def initialize(user, params) diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 85491089d8e..02a3a3eb096 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class CreateService < BaseService def initialize(user, params) diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 87173cc79ec..46a8a5e4d98 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class DestroyService < BaseService include Gitlab::ShellAdapter diff --git a/app/services/projects/download_service.rb b/app/services/projects/download_service.rb index 604747e39d0..dd297c9ba43 100644 --- a/app/services/projects/download_service.rb +++ b/app/services/projects/download_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class DownloadService < BaseService WHITELIST = [ diff --git a/app/services/projects/enable_deploy_key_service.rb b/app/services/projects/enable_deploy_key_service.rb index 121385afca3..b7c172028e9 100644 --- a/app/services/projects/enable_deploy_key_service.rb +++ b/app/services/projects/enable_deploy_key_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class EnableDeployKeyService < BaseService def execute diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb index a8aafa9fb4f..33ad2120a75 100644 --- a/app/services/projects/fork_service.rb +++ b/app/services/projects/fork_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class ForkService < BaseService def execute(fork_to_project = nil) diff --git a/app/services/projects/forks_count_service.rb b/app/services/projects/forks_count_service.rb index dc6eb19affd..b570c6d4754 100644 --- a/app/services/projects/forks_count_service.rb +++ b/app/services/projects/forks_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects # Service class for getting and caching the number of forks of a project. class ForksCountService < Projects::CountService diff --git a/app/services/projects/gitlab_projects_import_service.rb b/app/services/projects/gitlab_projects_import_service.rb index a16268f4fd2..bc6e9caebb8 100644 --- a/app/services/projects/gitlab_projects_import_service.rb +++ b/app/services/projects/gitlab_projects_import_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This service is an adapter used to for the GitLab Import feature, and # creating a project from a template. # The latter will under the hood just import an archive supplied by GitLab. diff --git a/app/services/projects/group_links/create_service.rb b/app/services/projects/group_links/create_service.rb index 35624577024..1392775f805 100644 --- a/app/services/projects/group_links/create_service.rb +++ b/app/services/projects/group_links/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects module GroupLinks class CreateService < BaseService diff --git a/app/services/projects/group_links/destroy_service.rb b/app/services/projects/group_links/destroy_service.rb index e3a20b4c1e4..8aefad048ce 100644 --- a/app/services/projects/group_links/destroy_service.rb +++ b/app/services/projects/group_links/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects module GroupLinks class DestroyService < BaseService diff --git a/app/services/projects/hashed_storage/migrate_attachments_service.rb b/app/services/projects/hashed_storage/migrate_attachments_service.rb index bc897d891d5..649c916a593 100644 --- a/app/services/projects/hashed_storage/migrate_attachments_service.rb +++ b/app/services/projects/hashed_storage/migrate_attachments_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects module HashedStorage AttachmentMigrationError = Class.new(StandardError) diff --git a/app/services/projects/hashed_storage/migrate_repository_service.rb b/app/services/projects/hashed_storage/migrate_repository_service.rb index 68c1af2396b..70f00b7fdeb 100644 --- a/app/services/projects/hashed_storage/migrate_repository_service.rb +++ b/app/services/projects/hashed_storage/migrate_repository_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects module HashedStorage class MigrateRepositoryService < BaseService diff --git a/app/services/projects/hashed_storage_migration_service.rb b/app/services/projects/hashed_storage_migration_service.rb index 662702c1db5..1828c99a65e 100644 --- a/app/services/projects/hashed_storage_migration_service.rb +++ b/app/services/projects/hashed_storage_migration_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class HashedStorageMigrationService < BaseService attr_reader :logger diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb index 120d57a188d..2f6dc4207dd 100644 --- a/app/services/projects/housekeeping_service.rb +++ b/app/services/projects/housekeeping_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Projects::HousekeepingService class # # Used for git housekeeping diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index 7bf0b90b491..e3491282a8a 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects module ImportExport class ExportService < BaseService diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 1781a01cbd4..60f400edfce 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class ImportService < BaseService include Gitlab::ShellAdapter diff --git a/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb b/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb index d9fb74b090e..a837ea82e38 100644 --- a/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb +++ b/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This service lists the download link from a remote source based on the # oids provided module Projects diff --git a/app/services/projects/lfs_pointers/lfs_download_service.rb b/app/services/projects/lfs_pointers/lfs_download_service.rb index 618c30b971f..7d4fa4e08df 100644 --- a/app/services/projects/lfs_pointers/lfs_download_service.rb +++ b/app/services/projects/lfs_pointers/lfs_download_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This service downloads and links lfs objects from a remote URL module Projects module LfsPointers diff --git a/app/services/projects/lfs_pointers/lfs_import_service.rb b/app/services/projects/lfs_pointers/lfs_import_service.rb index b6b0dec142f..97ce681a911 100644 --- a/app/services/projects/lfs_pointers/lfs_import_service.rb +++ b/app/services/projects/lfs_pointers/lfs_import_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This service manages the whole worflow of discovering the Lfs files in a # repository, linking them to the project and downloading (and linking) the non # existent ones. diff --git a/app/services/projects/lfs_pointers/lfs_link_service.rb b/app/services/projects/lfs_pointers/lfs_link_service.rb index d20bdf86c58..a2eba8e124e 100644 --- a/app/services/projects/lfs_pointers/lfs_link_service.rb +++ b/app/services/projects/lfs_pointers/lfs_link_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Given a list of oids, this services links the existent Lfs Objects to the project module Projects module LfsPointers diff --git a/app/services/projects/lfs_pointers/lfs_list_service.rb b/app/services/projects/lfs_pointers/lfs_list_service.rb index b770982cbc0..22160017f4f 100644 --- a/app/services/projects/lfs_pointers/lfs_list_service.rb +++ b/app/services/projects/lfs_pointers/lfs_list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This service list all existent Lfs objects in a repository module Projects module LfsPointers diff --git a/app/services/projects/move_access_service.rb b/app/services/projects/move_access_service.rb index 3af3a22d486..8e2c3ad2f69 100644 --- a/app/services/projects/move_access_service.rb +++ b/app/services/projects/move_access_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveAccessService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/move_deploy_keys_projects_service.rb b/app/services/projects/move_deploy_keys_projects_service.rb index dde420655b0..40a22837eaf 100644 --- a/app/services/projects/move_deploy_keys_projects_service.rb +++ b/app/services/projects/move_deploy_keys_projects_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveDeployKeysProjectsService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/move_forks_service.rb b/app/services/projects/move_forks_service.rb index d2901ea1457..076a7a50aa9 100644 --- a/app/services/projects/move_forks_service.rb +++ b/app/services/projects/move_forks_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveForksService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/move_lfs_objects_projects_service.rb b/app/services/projects/move_lfs_objects_projects_service.rb index 298da5f1a82..a5099519594 100644 --- a/app/services/projects/move_lfs_objects_projects_service.rb +++ b/app/services/projects/move_lfs_objects_projects_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveLfsObjectsProjectsService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/move_notification_settings_service.rb b/app/services/projects/move_notification_settings_service.rb index f7be461a5da..746605d56f1 100644 --- a/app/services/projects/move_notification_settings_service.rb +++ b/app/services/projects/move_notification_settings_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveNotificationSettingsService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/move_project_authorizations_service.rb b/app/services/projects/move_project_authorizations_service.rb index 5ef12fc49e5..60f2af88e99 100644 --- a/app/services/projects/move_project_authorizations_service.rb +++ b/app/services/projects/move_project_authorizations_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # NOTE: This service cannot be used directly because it is part of a # a bigger process. Instead, use the service MoveAccessService which moves # project memberships, project group links, authorizations and refreshes diff --git a/app/services/projects/move_project_group_links_service.rb b/app/services/projects/move_project_group_links_service.rb index dbeffd7dae9..d9038030f7e 100644 --- a/app/services/projects/move_project_group_links_service.rb +++ b/app/services/projects/move_project_group_links_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # NOTE: This service cannot be used directly because it is part of a # a bigger process. Instead, use the service MoveAccessService which moves # project memberships, project group links, authorizations and refreshes diff --git a/app/services/projects/move_project_members_service.rb b/app/services/projects/move_project_members_service.rb index 22a5f0a3fe6..bb0c0d10242 100644 --- a/app/services/projects/move_project_members_service.rb +++ b/app/services/projects/move_project_members_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # NOTE: This service cannot be used directly because it is part of a # a bigger process. Instead, use the service MoveAccessService which moves # project memberships, project group links, authorizations and refreshes diff --git a/app/services/projects/move_users_star_projects_service.rb b/app/services/projects/move_users_star_projects_service.rb index 079fd5b9685..20121d429e2 100644 --- a/app/services/projects/move_users_star_projects_service.rb +++ b/app/services/projects/move_users_star_projects_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class MoveUsersStarProjectsService < BaseMoveRelationsService def execute(source_project, remove_remaining_elements: true) diff --git a/app/services/projects/open_issues_count_service.rb b/app/services/projects/open_issues_count_service.rb index 78b1477186a..5d6620c3c54 100644 --- a/app/services/projects/open_issues_count_service.rb +++ b/app/services/projects/open_issues_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects # Service class for counting and caching the number of open issues of a # project. diff --git a/app/services/projects/open_merge_requests_count_service.rb b/app/services/projects/open_merge_requests_count_service.rb index 77e6448fd5e..76ec13952ab 100644 --- a/app/services/projects/open_merge_requests_count_service.rb +++ b/app/services/projects/open_merge_requests_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects # Service class for counting and caching the number of open merge requests of # a project. diff --git a/app/services/projects/overwrite_project_service.rb b/app/services/projects/overwrite_project_service.rb index ce94f147aa9..696e1b665b2 100644 --- a/app/services/projects/overwrite_project_service.rb +++ b/app/services/projects/overwrite_project_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class OverwriteProjectService < BaseService def execute(source_project) diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb index 21741913385..7080f388e53 100644 --- a/app/services/projects/participants_service.rb +++ b/app/services/projects/participants_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class ParticipantsService < BaseService include Users::ParticipableService diff --git a/app/services/projects/propagate_service_template.rb b/app/services/projects/propagate_service_template.rb index a8ef2108492..fdfa91801ab 100644 --- a/app/services/projects/propagate_service_template.rb +++ b/app/services/projects/propagate_service_template.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class PropagateServiceTemplate BATCH_SIZE = 100 diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 61acdd58021..a4a66330546 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Projects::TransferService class # # Used for transfer project to another namespace diff --git a/app/services/projects/unlink_fork_service.rb b/app/services/projects/unlink_fork_service.rb index 842fe4e09c4..2c0d91fe34f 100644 --- a/app/services/projects/unlink_fork_service.rb +++ b/app/services/projects/unlink_fork_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class UnlinkForkService < BaseService def execute diff --git a/app/services/projects/update_pages_configuration_service.rb b/app/services/projects/update_pages_configuration_service.rb index 25017c5cbe3..efbd4c7b323 100644 --- a/app/services/projects/update_pages_configuration_service.rb +++ b/app/services/projects/update_pages_configuration_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class UpdatePagesConfigurationService < BaseService attr_reader :project diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index 1d8caec9c6f..eb2478be3cf 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class UpdatePagesService < BaseService InvalidStateError = Class.new(StandardError) diff --git a/app/services/projects/update_remote_mirror_service.rb b/app/services/projects/update_remote_mirror_service.rb index 8183a2f26d7..4651f7c4f8f 100644 --- a/app/services/projects/update_remote_mirror_service.rb +++ b/app/services/projects/update_remote_mirror_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class UpdateRemoteMirrorService < BaseService attr_reader :errors diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index f4fbaacc08b..d3dc11435fe 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Projects class UpdateService < BaseService include UpdateVisibilityLevel diff --git a/changelogs/unreleased/frozen-string-enable-apps-services-inner-more.yml b/changelogs/unreleased/frozen-string-enable-apps-services-inner-more.yml new file mode 100644 index 00000000000..ea962cf8edc --- /dev/null +++ b/changelogs/unreleased/frozen-string-enable-apps-services-inner-more.yml @@ -0,0 +1,5 @@ +--- +title: Enable more frozen string in app/services/**/*.rb +merge_request: 20677 +author: gfyoung +type: performance