Commit 50abbd3e authored by gfyoung's avatar gfyoung

Enable frozen string in app/models/*.rb

Partially addresses #47424.
parent caeb4597
# frozen_string_literal: true
class Admin::ServicesController < Admin::ApplicationController class Admin::ServicesController < Admin::ApplicationController
include ServiceParams include ServiceParams
...@@ -30,7 +32,7 @@ class Admin::ServicesController < Admin::ApplicationController ...@@ -30,7 +32,7 @@ class Admin::ServicesController < Admin::ApplicationController
def services_templates def services_templates
Service.available_services_names.map do |service_name| Service.available_services_names.map do |service_name|
service_template = service_name.concat("_service").camelize.constantize service_template = "#{service_name}_service".camelize.constantize
service_template.where(template: true).first_or_create service_template.where(template: true).first_or_create
end end
end end
......
# frozen_string_literal: true
require_dependency 'declarative_policy' require_dependency 'declarative_policy'
class Ability class Ability
......
# frozen_string_literal: true
class AbuseReport < ActiveRecord::Base class AbuseReport < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
......
# frozen_string_literal: true
class ActiveSession class ActiveSession
include ActiveModel::Model include ActiveModel::Model
......
# frozen_string_literal: true
class Appearance < ActiveRecord::Base class Appearance < ActiveRecord::Base
include CacheableAttributes include CacheableAttributes
include CacheMarkdownField include CacheMarkdownField
......
# frozen_string_literal: true
class ApplicationSetting < ActiveRecord::Base class ApplicationSetting < ActiveRecord::Base
include CacheableAttributes include CacheableAttributes
include CacheMarkdownField include CacheMarkdownField
......
# frozen_string_literal: true
class AuditEvent < ActiveRecord::Base class AuditEvent < ActiveRecord::Base
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
......
# frozen_string_literal: true
class AwardEmoji < ActiveRecord::Base class AwardEmoji < ActiveRecord::Base
DOWNVOTE_NAME = "thumbsdown".freeze DOWNVOTE_NAME = "thumbsdown".freeze
UPVOTE_NAME = "thumbsup".freeze UPVOTE_NAME = "thumbsup".freeze
......
# frozen_string_literal: true
class Badge < ActiveRecord::Base class Badge < ActiveRecord::Base
# This structure sets the placeholders that the urls # This structure sets the placeholders that the urls
# can have. This hash also sets which action to ask when # can have. This hash also sets which action to ask when
......
# frozen_string_literal: true
# Blob is a Rails-specific wrapper around Gitlab::Git::Blob objects # Blob is a Rails-specific wrapper around Gitlab::Git::Blob objects
class Blob < SimpleDelegator class Blob < SimpleDelegator
CACHE_TIME = 60 # Cache raw blobs referred to by a (mutable) ref for 1 minute CACHE_TIME = 60 # Cache raw blobs referred to by a (mutable) ref for 1 minute
......
# frozen_string_literal: true
class Board < ActiveRecord::Base class Board < ActiveRecord::Base
belongs_to :group belongs_to :group
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class BroadcastMessage < ActiveRecord::Base class BroadcastMessage < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
include Sortable include Sortable
......
# frozen_string_literal: true
class ChatName < ActiveRecord::Base class ChatName < ActiveRecord::Base
LAST_USED_AT_INTERVAL = 1.hour LAST_USED_AT_INTERVAL = 1.hour
......
# frozen_string_literal: true
class ChatTeam < ActiveRecord::Base class ChatTeam < ActiveRecord::Base
validates :team_id, presence: true validates :team_id, presence: true
validates :namespace, uniqueness: true validates :namespace, uniqueness: true
......
# coding: utf-8 # coding: utf-8
# frozen_string_literal: true
class Commit class Commit
extend ActiveModel::Naming extend ActiveModel::Naming
extend Gitlab::Cache::RequestCache extend Gitlab::Cache::RequestCache
...@@ -339,21 +341,21 @@ class Commit ...@@ -339,21 +341,21 @@ class Commit
end end
def cherry_pick_description(user) def cherry_pick_description(user)
message_body = "(cherry picked from commit #{sha})" message_body = ["(cherry picked from commit #{sha})"]
if merged_merge_request?(user) if merged_merge_request?(user)
commits_in_merge_request = merged_merge_request(user).commits commits_in_merge_request = merged_merge_request(user).commits
if commits_in_merge_request.present? if commits_in_merge_request.present?
message_body << "\n" message_body << ""
commits_in_merge_request.reverse.each do |commit_in_merge| commits_in_merge_request.reverse.each do |commit_in_merge|
message_body << "\n#{commit_in_merge.short_id} #{commit_in_merge.title}" message_body << "#{commit_in_merge.short_id} #{commit_in_merge.title}"
end end
end end
end end
message_body message_body.join("\n")
end end
def cherry_pick_message(user) def cherry_pick_message(user)
......
# frozen_string_literal: true
# CommitRange makes it easier to work with commit ranges # CommitRange makes it easier to work with commit ranges
# #
# Examples: # Examples:
......
# frozen_string_literal: true
class CommitStatus < ActiveRecord::Base class CommitStatus < ActiveRecord::Base
include HasStatus include HasStatus
include Importable include Importable
......
# frozen_string_literal: true
class Compare class Compare
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
class ContainerRepository < ActiveRecord::Base class ContainerRepository < ActiveRecord::Base
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class CycleAnalytics class CycleAnalytics
STAGES = %i[issue plan code test review staging production].freeze STAGES = %i[issue plan code test review staging production].freeze
......
# frozen_string_literal: true
class DashboardMilestone < GlobalMilestone class DashboardMilestone < GlobalMilestone
def issues_finder_params def issues_finder_params
{ authorized_only: true } { authorized_only: true }
......
# frozen_string_literal: true
class DeployKey < Key class DeployKey < Key
include IgnorableColumn include IgnorableColumn
......
# frozen_string_literal: true
class DeployKeysProject < ActiveRecord::Base class DeployKeysProject < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :deploy_key, inverse_of: :deploy_keys_projects belongs_to :deploy_key, inverse_of: :deploy_keys_projects
......
# frozen_string_literal: true
class DeployToken < ActiveRecord::Base class DeployToken < ActiveRecord::Base
include Expirable include Expirable
include TokenAuthenticatable include TokenAuthenticatable
......
# frozen_string_literal: true
class Deployment < ActiveRecord::Base class Deployment < ActiveRecord::Base
include AtomicInternalId include AtomicInternalId
include IidRoutes include IidRoutes
......
# frozen_string_literal: true
# A discussion on merge request or commit diffs consisting of `DiffNote` notes. # A discussion on merge request or commit diffs consisting of `DiffNote` notes.
# #
# A discussion of this type can be resolvable. # A discussion of this type can be resolvable.
......
# frozen_string_literal: true
# A note on merge request or commit diffs # A note on merge request or commit diffs
# #
# A note of this type can be resolvable. # A note of this type can be resolvable.
......
# frozen_string_literal: true
class DirectlyAddressedUser class DirectlyAddressedUser
class << self class << self
def reference_pattern def reference_pattern
......
# frozen_string_literal: true
# A non-diff discussion on an issue, merge request, commit, or snippet, consisting of `DiscussionNote` notes. # A non-diff discussion on an issue, merge request, commit, or snippet, consisting of `DiscussionNote` notes.
# #
# A discussion of this type can be resolvable. # A discussion of this type can be resolvable.
......
# frozen_string_literal: true
# A note in a non-diff discussion on an issue, merge request, commit, or snippet. # A note in a non-diff discussion on an issue, merge request, commit, or snippet.
# #
# A note of this type can be resolvable. # A note of this type can be resolvable.
......
# frozen_string_literal: true
class Email < ActiveRecord::Base class Email < ActiveRecord::Base
include Sortable include Sortable
include Gitlab::SQL::Pattern include Gitlab::SQL::Pattern
......
# frozen_string_literal: true
class Environment < ActiveRecord::Base class Environment < ActiveRecord::Base
# Used to generate random suffixes for the slug # Used to generate random suffixes for the slug
LETTERS = 'a'..'z' LETTERS = 'a'..'z'
...@@ -173,7 +175,7 @@ class Environment < ActiveRecord::Base ...@@ -173,7 +175,7 @@ class Environment < ActiveRecord::Base
# * cannot end with `-` # * cannot end with `-`
def generate_slug def generate_slug
# Lowercase letters and numbers only # Lowercase letters and numbers only
slugified = name.to_s.downcase.gsub(/[^a-z0-9]/, '-') slugified = +name.to_s.downcase.gsub(/[^a-z0-9]/, '-')
# Must start with a letter # Must start with a letter
slugified = 'env-' + slugified unless LETTERS.cover?(slugified[0]) slugified = 'env-' + slugified unless LETTERS.cover?(slugified[0])
......
# frozen_string_literal: true
# Placeholder class for model that is implemented in EE # Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE # It reserves '&' as a reference prefix, but the table does not exists in CE
class Epic < ActiveRecord::Base class Epic < ActiveRecord::Base
......
# frozen_string_literal: true
class Event < ActiveRecord::Base class Event < ActiveRecord::Base
include Sortable include Sortable
include IgnorableColumn include IgnorableColumn
......
# frozen_string_literal: true
# A collection of events to display in an event list. # A collection of events to display in an event list.
# #
# An EventCollection is meant to be used for displaying events to a user (e.g. # An EventCollection is meant to be used for displaying events to a user (e.g.
......
# frozen_string_literal: true
class ExternalIssue class ExternalIssue
include Referable include Referable
......
# frozen_string_literal: true
class ForkNetwork < ActiveRecord::Base class ForkNetwork < ActiveRecord::Base
belongs_to :root_project, class_name: 'Project' belongs_to :root_project, class_name: 'Project'
has_many :fork_network_members has_many :fork_network_members
......
# frozen_string_literal: true
class ForkNetworkMember < ActiveRecord::Base class ForkNetworkMember < ActiveRecord::Base
belongs_to :fork_network belongs_to :fork_network
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class ForkedProjectLink < ActiveRecord::Base class ForkedProjectLink < ActiveRecord::Base
belongs_to :forked_to_project, -> { where.not(pending_delete: true) }, class_name: 'Project' belongs_to :forked_to_project, -> { where.not(pending_delete: true) }, class_name: 'Project'
belongs_to :forked_from_project, -> { where.not(pending_delete: true) }, class_name: 'Project' belongs_to :forked_from_project, -> { where.not(pending_delete: true) }, class_name: 'Project'
......
# frozen_string_literal: true
class GenericCommitStatus < CommitStatus class GenericCommitStatus < CommitStatus
before_validation :set_default_values before_validation :set_default_values
......
# frozen_string_literal: true
class GlobalLabel class GlobalLabel
attr_accessor :title, :labels attr_accessor :title, :labels
alias_attribute :name, :title alias_attribute :name, :title
......
# frozen_string_literal: true
class GlobalMilestone class GlobalMilestone
include Milestoneish include Milestoneish
......
# frozen_string_literal: true
class GpgKey < ActiveRecord::Base class GpgKey < ActiveRecord::Base
KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze
KEY_SUFFIX = '-----END PGP PUBLIC KEY BLOCK-----'.freeze KEY_SUFFIX = '-----END PGP PUBLIC KEY BLOCK-----'.freeze
......
# frozen_string_literal: true
class GpgKeySubkey < ActiveRecord::Base class GpgKeySubkey < ActiveRecord::Base
include ShaAttribute include ShaAttribute
......
# frozen_string_literal: true
class GpgSignature < ActiveRecord::Base class GpgSignature < ActiveRecord::Base
include ShaAttribute include ShaAttribute
......
# frozen_string_literal: true
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class Group < Namespace class Group < Namespace
......
# frozen_string_literal: true
class GroupCustomAttribute < ActiveRecord::Base class GroupCustomAttribute < ActiveRecord::Base
belongs_to :group belongs_to :group
......
# frozen_string_literal: true
class GroupLabel < Label class GroupLabel < Label
belongs_to :group belongs_to :group
......
# frozen_string_literal: true
class GroupMilestone < GlobalMilestone class GroupMilestone < GlobalMilestone
attr_accessor :group attr_accessor :group
......
# frozen_string_literal: true
class Guest class Guest
class << self class << self
def can?(action, subject = :global) def can?(action, subject = :global)
......
# frozen_string_literal: true
class Identity < ActiveRecord::Base class Identity < ActiveRecord::Base
def self.uniqueness_scope def self.uniqueness_scope
:provider :provider
......
# frozen_string_literal: true
class ImportExportUpload < ActiveRecord::Base class ImportExportUpload < ActiveRecord::Base
include WithUploads include WithUploads
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
......
# frozen_string_literal: true
# A discussion to wrap a single `Note` note on the root of an issue, merge request, # A discussion to wrap a single `Note` note on the root of an issue, merge request,
# commit, or snippet, that is not displayed as a discussion. # commit, or snippet, that is not displayed as a discussion.
# #
......
# frozen_string_literal: true
require 'resolv' require 'resolv'
class InstanceConfiguration class InstanceConfiguration
......
# frozen_string_literal: true
# An InternalId is a strictly monotone sequence of integers # An InternalId is a strictly monotone sequence of integers
# generated for a given scope and usage. # generated for a given scope and usage.
# #
......
# frozen_string_literal: true
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class Issue < ActiveRecord::Base class Issue < ActiveRecord::Base
......
# frozen_string_literal: true
class IssueAssignee < ActiveRecord::Base class IssueAssignee < ActiveRecord::Base
belongs_to :issue belongs_to :issue
belongs_to :assignee, class_name: "User", foreign_key: :user_id belongs_to :assignee, class_name: "User", foreign_key: :user_id
......
# frozen_string_literal: true
# IssueCollection can be used to reduce a list of issues down to a subset. # IssueCollection can be used to reduce a list of issues down to a subset.
# #
# IssueCollection is not meant to be some sort of Enumerable, instead it's meant # IssueCollection is not meant to be some sort of Enumerable, instead it's meant
......
# frozen_string_literal: true
require 'digest/md5' require 'digest/md5'
class Key < ActiveRecord::Base class Key < ActiveRecord::Base
......
# frozen_string_literal: true
class Label < ActiveRecord::Base class Label < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
include Referable include Referable
......
# frozen_string_literal: true
class LabelLink < ActiveRecord::Base class LabelLink < ActiveRecord::Base
include Importable include Importable
......
# frozen_string_literal: true
class LabelPriority < ActiveRecord::Base class LabelPriority < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :label belongs_to :label
......
# frozen_string_literal: true
# A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes. # A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes.
# #
# All new diff discussions are of the type `DiffDiscussion`, but any diff discussions created # All new diff discussions are of the type `DiffDiscussion`, but any diff discussions created
......
# frozen_string_literal: true
# A note on merge request or commit diffs, using the legacy implementation. # A note on merge request or commit diffs, using the legacy implementation.
# #
# All new diff notes are of the type `DiffNote`, but any diff notes created # All new diff notes are of the type `DiffNote`, but any diff notes created
......
# frozen_string_literal: true
class LfsFileLock < ActiveRecord::Base class LfsFileLock < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class LfsObject < ActiveRecord::Base class LfsObject < ActiveRecord::Base
include AfterCommitQueue include AfterCommitQueue
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
......
# frozen_string_literal: true
class LfsObjectsProject < ActiveRecord::Base class LfsObjectsProject < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :lfs_object belongs_to :lfs_object
......
# frozen_string_literal: true
class List < ActiveRecord::Base class List < ActiveRecord::Base
belongs_to :board belongs_to :board
belongs_to :label belongs_to :label
......
# frozen_string_literal: true
class Member < ActiveRecord::Base class Member < ActiveRecord::Base
include AfterCommitQueue include AfterCommitQueue
include Sortable include Sortable
......
# frozen_string_literal: true
class MergeRequest < ActiveRecord::Base class MergeRequest < ActiveRecord::Base
include AtomicInternalId include AtomicInternalId
include IidRoutes include IidRoutes
......
# frozen_string_literal: true
class MergeRequestDiff < ActiveRecord::Base class MergeRequestDiff < ActiveRecord::Base
include Sortable include Sortable
include Importable include Importable
......
# frozen_string_literal: true
class MergeRequestDiffCommit < ActiveRecord::Base class MergeRequestDiffCommit < ActiveRecord::Base
include ShaAttribute include ShaAttribute
......
# frozen_string_literal: true
class MergeRequestDiffFile < ActiveRecord::Base class MergeRequestDiffFile < ActiveRecord::Base
include Gitlab::EncodingHelper include Gitlab::EncodingHelper
include DiffFile include DiffFile
......
# frozen_string_literal: true
class MergeRequestsClosingIssues < ActiveRecord::Base class MergeRequestsClosingIssues < ActiveRecord::Base
belongs_to :merge_request belongs_to :merge_request
belongs_to :issue belongs_to :issue
......
# frozen_string_literal: true
class Milestone < ActiveRecord::Base class Milestone < ActiveRecord::Base
# Represents a "No Milestone" state used for filtering Issues and Merge # Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned. # Requests that have no milestone assigned.
......
# frozen_string_literal: true
class Namespace < ActiveRecord::Base class Namespace < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
include Sortable include Sortable
......
# frozen_string_literal: true
# A note on the root of an issue, merge request, commit, or snippet. # A note on the root of an issue, merge request, commit, or snippet.
# #
# A note of this type is never resolvable. # A note of this type is never resolvable.
......
# frozen_string_literal: true
class NoteDiffFile < ActiveRecord::Base class NoteDiffFile < ActiveRecord::Base
include DiffFile include DiffFile
......
# frozen_string_literal: true
# Holds reasons for a notification to have been sent as well as a priority list to select which reason to use # Holds reasons for a notification to have been sent as well as a priority list to select which reason to use
# above the rest # above the rest
class NotificationReason class NotificationReason
......
# frozen_string_literal: true
class NotificationRecipient class NotificationRecipient
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
class NotificationSetting < ActiveRecord::Base class NotificationSetting < ActiveRecord::Base
include IgnorableColumn include IgnorableColumn
......
# frozen_string_literal: true
class OauthAccessGrant < Doorkeeper::AccessGrant class OauthAccessGrant < Doorkeeper::AccessGrant
belongs_to :resource_owner, class_name: 'User' belongs_to :resource_owner, class_name: 'User'
belongs_to :application, class_name: 'Doorkeeper::Application' belongs_to :application, class_name: 'Doorkeeper::Application'
......
# frozen_string_literal: true
class OauthAccessToken < Doorkeeper::AccessToken class OauthAccessToken < Doorkeeper::AccessToken
belongs_to :resource_owner, class_name: 'User' belongs_to :resource_owner, class_name: 'User'
belongs_to :application, class_name: 'Doorkeeper::Application' belongs_to :application, class_name: 'Doorkeeper::Application'
......
# frozen_string_literal: true
# When notes on a commit are displayed in the context of a merge request that # When notes on a commit are displayed in the context of a merge request that
# contains that commit, they are displayed as if they were a discussion. # contains that commit, they are displayed as if they were a discussion.
# #
......
# frozen_string_literal: true
class PagesDomain < ActiveRecord::Base class PagesDomain < ActiveRecord::Base
VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze
VERIFICATION_THRESHOLD = 3.days.freeze VERIFICATION_THRESHOLD = 3.days.freeze
......
# frozen_string_literal: true
class PersonalAccessToken < ActiveRecord::Base class PersonalAccessToken < ActiveRecord::Base
include Expirable include Expirable
include TokenAuthenticatable include TokenAuthenticatable
......
# frozen_string_literal: true
class PersonalSnippet < Snippet class PersonalSnippet < Snippet
include WithUploads include WithUploads
end end
# frozen_string_literal: true
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class Project < ActiveRecord::Base class Project < ActiveRecord::Base
......
# frozen_string_literal: true
class ProjectAuthorization < ActiveRecord::Base class ProjectAuthorization < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class ProjectAutoDevops < ActiveRecord::Base class ProjectAutoDevops < ActiveRecord::Base
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class ProjectCiCdSetting < ActiveRecord::Base class ProjectCiCdSetting < ActiveRecord::Base
belongs_to :project, inverse_of: :ci_cd_settings belongs_to :project, inverse_of: :ci_cd_settings
......
# frozen_string_literal: true
class ProjectCustomAttribute < ActiveRecord::Base class ProjectCustomAttribute < ActiveRecord::Base
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class ProjectDeployToken < ActiveRecord::Base class ProjectDeployToken < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :deploy_token, inverse_of: :project_deploy_tokens belongs_to :deploy_token, inverse_of: :project_deploy_tokens
......
# frozen_string_literal: true
class ProjectFeature < ActiveRecord::Base class ProjectFeature < ActiveRecord::Base
# == Project features permissions # == Project features permissions
# #
......
# frozen_string_literal: true
class ProjectGroupLink < ActiveRecord::Base class ProjectGroupLink < ActiveRecord::Base
include Expirable include Expirable
......
# frozen_string_literal: true
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class ProjectImportData < ActiveRecord::Base class ProjectImportData < ActiveRecord::Base
......
# frozen_string_literal: true
class ProjectImportState < ActiveRecord::Base class ProjectImportState < ActiveRecord::Base
include AfterCommitQueue include AfterCommitQueue
......
# frozen_string_literal: true
class ProjectLabel < Label class ProjectLabel < Label
MAX_NUMBER_OF_PRIORITIES = 1 MAX_NUMBER_OF_PRIORITIES = 1
......
# frozen_string_literal: true
class ProjectSnippet < Snippet class ProjectSnippet < Snippet
belongs_to :project belongs_to :project
belongs_to :author, class_name: "User" belongs_to :author, class_name: "User"
......
# frozen_string_literal: true
class ProjectStatistics < ActiveRecord::Base class ProjectStatistics < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :namespace belongs_to :namespace
......
# frozen_string_literal: true
class ProjectTeam class ProjectTeam
include BulkMemberAccessLoad include BulkMemberAccessLoad
......
# frozen_string_literal: true
class ProtectableDropdown class ProtectableDropdown
REF_TYPES = %i[branches tags].freeze REF_TYPES = %i[branches tags].freeze
......
# frozen_string_literal: true
class ProtectedBranch < ActiveRecord::Base class ProtectedBranch < ActiveRecord::Base
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
include ProtectedRef include ProtectedRef
......
# frozen_string_literal: true
class ProtectedRefMatcher class ProtectedRefMatcher
def initialize(protected_ref) def initialize(protected_ref)
@protected_ref = protected_ref @protected_ref = protected_ref
......
# frozen_string_literal: true
class ProtectedTag < ActiveRecord::Base class ProtectedTag < ActiveRecord::Base
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
include ProtectedRef include ProtectedRef
......
# frozen_string_literal: true
class PushEvent < Event class PushEvent < Event
# This validation exists so we can't accidentally use PushEvent with a # This validation exists so we can't accidentally use PushEvent with a
# different "action" value. # different "action" value.
......
# frozen_string_literal: true
class PushEventPayload < ActiveRecord::Base class PushEventPayload < ActiveRecord::Base
include ShaAttribute include ShaAttribute
......
# frozen_string_literal: true
class ReadmeBlob < SimpleDelegator class ReadmeBlob < SimpleDelegator
attr_reader :repository attr_reader :repository
......
# frozen_string_literal: true
class RedirectRoute < ActiveRecord::Base class RedirectRoute < ActiveRecord::Base
belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
......
# frozen_string_literal: true
class Release < ActiveRecord::Base class Release < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
......
# frozen_string_literal: true
class RemoteMirror < ActiveRecord::Base class RemoteMirror < ActiveRecord::Base
include AfterCommitQueue include AfterCommitQueue
......
# frozen_string_literal: true
require 'securerandom' require 'securerandom'
class Repository class Repository
......
# frozen_string_literal: true
class Route < ActiveRecord::Base class Route < ActiveRecord::Base
include CaseSensitivity include CaseSensitivity
......
# frozen_string_literal: true
class SecurityEvent < AuditEvent class SecurityEvent < AuditEvent
end end
# frozen_string_literal: true
class SentNotification < ActiveRecord::Base class SentNotification < ActiveRecord::Base
serialize :position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize serialize :position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize
......
# frozen_string_literal: true
# To add new service you should build a class inherited from Service # To add new service you should build a class inherited from Service
# and implement a set of methods # and implement a set of methods
class Service < ActiveRecord::Base class Service < ActiveRecord::Base
......
# frozen_string_literal: true
class Snippet < ActiveRecord::Base class Snippet < ActiveRecord::Base
include Gitlab::VisibilityLevel include Gitlab::VisibilityLevel
include CacheMarkdownField include CacheMarkdownField
......
# frozen_string_literal: true
class SnippetBlob class SnippetBlob
include BlobLike include BlobLike
......
# frozen_string_literal: true
class SpamLog < ActiveRecord::Base class SpamLog < ActiveRecord::Base
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class Subscription < ActiveRecord::Base class Subscription < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class SystemNoteMetadata < ActiveRecord::Base class SystemNoteMetadata < ActiveRecord::Base
# These notes's action text might contain a reference that is external. # These notes's action text might contain a reference that is external.
# We should always force a deep validation upon references that are found # We should always force a deep validation upon references that are found
......
# frozen_string_literal: true
class TermAgreement < ActiveRecord::Base class TermAgreement < ActiveRecord::Base
belongs_to :term, class_name: 'ApplicationSetting::Term' belongs_to :term, class_name: 'ApplicationSetting::Term'
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class Timelog < ActiveRecord::Base class Timelog < ActiveRecord::Base
validates :time_spent, :user, presence: true validates :time_spent, :user, presence: true
validate :issuable_id_is_present validate :issuable_id_is_present
......
# frozen_string_literal: true
class Todo < ActiveRecord::Base class Todo < ActiveRecord::Base
include Sortable include Sortable
......
# frozen_string_literal: true
class Tree class Tree
include Gitlab::MarkupHelper include Gitlab::MarkupHelper
......
# frozen_string_literal: true
class TrendingProject < ActiveRecord::Base class TrendingProject < ActiveRecord::Base
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
# Registration information for U2F (universal 2nd factor) devices, like Yubikeys # Registration information for U2F (universal 2nd factor) devices, like Yubikeys
class U2fRegistration < ActiveRecord::Base class U2fRegistration < ActiveRecord::Base
......
# frozen_string_literal: true
class Upload < ActiveRecord::Base class Upload < ActiveRecord::Base
# Upper limit for foreground checksum processing # Upper limit for foreground checksum processing
CHECKSUM_THRESHOLD = 100.megabytes CHECKSUM_THRESHOLD = 100.megabytes
......
# frozen_string_literal: true
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class User < ActiveRecord::Base class User < ActiveRecord::Base
......
# frozen_string_literal: true
class UserAgentDetail < ActiveRecord::Base class UserAgentDetail < ActiveRecord::Base
belongs_to :subject, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations belongs_to :subject, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
......
# frozen_string_literal: true
class UserCallout < ActiveRecord::Base class UserCallout < ActiveRecord::Base
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class UserCustomAttribute < ActiveRecord::Base class UserCustomAttribute < ActiveRecord::Base
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class UserInteractedProject < ActiveRecord::Base class UserInteractedProject < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
......
# frozen_string_literal: true
class UserSyncedAttributesMetadata < ActiveRecord::Base class UserSyncedAttributesMetadata < ActiveRecord::Base
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class UsersStarProject < ActiveRecord::Base class UsersStarProject < ActiveRecord::Base
belongs_to :project, counter_cache: :star_count, touch: true belongs_to :project, counter_cache: :star_count, touch: true
belongs_to :user belongs_to :user
......
# frozen_string_literal: true
class WikiDirectory class WikiDirectory
include ActiveModel::Validations include ActiveModel::Validations
......
# frozen_string_literal: true
# rubocop:disable Rails/ActiveRecordAliases # rubocop:disable Rails/ActiveRecordAliases
class WikiPage class WikiPage
PageChangedError = Class.new(StandardError) PageChangedError = Class.new(StandardError)
......
---
title: Enable frozen string in app/models/*.rb
merge_request: 20851
author: gfyoung
type: performance
...@@ -13,7 +13,7 @@ describe Admin::ServicesController do ...@@ -13,7 +13,7 @@ describe Admin::ServicesController do
Service.available_services_names.each do |service_name| Service.available_services_names.each do |service_name|
context "#{service_name}" do context "#{service_name}" do
let!(:service) do let!(:service) do
service_template = service_name.concat("_service").camelize.constantize service_template = "#{service_name}_service".camelize.constantize
service_template.where(template: true).first_or_create service_template.where(template: true).first_or_create
end end
......
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