Documentation
¶
Overview ¶
Package covet reads version control diffs and Go coverage files to generate reports on their intersection.
Index ¶
- type Covet
- func (c *Covet) DiffCoverageFiles() []File
- func (c *Covet) DiffCovered() float64
- func (c *Covet) PriorityUncoveredFiles(target uint) []File
- func (c *Covet) ReportFileCoverage(w io.Writer, f File, _ ReportFileCoverageOptions) error
- func (c *Covet) ReportSummaryColorTerminal(w io.Writer, options ReportSummaryOptions) error
- func (c *Covet) ReportSummaryMarkdown(w io.Writer, options ReportSummaryOptions) error
- type DiffChunk
- type File
- type Line
- type Options
- type ReportFileCoverageOptions
- type ReportSummaryOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Covet ¶
type Covet struct {
// contains filtered or unexported fields
}
Covet generates reports for a diff and coverage combination
func Parse ¶
Parse reads and parses both a diff file and Go coverage file, then returns a Covet instance to render reports
func (*Covet) DiffCoverageFiles ¶
DiffCoverageFiles generates a report of all files that are in the diff and have coverage information. These files can be used to display diff coverage information.
func (*Covet) DiffCovered ¶
DiffCovered returns the percentage of covered lines in the diff.
func (*Covet) PriorityUncoveredFiles ¶ added in v0.1.1
PriorityUncoveredFiles returns a list of Files prioritized by the largest uncovered sections of the diff. The list contains just enough Files worth of uncovered lines necessary to meet the provided 'target' coverage.
func (*Covet) ReportFileCoverage ¶ added in v0.1.1
ReportFileCoverage writes a diff-like plain text report with color to 'w'.
func (*Covet) ReportSummaryColorTerminal ¶ added in v0.1.1
func (c *Covet) ReportSummaryColorTerminal(w io.Writer, options ReportSummaryOptions) error
ReportSummaryColorTerminal writes a plain text report with color to 'w'.
func (*Covet) ReportSummaryMarkdown ¶ added in v0.1.1
func (c *Covet) ReportSummaryMarkdown(w io.Writer, options ReportSummaryOptions) error
ReportSummaryMarkdown writes a markdown report to 'w'. To capture as a string, write to a bytes.Buffer, then call buf.String().
type DiffChunk ¶
DiffChunk is a chunk of lines parsed from a Covet report. Includes the associated beginning and end line numbers of the chunk and the diff-like lines of text from the file.
type File ¶
File represents a file parsed in a Covet report. Includes the file name and which lines are covered.
type Options ¶
type Options struct { // FS is the file system to read files, Go package information, and more. // Defaults to hackpadfs's os.NewFS(). If on Windows, the default targets the current working directory's volume (e.g. C:\). FS fs.FS // Diff is a reader with patch or diff formatted contents Diff io.Reader // DiffBaseDir is the FS path to the repo's root directory DiffBaseDir string // GoCoverage is the FS path to a Go coverage file GoCoveragePath string // GoCoverageBaseDir is the FS path to the coverage file's module. Defaults to the coverage file's directory. GoCoverageBaseDir string }
Options contains parse options
type ReportFileCoverageOptions ¶ added in v0.1.1
type ReportFileCoverageOptions struct{}
ReportFileCoverageOptions contains options to format a file coverage report. Reserved for future use.
type ReportSummaryOptions ¶ added in v0.1.1
type ReportSummaryOptions struct {
Target uint
}
ReportSummaryOptions contains summary report options
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
covet
Command covet reads version control diffs and Go coverage files to generate reports on their intersection.
|
Command covet reads version control diffs and Go coverage files to generate reports on their intersection. |
internal
|
|
coverfile
Package coverfile parses Covet reports and formats files in the diff
|
Package coverfile parses Covet reports and formats files in the diff |
coverstatus
Package coverstatus contains coverage color-coding and labeling for generating reports.
|
Package coverstatus contains coverage color-coding and labeling for generating reports. |
fspath
Package fspath contains FS path manipulation tools, much like the standard library's "path/filepath" package.
|
Package fspath contains FS path manipulation tools, much like the standard library's "path/filepath" package. |
minmax
Package minmax contains min and max functions.
|
Package minmax contains min and max functions. |
packages
Package packages finds files related to a package pattern string.
|
Package packages finds files related to a package pattern string. |
span
Package span contains Span, a numeric range.
|
Package span contains Span, a numeric range. |
summary
Package summary generates summary reports in various formats.
|
Package summary generates summary reports in various formats. |
testhelpers
Package testhelpers contains file system generators for use in tests.
|
Package testhelpers contains file system generators for use in tests. |