testcoverage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrThresholdNotInRange         = fmt.Errorf("threshold must be in range [0 - 100]")
	ErrCoverageProfileNotSpecified = fmt.Errorf("coverage profile file not specified")
)

Functions

func ReportForGithubAction added in v1.0.1

func ReportForGithubAction(result AnalyzeResult, cfg Config)

func ReportForHuman added in v1.0.1

func ReportForHuman(result AnalyzeResult, cfg Config)

Types

type AnalyzeResult added in v1.0.1

type AnalyzeResult struct {
	FilesBelowThreshold    []CoverageStats
	PackagesBelowThreshold []CoverageStats
	MeetsTotalCoverage     bool
	TotalCoverage          int
}

func Analyze

func Analyze(cfg Config, coverageStats []CoverageStats) AnalyzeResult

func (*AnalyzeResult) Pass added in v1.0.1

func (r *AnalyzeResult) Pass() bool

type Config

type Config struct {
	Profile            string    `yaml:"profile"`
	LocalPrefix        string    `yaml:"localPrefix"`
	Threshold          Threshold `yaml:"threshold"`
	GithubActionOutput bool      `yaml:"githubActionOutput"`
}

func ConfigFromFile

func ConfigFromFile(filename string) (*Config, error)

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type CoverageStats

type CoverageStats struct {
	// contains filtered or unexported fields
}

func GenerateCoverageStats

func GenerateCoverageStats(profileFileName string) ([]CoverageStats, error)

func (*CoverageStats) CoveredPercentage

func (s *CoverageStats) CoveredPercentage() int

type FuncExtent

type FuncExtent struct {
	// contains filtered or unexported fields
}

FuncExtent describes a function's extent in the source by file and position.

type FuncVisitor

type FuncVisitor struct {
	// contains filtered or unexported fields
}

FuncVisitor implements the visitor that builds the function position list for a file.

func (*FuncVisitor) Visit

func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface.

type Threshold

type Threshold struct {
	File    int `yaml:"file"`
	Package int `yaml:"package"`
	Total   int `yaml:"total"`
}

Jump to

Keyboard shortcuts

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