CoverageReporter::BaseParser
Inherits Reference / Object
Coverage report parser interface.
To add a new parser create a class in src/coverage_reporter/parsers/ folder and
implement three required methods. For example, if you add a mycov parser the code
should look like this:
require "./base_parser"
module CoverageReporter
class MycovParser < BaseParser
def globs : Array(String)
["**/*/*.mycov"]
end
def matches?(filename : String) : Bool
filename.ends_with?(".mycov")
end
def parse(filename : String) : Array(FileReport)
# ... mycov format specific parsing
end
end
end
Them add your parser class to PARSERS constant in Parser class.
PARSERS = {
# ...
MycovParser,
}
Existing parsers can be used as a reference.
Constructors
new(base_path : String | Nil = nil, forced : Bool = false)
Initializes the parser.
base_path can be used to join with all paths in coverage report in order to properly reference a file.
Class methods
Instance methods
file_report(name, coverage, branches = nil, source_digest = nil)
Creates a FileReport instance. Use this method instead of explicit
creation with FileReport.new().
parse(filename : String) : Array(FileReport)
Parses the file and returns an array of FileReport which will be
sent to Coveralls API.