diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-07-17 19:50:37 +0300 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-07-18 01:19:40 +0300 |
commit | fbde83540449ddcf9cae6ac13d8e078695b100d4 (patch) | |
tree | 4c2e1c6af97b971aff577de5eb00b52eacdf357c /app/services/merge_requests | |
parent | 489025bbdd449948e67e305e53a638d1e81ecc84 (diff) |
Enable more frozen string in app/services/**/*.rb
Partially addresses #47424.
Diffstat (limited to 'app/services/merge_requests')
24 files changed, 54 insertions, 3 deletions
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 |