summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/access_token_validation_service.rb2
-rw-r--r--app/services/after_branch_delete_service.rb2
-rw-r--r--app/services/akismet_service.rb2
-rw-r--r--app/services/audit_event_service.rb2
-rw-r--r--app/services/base_count_service.rb2
-rw-r--r--app/services/base_renderer.rb2
-rw-r--r--app/services/base_service.rb2
-rw-r--r--app/services/cohorts_service.rb2
-rw-r--r--app/services/compare_service.rb2
-rw-r--r--app/services/create_branch_service.rb2
-rw-r--r--app/services/create_deployment_service.rb2
-rw-r--r--app/services/create_release_service.rb2
-rw-r--r--app/services/create_snippet_service.rb2
-rw-r--r--app/services/delete_branch_service.rb2
-rw-r--r--app/services/delete_merged_branches_service.rb2
-rw-r--r--app/services/event_create_service.rb2
-rw-r--r--app/services/git_push_service.rb2
-rw-r--r--app/services/git_tag_push_service.rb2
-rw-r--r--app/services/gravatar_service.rb2
-rw-r--r--app/services/ham_service.rb2
-rw-r--r--app/services/import_export_clean_up_service.rb2
-rw-r--r--app/services/issuable_base_service.rb2
-rw-r--r--app/services/merge_request_metrics_service.rb2
-rw-r--r--app/services/metrics_service.rb2
-rw-r--r--app/services/note_summary.rb2
-rw-r--r--app/services/notification_recipient_service.rb2
-rw-r--r--app/services/notification_service.rb2
-rw-r--r--app/services/preview_markdown_service.rb2
-rw-r--r--app/services/push_event_payload_service.rb2
-rw-r--r--app/services/repair_ldap_blocked_user_service.rb2
-rw-r--r--app/services/repository_archive_clean_up_service.rb2
-rw-r--r--app/services/reset_project_cache_service.rb2
-rw-r--r--app/services/search_service.rb2
-rw-r--r--app/services/spam_check_service.rb2
-rw-r--r--app/services/spam_service.rb2
-rw-r--r--app/services/submit_usage_ping_service.rb2
-rw-r--r--app/services/system_hooks_service.rb2
-rw-r--r--app/services/system_note_service.rb35
-rw-r--r--app/services/todo_service.rb2
-rw-r--r--app/services/update_release_service.rb2
-rw-r--r--app/services/update_snippet_service.rb2
-rw-r--r--app/services/upload_service.rb2
-rw-r--r--app/services/user_agent_detail_service.rb2
-rw-r--r--app/services/user_project_access_changed_service.rb2
-rw-r--r--app/services/validate_new_branch_service.rb2
-rw-r--r--app/services/verify_pages_domain_service.rb2
-rw-r--r--app/services/web_hook_service.rb2
47 files changed, 114 insertions, 13 deletions
diff --git a/app/services/access_token_validation_service.rb b/app/services/access_token_validation_service.rb
index 46e19230328..2a337918d21 100644
--- a/app/services/access_token_validation_service.rb
+++ b/app/services/access_token_validation_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AccessTokenValidationService
# Results:
VALID = :valid
diff --git a/app/services/after_branch_delete_service.rb b/app/services/after_branch_delete_service.rb
index 227e9ea9c6d..e7eb74d3e7d 100644
--- a/app/services/after_branch_delete_service.rb
+++ b/app/services/after_branch_delete_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
##
# Branch can be deleted either by DeleteBranchService
# or by GitPushService.
diff --git a/app/services/akismet_service.rb b/app/services/akismet_service.rb
index 0521393dd27..82ae66ab0f5 100644
--- a/app/services/akismet_service.rb
+++ b/app/services/akismet_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AkismetService
attr_accessor :owner, :text, :options
diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb
index 5ad9a50687c..4c5e22bdd7e 100644
--- a/app/services/audit_event_service.rb
+++ b/app/services/audit_event_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AuditEventService
def initialize(author, entity, details = {})
@author, @entity, @details = author, entity, details
diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb
index 975e288301c..ad1647842b8 100644
--- a/app/services/base_count_service.rb
+++ b/app/services/base_count_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Base class for services that count a single resource such as the number of
# issues for a project.
class BaseCountService
diff --git a/app/services/base_renderer.rb b/app/services/base_renderer.rb
index d6e30bd7008..30a6e8c62dd 100644
--- a/app/services/base_renderer.rb
+++ b/app/services/base_renderer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class BaseRenderer
attr_reader :current_user
diff --git a/app/services/base_service.rb b/app/services/base_service.rb
index 3519b7c5e7d..3e968c8f707 100644
--- a/app/services/base_service.rb
+++ b/app/services/base_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class BaseService
include Gitlab::Allowable
diff --git a/app/services/cohorts_service.rb b/app/services/cohorts_service.rb
index 6781533af28..7a14e97f749 100644
--- a/app/services/cohorts_service.rb
+++ b/app/services/cohorts_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CohortsService
MONTHS_INCLUDED = 12
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
index 2a69a205629..3adf8a0c1a1 100644
--- a/app/services/compare_service.rb
+++ b/app/services/compare_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'securerandom'
# Compare 2 refs for one repo or between repositories
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index 9b1a4d960e2..65208b07e27 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateBranchService < BaseService
def execute(branch_name, ref)
create_master_branch if project.empty_repo?
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb
index 7e5a77fb056..bb3f605da28 100644
--- a/app/services/create_deployment_service.rb
+++ b/app/services/create_deployment_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateDeploymentService
attr_reader :job
diff --git a/app/services/create_release_service.rb b/app/services/create_release_service.rb
index 54ff1f74126..09c68390007 100644
--- a/app/services/create_release_service.rb
+++ b/app/services/create_release_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateReleaseService < BaseService
def execute(tag_name, release_description)
repository = project.repository
diff --git a/app/services/create_snippet_service.rb b/app/services/create_snippet_service.rb
index 40286dbf3bf..6f1fce4989e 100644
--- a/app/services/create_snippet_service.rb
+++ b/app/services/create_snippet_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateSnippetService < BaseService
include SpamCheckService
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb
index e1499dcee64..44252f7b0a6 100644
--- a/app/services/delete_branch_service.rb
+++ b/app/services/delete_branch_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DeleteBranchService < BaseService
def execute(branch_name)
repository = project.repository
diff --git a/app/services/delete_merged_branches_service.rb b/app/services/delete_merged_branches_service.rb
index c98d1e3c540..ff3e4783fe3 100644
--- a/app/services/delete_merged_branches_service.rb
+++ b/app/services/delete_merged_branches_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DeleteMergedBranchesService < BaseService
def async_execute
DeleteMergedBranchesWorker.perform_async(project.id, current_user.id)
diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb
index 44dc90b3462..e7464fd9d5f 100644
--- a/app/services/event_create_service.rb
+++ b/app/services/event_create_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# EventCreateService class
#
# Used for creating events feed on dashboard after certain user action
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index f3bfc53dcd3..29c8ce5fea3 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class GitPushService < BaseService
attr_accessor :push_data, :push_commits
include Gitlab::Access
diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb
index 9917a39b795..3ff2d1d107d 100644
--- a/app/services/git_tag_push_service.rb
+++ b/app/services/git_tag_push_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class GitTagPushService < BaseService
attr_accessor :push_data
diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb
index c6e52c3bb91..2a7a5dae291 100644
--- a/app/services/gravatar_service.rb
+++ b/app/services/gravatar_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class GravatarService
def execute(email, size = nil, scale = 2, username: nil)
return unless Gitlab::CurrentSettings.gravatar_enabled?
diff --git a/app/services/ham_service.rb b/app/services/ham_service.rb
index b0e1799b489..794eb34d9ca 100644
--- a/app/services/ham_service.rb
+++ b/app/services/ham_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class HamService
attr_accessor :spam_log
diff --git a/app/services/import_export_clean_up_service.rb b/app/services/import_export_clean_up_service.rb
index 3702c3742ef..e75a951944e 100644
--- a/app/services/import_export_clean_up_service.rb
+++ b/app/services/import_export_clean_up_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ImportExportCleanUpService
LAST_MODIFIED_TIME_IN_MINUTES = 1440
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb
index 5e06e0c61cf..7d60c65bb79 100644
--- a/app/services/issuable_base_service.rb
+++ b/app/services/issuable_base_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class IssuableBaseService < BaseService
private
diff --git a/app/services/merge_request_metrics_service.rb b/app/services/merge_request_metrics_service.rb
index 9248de14a53..4e88b77c855 100644
--- a/app/services/merge_request_metrics_service.rb
+++ b/app/services/merge_request_metrics_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MergeRequestMetricsService
delegate :update!, to: :@merge_request_metrics
diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb
index c237d2ae8c9..222a5c8c79c 100644
--- a/app/services/metrics_service.rb
+++ b/app/services/metrics_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'prometheus/client/formats/text'
class MetricsService
diff --git a/app/services/note_summary.rb b/app/services/note_summary.rb
index a6f6320d573..81f6f92f75c 100644
--- a/app/services/note_summary.rb
+++ b/app/services/note_summary.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class NoteSummary
attr_reader :note
attr_reader :metadata
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index d9834fd0ccc..4389fd89538 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#
# Used by NotificationService to determine who should receive notification
#
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index d7be9a925b5..4511c500fca 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# rubocop:disable GitlabSecurity/PublicSend
# NotificationService class
diff --git a/app/services/preview_markdown_service.rb b/app/services/preview_markdown_service.rb
index 6da4d9523cf..a15ee4911ef 100644
--- a/app/services/preview_markdown_service.rb
+++ b/app/services/preview_markdown_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class PreviewMarkdownService < BaseService
def execute
text, commands = explain_quick_actions(params[:text])
diff --git a/app/services/push_event_payload_service.rb b/app/services/push_event_payload_service.rb
index b0a389c85f9..bb1259787af 100644
--- a/app/services/push_event_payload_service.rb
+++ b/app/services/push_event_payload_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Service class for creating push event payloads as stored in the
# "push_event_payloads" table.
#
diff --git a/app/services/repair_ldap_blocked_user_service.rb b/app/services/repair_ldap_blocked_user_service.rb
index 863cef7ff61..6ed42054ac3 100644
--- a/app/services/repair_ldap_blocked_user_service.rb
+++ b/app/services/repair_ldap_blocked_user_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RepairLdapBlockedUserService
attr_accessor :user
diff --git a/app/services/repository_archive_clean_up_service.rb b/app/services/repository_archive_clean_up_service.rb
index ba7be4b3f89..99a9c834352 100644
--- a/app/services/repository_archive_clean_up_service.rb
+++ b/app/services/repository_archive_clean_up_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RepositoryArchiveCleanUpService
LAST_MODIFIED_TIME_IN_MINUTES = 120
diff --git a/app/services/reset_project_cache_service.rb b/app/services/reset_project_cache_service.rb
index a162a6eedb9..676d367a1c1 100644
--- a/app/services/reset_project_cache_service.rb
+++ b/app/services/reset_project_cache_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ResetProjectCacheService < BaseService
def execute
@project.increment!(:jobs_cache_index)
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index 1d4d03a8b7d..1b707d79b43 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SearchService
include Gitlab::Allowable
diff --git a/app/services/spam_check_service.rb b/app/services/spam_check_service.rb
index d4ade869777..895261925ba 100644
--- a/app/services/spam_check_service.rb
+++ b/app/services/spam_check_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# SpamCheckService
#
# Provide helper methods for checking if a given spammable object has
diff --git a/app/services/spam_service.rb b/app/services/spam_service.rb
index 73ea3018fbd..f2f133dae28 100644
--- a/app/services/spam_service.rb
+++ b/app/services/spam_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SpamService
attr_accessor :spammable, :request, :options
attr_reader :spam_log
diff --git a/app/services/submit_usage_ping_service.rb b/app/services/submit_usage_ping_service.rb
index ac029fad7ea..93c2e222963 100644
--- a/app/services/submit_usage_ping_service.rb
+++ b/app/services/submit_usage_ping_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SubmitUsagePingService
URL = 'https://version.gitlab.com/usage_data'.freeze
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index ba7946fd23c..bd3907cdf8e 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SystemHooksService
def execute_hooks_for(model, event)
data = build_event_data(model, event)
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 00bf5434b7f..77494295f14 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# SystemNoteService
#
# Used for creating system notes (e.g., when a user references a merge request
@@ -21,9 +23,11 @@ module SystemNoteService
total_count = new_commits.length + existing_commits.length
commits_text = "#{total_count} commit".pluralize(total_count)
- body = "added #{commits_text}\n\n"
- body << commits_list(noteable, new_commits, existing_commits, oldrev)
- body << "\n\n[Compare with previous version](#{diff_comparison_url(noteable, project, oldrev)})"
+ text_parts = ["added #{commits_text}"]
+ text_parts << commits_list(noteable, new_commits, existing_commits, oldrev)
+ text_parts << "[Compare with previous version](#{diff_comparison_url(noteable, project, oldrev)})"
+
+ body = text_parts.join("\n\n")
create_note(NoteSummary.new(noteable, project, author, body, action: 'commit', commit_count: total_count))
end
@@ -103,18 +107,19 @@ module SystemNoteService
added_labels = added_labels.map(&references).join(' ')
removed_labels = removed_labels.map(&references).join(' ')
- body = ''
+ text_parts = []
if added_labels.present?
- body << "added #{added_labels}"
- body << ' and ' if removed_labels.present?
+ text_parts << "added #{added_labels}"
+ text_parts << 'and' if removed_labels.present?
end
if removed_labels.present?
- body << "removed #{removed_labels}"
+ text_parts << "removed #{removed_labels}"
end
- body << ' ' << 'label'.pluralize(labels_count)
+ text_parts << 'label'.pluralize(labels_count)
+ body = text_parts.join(' ')
create_note(NoteSummary.new(noteable, project, author, body, action: 'label'))
end
@@ -188,8 +193,10 @@ module SystemNoteService
spent_at = noteable.spent_at
parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs)
action = time_spent > 0 ? 'added' : 'subtracted'
- body = "#{action} #{parsed_time} of time spent"
- body << " at #{spent_at}" if spent_at
+
+ text_parts = ["#{action} #{parsed_time} of time spent"]
+ text_parts << "at #{spent_at}" if spent_at
+ body = text_parts.join(' ')
end
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
@@ -268,17 +275,19 @@ module SystemNoteService
diff_refs = change_position.diff_refs
version_index = merge_request.merge_request_diffs.viewable.count
- body = "changed this line in"
+ text_parts = ["changed this line in"]
if version_params = merge_request.version_params_for(diff_refs)
line_code = change_position.line_code(project.repository)
url = url_helpers.diffs_project_merge_request_url(project, merge_request, version_params.merge(anchor: line_code))
- body << " [version #{version_index} of the diff](#{url})"
+ text_parts << "[version #{version_index} of the diff](#{url})"
else
- body << " version #{version_index} of the diff"
+ text_parts << "version #{version_index} of the diff"
end
+ body = text_parts.join(' ')
note_attributes = discussion.reply_attributes.merge(project: project, author: author, note: body)
+
note = Note.create(note_attributes.merge(system: true))
note.system_note_metadata = SystemNoteMetadata.new(action: 'outdated')
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index f91cd03bf5c..0bcd53c76a9 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# TodoService class
#
# Used for creating/updating todos after certain user actions
diff --git a/app/services/update_release_service.rb b/app/services/update_release_service.rb
index dc696e9c440..422ba668e35 100644
--- a/app/services/update_release_service.rb
+++ b/app/services/update_release_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UpdateReleaseService < BaseService
def execute(tag_name, release_description)
repository = project.repository
diff --git a/app/services/update_snippet_service.rb b/app/services/update_snippet_service.rb
index 358bca73aec..15bc1046a4e 100644
--- a/app/services/update_snippet_service.rb
+++ b/app/services/update_snippet_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UpdateSnippetService < BaseService
include SpamCheckService
diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb
index 8e20512cd61..39909ee4f82 100644
--- a/app/services/upload_service.rb
+++ b/app/services/upload_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UploadService
def initialize(model, file, uploader_class = FileUploader, **uploader_context)
@model, @file, @uploader_class, @uploader_context = model, file, uploader_class, uploader_context
diff --git a/app/services/user_agent_detail_service.rb b/app/services/user_agent_detail_service.rb
index a1ee3df5fe1..5cb42e879a0 100644
--- a/app/services/user_agent_detail_service.rb
+++ b/app/services/user_agent_detail_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UserAgentDetailService
attr_accessor :spammable, :request
diff --git a/app/services/user_project_access_changed_service.rb b/app/services/user_project_access_changed_service.rb
index 8630e572624..adca43660e8 100644
--- a/app/services/user_project_access_changed_service.rb
+++ b/app/services/user_project_access_changed_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UserProjectAccessChangedService
def initialize(user_ids)
@user_ids = Array.wrap(user_ids)
diff --git a/app/services/validate_new_branch_service.rb b/app/services/validate_new_branch_service.rb
index 643f2ce1481..c19e2ec2043 100644
--- a/app/services/validate_new_branch_service.rb
+++ b/app/services/validate_new_branch_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative 'base_service'
class ValidateNewBranchService < BaseService
diff --git a/app/services/verify_pages_domain_service.rb b/app/services/verify_pages_domain_service.rb
index 13cb53dee01..07f7391f877 100644
--- a/app/services/verify_pages_domain_service.rb
+++ b/app/services/verify_pages_domain_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'resolv'
class VerifyPagesDomainService < BaseService
diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb
index 8a86e47f0ea..34724e0250d 100644
--- a/app/services/web_hook_service.rb
+++ b/app/services/web_hook_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class WebHookService
class InternalErrorResponse
attr_reader :body, :headers, :code