Commit 32af384a authored by gfyoung's avatar gfyoung

Enable frozen string in rest of app/models/**/*.rb

Partially addresses #47424.
parent ce2f1ec8
# frozen_string_literal: true
class ProgrammingLanguage < ActiveRecord::Base
validates :name, presence: true
validates :color, allow_blank: false, color: true
......
# frozen_string_literal: true
require 'asana'
class AsanaService < Service
......
# frozen_string_literal: true
class AssemblaService < Service
prop_accessor :token, :subdomain
validates :token, presence: true, if: :activated?
......
# frozen_string_literal: true
class BambooService < CiService
include ReactiveService
......
# frozen_string_literal: true
class BugzillaService < IssueTrackerService
validates :project_url, :issues_url, :new_issue_url, presence: true, public_url: true, if: :activated?
......
# frozen_string_literal: true
require "addressable/uri"
class BuildkiteService < CiService
......
# frozen_string_literal: true
# This class is to be removed with 9.1
# We should also by then remove BuildsEmailService from database
class BuildsEmailService < Service
......
# frozen_string_literal: true
class CampfireService < Service
prop_accessor :token, :subdomain, :room
validates :token, presence: true, if: :activated?
......@@ -82,7 +84,7 @@ class CampfireService < Service
before = push[:before]
after = push[:after]
message = ""
message = []
message << "[#{project.full_name}] "
message << "#{push[:user_name]} "
......@@ -95,6 +97,6 @@ class CampfireService < Service
message << "#{project.web_url}/compare/#{before}...#{after}"
end
message
message.join
end
end
# frozen_string_literal: true
require 'slack-notifier'
module ChatMessage
......
# frozen_string_literal: true
module ChatMessage
class IssueMessage < BaseMessage
attr_reader :title
......
# frozen_string_literal: true
module ChatMessage
class MergeMessage < BaseMessage
attr_reader :merge_request_iid
......
# frozen_string_literal: true
module ChatMessage
class NoteMessage < BaseMessage
attr_reader :note
......
# frozen_string_literal: true
module ChatMessage
class PipelineMessage < BaseMessage
attr_reader :ref_type
......
# frozen_string_literal: true
module ChatMessage
class PushMessage < BaseMessage
attr_reader :after
......
# frozen_string_literal: true
module ChatMessage
class WikiPageMessage < BaseMessage
attr_reader :title
......
# frozen_string_literal: true
# Base class for Chat notifications services
# This class is not meant to be used directly, but only to inherit from.
class ChatNotificationService < Service
......
# frozen_string_literal: true
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
......
# frozen_string_literal: true
class CustomIssueTrackerService < IssueTrackerService
validates :project_url, :issues_url, :new_issue_url, presence: true, public_url: true, if: :activated?
......
# frozen_string_literal: true
# Base class for deployment services
#
# These services integrate with a deployment solution like Kubernetes/OpenShift,
......
# frozen_string_literal: true
class DroneCiService < CiService
include ReactiveService
......
# frozen_string_literal: true
class EmailsOnPushService < Service
boolean_accessor :send_from_committer_email
boolean_accessor :disable_diffs
......
# frozen_string_literal: true
class ExternalWikiService < Service
prop_accessor :external_wiki_url
......
# frozen_string_literal: true
require "flowdock-git-hook"
# Flow dock depends on Grit to compute the number of commits between two given
......
# frozen_string_literal: true
require "gemnasium/gitlab_service"
class GemnasiumService < Service
......
# frozen_string_literal: true
class GitlabIssueTrackerService < IssueTrackerService
include Gitlab::Routing
......
# frozen_string_literal: true
require 'hangouts_chat'
class HangoutsChatService < ChatNotificationService
......
# frozen_string_literal: true
class HipchatService < Service
include ActionView::Helpers::SanitizeHelper
......@@ -108,7 +110,7 @@ class HipchatService < Service
before = push[:before]
after = push[:after]
message = ""
message = []
message << "#{push[:user_name]} "
if Gitlab::Git.blank_ref?(before)
......@@ -132,7 +134,7 @@ class HipchatService < Service
end
end
message
message.join
end
def markdown(text, options = {})
......@@ -165,11 +167,11 @@ class HipchatService < Service
description = obj_attr[:description]
issue_link = "<a href=\"#{issue_url}\">issue ##{issue_iid}</a>"
message = "#{user_name} #{state} #{issue_link} in #{project_link}: <b>#{title}</b>"
message = ["#{user_name} #{state} #{issue_link} in #{project_link}: <b>#{title}</b>"]
message << "<pre>#{markdown(description)}</pre>"
message
message.join
end
def create_merge_request_message(data)
......@@ -184,12 +186,11 @@ class HipchatService < Service
merge_request_url = "#{project_url}/merge_requests/#{merge_request_id}"
merge_request_link = "<a href=\"#{merge_request_url}\">merge request !#{merge_request_id}</a>"
message = "#{user_name} #{state} #{merge_request_link} in " \
"#{project_link}: <b>#{title}</b>"
message = ["#{user_name} #{state} #{merge_request_link} in " \
"#{project_link}: <b>#{title}</b>"]
message << "<pre>#{markdown(description)}</pre>"
message
message.join
end
def format_title(title)
......@@ -235,12 +236,11 @@ class HipchatService < Service
end
subject_html = "<a href=\"#{note_url}\">#{subject_type} #{subject_desc}</a>"
message = "#{user_name} commented on #{subject_html} in #{project_link}: "
message = ["#{user_name} commented on #{subject_html} in #{project_link}: "]
message << title
message << "<pre>#{markdown(note, ref: commit_id)}</pre>"
message
message.join
end
def create_pipeline_message(data)
......
# frozen_string_literal: true
require 'uri'
class IrkerService < Service
......
# frozen_string_literal: true
class IssueTrackerService < Service
validate :one_issue_tracker, if: :activated?, on: :manual_change
......
# frozen_string_literal: true
class JiraService < IssueTrackerService
include Gitlab::Routing
include ApplicationHelper
......
# frozen_string_literal: true
##
# NOTE:
# We'll move this class to Clusters::Platforms::Kubernetes, which contains exactly the same logic.
......
# frozen_string_literal: true
class MattermostService < ChatNotificationService
def title
'Mattermost notifications'
......
# frozen_string_literal: true
class MattermostSlashCommandsService < SlashCommandsService
include TriggersHelper
......
# frozen_string_literal: true
class MicrosoftTeamsService < ChatNotificationService
def title
'Microsoft Teams Notification'
......
# frozen_string_literal: true
# For an example companion mocking service, see https://gitlab.com/gitlab-org/gitlab-mock-ci-service
class MockCiService < CiService
ALLOWED_STATES = %w[failed canceled running pending success success_with_warnings skipped not_found].freeze
......
# frozen_string_literal: true
class MockDeploymentService < DeploymentService
def title
'Mock deployment'
......
# frozen_string_literal: true
class MockMonitoringService < MonitoringService
def title
'Mock monitoring'
......
# frozen_string_literal: true
# Base class for monitoring services
#
# These services integrate with a deployment solution like Prometheus
......
# frozen_string_literal: true
class PackagistService < Service
prop_accessor :username, :token, :server
......
# frozen_string_literal: true
class PipelinesEmailService < Service
prop_accessor :recipients
boolean_accessor :notify_only_broken_pipelines
......
# frozen_string_literal: true
class PivotaltrackerService < Service
API_ENDPOINT = 'https://www.pivotaltracker.com/services/v5/source_commits'.freeze
......
# frozen_string_literal: true
class PrometheusService < MonitoringService
include PrometheusAdapter
......
# frozen_string_literal: true
class PushoverService < Service
BASE_URI = 'https://api.pushover.net/1'.freeze
......@@ -79,7 +81,7 @@ class PushoverService < Service
end
if data[:total_commits_count] > 0
message << "\nTotal commits count: #{data[:total_commits_count]}"
message = [message, "Total commits count: #{data[:total_commits_count]}"].join("\n")
end
pushover_data = {
......
# frozen_string_literal: true
class RedmineService < IssueTrackerService
validates :project_url, :issues_url, :new_issue_url, presence: true, public_url: true, if: :activated?
......
# frozen_string_literal: true
class SlackService < ChatNotificationService
def title
'Slack notifications'
......
# frozen_string_literal: true
class SlackSlashCommandsService < SlashCommandsService
include TriggersHelper
......
# frozen_string_literal: true
# Base class for Chat services
# This class is not meant to be used directly, but only to inherrit from.
class SlashCommandsService < Service
......
# frozen_string_literal: true
class TeamcityService < CiService
include ReactiveService
......
# frozen_string_literal: true
class ProtectedBranch::MergeAccessLevel < ActiveRecord::Base
include ProtectedBranchAccess
end
# frozen_string_literal: true
class ProtectedBranch::PushAccessLevel < ActiveRecord::Base
include ProtectedBranchAccess
end
# frozen_string_literal: true
class ProtectedTag::CreateAccessLevel < ActiveRecord::Base
include ProtectedTagAccess
......
# frozen_string_literal: true
class RepositoryLanguage < ActiveRecord::Base
belongs_to :project
belongs_to :programming_language
......
# frozen_string_literal: true
class SiteStatistic < ActiveRecord::Base
# prevents the creation of multiple rows
default_value_for :id, 1
......
# frozen_string_literal: true
module Storage
class HashedProject
attr_accessor :project
......
# frozen_string_literal: true
module Storage
class LegacyProject
attr_accessor :project
......
---
title: Enable frozen string in rest of app/models/**/*.rb
merge_request: gfyoung
author:
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