Class: SimpleCov::Formatter::LcovFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov_lcov_formatter.rb

Overview

Custom Formatter to generate lcov style coverage for simplecov

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.config {|@config| ... } ⇒ Object

Yields:



27
28
29
30
31
# File 'lib/simplecov_lcov_formatter.rb', line 27

def config
  @config ||= SimpleCovLcovFormatter::Configuration.new
  yield @config if block_given?
  @config
end

.report_with_single_file=(value) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/simplecov_lcov_formatter.rb', line 33

def report_with_single_file=(value)
  deprecation_message =
    "#{caller(1..1).first} " \
      "`#{LcovFormatter}.report_with_single_file=` is deprecated. " \
      "Use `#{LcovFormatter}.config.report_with_single_file=` instead"

  warn deprecation_message
  config.report_with_single_file = value
end

Instance Method Details

#format(result) ⇒ Object

generate lcov style coverage.

Args

result
SimpleCov::Result

abcoverage result instance.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/simplecov_lcov_formatter.rb', line 14

def format(result)
  create_output_directory!

  if report_with_single_file?
    write_lcov_to_single_file!(result.files)
  else
    result.files.each { |file| write_lcov!(file) }
  end

  puts "Lcov style coverage report generated for #{result.command_name} to #{lcov_results_path}"
end