This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 40dc60e2 authored by Michael Kozono's avatar Michael Kozono
Browse files

Fix Rubocop offenses

parent 9782ca6a5861
......@@ -15,39 +15,39 @@ class UnhashedUploadFile < ActiveRecord::Base
{
pattern: /\A-\/system\/appearance\/logo\/(\d+)/,
uploader: 'AttachmentUploader',
model_type: 'Appearance',
model_type: 'Appearance'
},
{
pattern: /\A-\/system\/appearance\/header_logo\/(\d+)/,
uploader: 'AttachmentUploader',
model_type: 'Appearance',
model_type: 'Appearance'
},
{
pattern: /\A-\/system\/note\/attachment\/(\d+)/,
uploader: 'AttachmentUploader',
model_type: 'Note',
model_type: 'Note'
},
{
pattern: /\A-\/system\/user\/avatar\/(\d+)/,
uploader: 'AvatarUploader',
model_type: 'User',
model_type: 'User'
},
{
pattern: /\A-\/system\/group\/avatar\/(\d+)/,
uploader: 'AvatarUploader',
model_type: 'Namespace',
model_type: 'Namespace'
},
{
pattern: /\A-\/system\/project\/avatar\/(\d+)/,
uploader: 'AvatarUploader',
model_type: 'Project',
model_type: 'Project'
},
{
pattern: FILE_UPLOADER_PATH_PATTERN,
uploader: 'FileUploader',
model_type: 'Project'
},
]
}
].freeze
scope :untracked, -> { where(tracked: false) }
......
......@@ -5,8 +5,8 @@ class PrepareUnhashedUploads
include Database::MigrationHelpers
FILE_PATH_BATCH_SIZE = 500
UPLOAD_DIR = "#{CarrierWave.root}/uploads"
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'
UPLOAD_DIR = "#{CarrierWave.root}/uploads".freeze
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze
class UnhashedUploadFile < ActiveRecord::Base
include EachBatch
......@@ -33,7 +33,7 @@ def clear_unhashed_upload_file_paths
end
def store_unhashed_upload_file_paths
return unless Dir.exists?(UPLOAD_DIR)
return unless Dir.exist?(UPLOAD_DIR)
file_paths = []
each_file_path(UPLOAD_DIR) do |file_path|
......
......@@ -129,7 +129,7 @@
it 'does not add an upload' do
expect do
unhashed_upload_file.ensure_tracked!
end.to_not change { upload_class.count }.from(1)
end.not_to change { upload_class.count }.from(1)
end
end
end
......
......@@ -37,7 +37,7 @@ class UnhashedUploadFile < ActiveRecord::Base
migrate!
max_length_namespace_path = max_length_project_path = max_length_filename = 'a' * 255
long_path = "./uploads#{("/#{max_length_namespace_path}") * Namespace::NUMBER_OF_ANCESTORS_ALLOWED}/#{max_length_project_path}/#{max_length_filename}"
long_path = "./uploads#{"/#{max_length_namespace_path}" * Namespace::NUMBER_OF_ANCESTORS_ALLOWED}/#{max_length_project_path}/#{max_length_filename}"
unhashed_upload_file = UnhashedUploadFile.new(path: long_path)
unhashed_upload_file.save!
expect(UnhashedUploadFile.first.path.size).to eq(5641)
......@@ -106,7 +106,7 @@ class UnhashedUploadFile < ActiveRecord::Base
expect(user1.reload.uploads.first.attributes).to include({
"path" => "uploads/-/system/user/avatar/#{user1.id}/rails_sample.jpg",
"uploader" => "AvatarUploader",
"uploader" => "AvatarUploader"
}.merge(rails_sample_jpg_attrs))
expect(project1.reload.uploads.first.attributes).to include({
"path" => "uploads/-/system/project/avatar/#{project1.id}/rails_sample.jpg",
......
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