Class: Gitlab::Ci::Reports::CoverageReportGenerator
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::CoverageReportGenerator
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/reports/coverage_report_generator.rb
Instance Method Summary collapse
-
#initialize(pipeline) ⇒ CoverageReportGenerator
constructor
A new instance of CoverageReportGenerator.
- #report ⇒ Object
Constructor Details
#initialize(pipeline) ⇒ CoverageReportGenerator
Returns a new instance of CoverageReportGenerator.
9 10 11 |
# File 'lib/gitlab/ci/reports/coverage_report_generator.rb', line 9 def initialize(pipeline) @pipeline = pipeline end |
Instance Method Details
#report ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gitlab/ci/reports/coverage_report_generator.rb', line 13 def report coverage_report = Gitlab::Ci::Reports::CoverageReport.new # Return an empty report if the pipeline is a child pipeline. # Since the coverage report is used in a merge request report, # we are only interested in the coverage report from the root pipeline. return coverage_report if @pipeline.child? return coverage_report if merge_request_file_paths.empty? coverage_report.tap do |coverage_report| report_builds.find_each do |build| build.each_report(::Ci::JobArtifact.file_types_for_report(:coverage)) do |file_type, blob| Gitlab::Ci::Parsers.fabricate!(file_type).parse!( blob, coverage_report, project_path: @pipeline.project.full_path, worktree_paths: @pipeline.all_worktree_paths, merge_request_paths: merge_request_file_paths, project: @pipeline.project ) end end end end |