coveragecheck

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package coveragecheck evaluates coverage for changed Go source lines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	File      string
	StartLine int
	EndLine   int
	Count     int64
}

Block describes one statement region from a Go coverage profile.

func ParseProfile

func ParseProfile(reader io.Reader, modulePath string) ([]Block, error)

ParseProfile parses a Go coverage profile and normalizes paths relative to modulePath.

type ChangedLines

type ChangedLines map[string]map[int]struct{}

ChangedLines maps repository-relative files to added line numbers.

func ParseDiff

func ParseDiff(reader io.Reader) (ChangedLines, error)

ParseDiff extracts added lines from a zero-context unified Git diff.

type Location

type Location struct {
	File string
	Line int
}

Location identifies one changed source line.

type Report

type Report struct {
	Covered   int
	Coverable int
	Percent   float64
	Uncovered []Location
}

Report summarizes coverage for coverable changed lines.

func Evaluate

func Evaluate(blocks []Block, changed ChangedLines) Report

Evaluate reports coverage for changed lines intersecting statement blocks.

func (Report) MeetsThreshold

func (r Report) MeetsThreshold(threshold float64) bool

MeetsThreshold reports whether the changed-line coverage meets threshold.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL