Class: Coverband::Reporters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/coverband/reporters/base.rb

Overview

This is the base clase for report generation it helps with filtering, normalization, etc for final report generation

Direct Known Subclasses

ConsoleReport, HTMLReport, JSONReport

Constant Summary collapse

DATA_KEY =
"data"

Class Method Summary collapse

Class Method Details

.fix_reports(reports) ⇒ Object

Add back files that exist in the project but have no Coverage This makes it easy to find and delete files with no references



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/coverband/reporters/base.rb', line 29

def fix_reports(reports)
  # list all files, even if not tracked by Coverband (0% coverage)
  tracked_glob = Coverband.configuration.tracked_search_paths
  filtered_report_files = {}

  reports.each_pair do |report_name, report_data|
    filtered_report_files[report_name] = {}
    report_files = Coverband::Utils::Result.add_not_loaded_files(report_data, tracked_glob)

    # apply coverband filters
    report_files.each_pair do |file, data|
      next if Coverband.configuration.ignore.any? { |i| file.match?(i) }

      filtered_report_files[report_name][file] = data
    end
  end
  filtered_report_files
end

.report(store, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/coverband/reporters/base.rb', line 13

def report(store, options = {})
  all_roots = Coverband.configuration.all_root_paths
  get_current_scov_data_imp(store, all_roots, options)

  # These are extremelhy verbose but useful during coverband development, not generally for users
  # Only available by uncommenting this mode is never released
  # if Coverband.configuration.verbose
  #   # msg = "report:\n #{scov_style_report.inspect}"
  #   # Coverband.configuration.logger.debug msg
  # end
end