2020-09-01 17:10:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
module PipelineArtifacts
|
2021-02-03 13:09:25 -05:00
|
|
|
class CodeCoveragePresenter < Gitlab::View::Presenter::Delegated
|
2020-09-01 17:10:21 -04:00
|
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
|
|
|
|
def for_files(filenames)
|
|
|
|
coverage_files = raw_report["files"].select { |key| filenames.include?(key) }
|
|
|
|
|
|
|
|
{ files: coverage_files }
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def raw_report
|
|
|
|
strong_memoize(:raw_report) do
|
|
|
|
self.each_blob do |blob|
|
|
|
|
Gitlab::Json.parse(blob)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|