gitlab-org--gitlab-foss/lib/gitlab/verify/uploads.rb
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00

37 lines
688 B
Ruby

module Gitlab
module Verify
class Uploads < BatchVerifier
def name
'Uploads'
end
def describe(object)
"Upload: #{object.id}"
end
private
# rubocop: disable CodeReuse/ActiveRecord
def all_relation
Upload.all.preload(:model)
end
# rubocop: enable CodeReuse/ActiveRecord
def local?(upload)
upload.local?
end
def expected_checksum(upload)
upload.checksum
end
def actual_checksum(upload)
Upload.hexdigest(upload.absolute_path)
end
def remote_object_exists?(upload)
upload.build_uploader.file.exists?
end
end
end
end