Enable frozen string in apps/validators/*.rb

Partially addresses #47424.
This commit is contained in:
gfyoung 2018-07-04 10:32:46 -07:00
parent 7c540395b9
commit d5ee813e3d
16 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AttachmentUploader < GitlabUploader class AttachmentUploader < GitlabUploader
include RecordsUploads::Concern include RecordsUploads::Concern
include ObjectStorage::Concern include ObjectStorage::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AvatarUploader < GitlabUploader class AvatarUploader < GitlabUploader
include UploaderHelper include UploaderHelper
include RecordsUploads::Concern include RecordsUploads::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class FaviconUploader < AttachmentUploader class FaviconUploader < AttachmentUploader
EXTENSION_WHITELIST = %w[png ico].freeze EXTENSION_WHITELIST = %w[png ico].freeze

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class FileMover class FileMover
attr_reader :secret, :file_name, :model, :update_field attr_reader :secret, :file_name, :model, :update_field

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This class breaks the actual CarrierWave concept. # This class breaks the actual CarrierWave concept.
# Every uploader should use a base_dir that is model agnostic so we can build # Every uploader should use a base_dir that is model agnostic so we can build
# back URLs from base_dir-relative paths saved in the `Upload` model. # back URLs from base_dir-relative paths saved in the `Upload` model.
@ -117,7 +119,7 @@ class FileUploader < GitlabUploader
end end
def markdown_link def markdown_link
markdown = "[#{markdown_name}](#{secure_url})" markdown = +"[#{markdown_name}](#{secure_url})"
markdown.prepend("!") if image_or_video? || dangerous? markdown.prepend("!") if image_or_video? || dangerous?
markdown markdown
end end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class GitlabUploader < CarrierWave::Uploader::Base class GitlabUploader < CarrierWave::Uploader::Base
class_attribute :options class_attribute :options

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class JobArtifactUploader < GitlabUploader class JobArtifactUploader < GitlabUploader
extend Workhorse::UploadPath extend Workhorse::UploadPath
include ObjectStorage::Concern include ObjectStorage::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class LegacyArtifactUploader < GitlabUploader class LegacyArtifactUploader < GitlabUploader
extend Workhorse::UploadPath extend Workhorse::UploadPath
include ObjectStorage::Concern include ObjectStorage::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class LfsObjectUploader < GitlabUploader class LfsObjectUploader < GitlabUploader
extend Workhorse::UploadPath extend Workhorse::UploadPath
include ObjectStorage::Concern include ObjectStorage::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NamespaceFileUploader < FileUploader class NamespaceFileUploader < FileUploader
# Re-Override # Re-Override
def self.root def self.root

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'fog/aws' require 'fog/aws'
require 'carrierwave/storage/fog' require 'carrierwave/storage/fog'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PersonalFileUploader < FileUploader class PersonalFileUploader < FileUploader
# Re-Override # Re-Override
def self.root def self.root

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module RecordsUploads module RecordsUploads
module Concern module Concern
extend ActiveSupport::Concern extend ActiveSupport::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Extra methods for uploader # Extra methods for uploader
module UploaderHelper module UploaderHelper
IMAGE_EXT = %w[png jpg jpeg gif bmp tiff ico].freeze IMAGE_EXT = %w[png jpg jpeg gif bmp tiff ico].freeze

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Workhorse module Workhorse
module UploadPath module UploadPath
def workhorse_upload_path def workhorse_upload_path

View file

@ -0,0 +1,5 @@
---
title: Enable frozen string in apps/validators/*.rb
merge_request: 20382
author: gfyoung
type: other