Documentation
¶
Overview ¶
Package coverage parses a test-coverage report (lcov, Cobertura XML, or JaCoCo XML) into per-file, per-line coverage. The format is auto-detected from the content. Read-only, size-bounded; returns the aggregated measure.CoverageReport plus the raw line map so a caller can compute new-code coverage (changed lines that are covered).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LineCoverage ¶
LineCoverage maps a file path to (line number -> covered). A line present here is an executable line; absent lines are not counted.
func Parse ¶
func Parse(path string) (measure.CoverageReport, LineCoverage, error)
Parse reads a coverage report file, auto-detects its format, and returns the aggregated report plus the per-line map.
func ParseBytes ¶
func ParseBytes(data []byte) (measure.CoverageReport, LineCoverage, error)
ParseBytes parses coverage data whose format is auto-detected: XML with a <coverage> root is Cobertura, XML with a <report> root is JaCoCo, otherwise the data is treated as lcov.
func (LineCoverage) NewCodePercent ¶
NewCodePercent returns the line-coverage percentage over only the changed lines (file -> set), i.e. coverage on new code. changed[file][line] must be true for a changed line. ok=false when no changed line is measurable (so a caller can skip the metric rather than report a misleading 0 or 100).