2039c8280d
This whitelists all existing offenses for the various CodeReuse cops, of which most are triggered by the CodeReuse/ActiveRecord cop.
21 lines
527 B
Ruby
21 lines
527 B
Ruby
# frozen_string_literal: true
|
|
|
|
class DeleteDiffFilesWorker
|
|
include ApplicationWorker
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
def perform(merge_request_diff_id)
|
|
merge_request_diff = MergeRequestDiff.find(merge_request_diff_id)
|
|
|
|
return if merge_request_diff.without_files?
|
|
|
|
MergeRequestDiff.transaction do
|
|
merge_request_diff.clean!
|
|
|
|
MergeRequestDiffFile
|
|
.where(merge_request_diff_id: merge_request_diff.id)
|
|
.delete_all
|
|
end
|
|
end
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
end
|