abstract class CoverageReporter::BaseParser
- CoverageReporter::BaseParser
- Reference
- Object
Overview
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.
Direct Known Subclasses
- CoverageReporter::CloverParser
- CoverageReporter::CoberturaParser
- CoverageReporter::CoveragepyParser
- CoverageReporter::CoverallsParser
- CoverageReporter::GcovParser
- CoverageReporter::GolangParser
- CoverageReporter::JacocoParser
- CoverageReporter::LcovParser
- CoverageReporter::SimplecovParser
Defined in:
coverage_reporter/parsers/base_parser.crConstructors
-
.new(base_path : String | Nil = nil, forced : Bool = false)
Initializes the parser.
Class Method Summary
-
.name : String
Returns parser name which can be used to force resolve the parser.
Instance Method Summary
-
#file_report(name, coverage, branches = nil, source_digest = nil)
Creates a
FileReportinstance. -
#globs : Array(String)
Returns an array of globs that will be used to look for coverage reports.
-
#matches?(filename : String) : Bool
Checks if the file can be parsed with the parser.
-
#parse(filename : String) : Array(FileReport)
Parses the file and returns an array of
FileReportwhich will be sent to Coveralls API.
Constructor Detail
Initializes the parser.
base_path can be used to join with all paths in coverage report in order to properly reference a file.
Class Method Detail
Instance Method Detail
Creates a FileReport instance. Use this method instead of explicit
creation with FileReport.new().
Returns an array of globs that will be used to look for coverage reports.
Parses the file and returns an array of FileReport which will be
sent to Coveralls API.