profile

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ByName means sort by name
	ByName = "name"

	// ByCoverage means sort by coverage percentage
	ByCoverage = "coverage"
)

Variables

This section is empty.

Functions

func ConvertProfiles

func ConvertProfiles(filenames ...string) (*gocovutil.Packages, error)

ConvertProfiles converts "go test" profiles to package coverage report

Types

type Converter

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

Converter converts profiles

type Coverage

type Coverage struct {
	// Total is total statements count
	Total int

	// Reached is covered statements count
	Reached int
}

Coverage is coverage report with total and reached statements count

func (*Coverage) Percentage

func (c *Coverage) Percentage() float64

Percentage gets coverage in percents

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 PackageReport

type PackageReport struct {
	Coverage
	Functions map[string]*Coverage
}

PackageReport is package coverage report

func (*PackageReport) Sort added in v0.9.0

func (p *PackageReport) Sort(by string, desc bool) []string

Sort sorts package report data by specified criteria

type Packages added in v0.9.0

type Packages map[string]*PackageReport

Packages is a set of reports for each package

func (Packages) Names added in v0.9.0

func (p Packages) Names() []string

Names returns a slice of package names

func (Packages) Sort added in v0.9.0

func (p Packages) Sort(by string, desc bool) []string

Sort sorts packages by specified criteria

type Report

type Report struct {
	Coverage
	Packages Packages
}

Report is coverage report from GoCov profile

func Create

func Create(pkgs gocovutil.Packages) (r Report)

Create creates a new report from GoCov profile

func (*Report) CheckCoverage

func (r *Report) CheckCoverage(threshold float64) error

CheckCoverage checks if report satisfies coverage requirements

func (*Report) FormatFull

func (r *Report) FormatFull(orderProp string, desc bool) string

FormatFull returns detailed report

func (*Report) FormatSimple

func (r *Report) FormatSimple(orderProp string, desc bool) string

FormatSimple returns simplified report

type StmtExtent

type StmtExtent extent

StmtExtent describes a statements's extent in the source by file and position.

type StmtVisitor

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

StmtVisitor extracts data from file

func (*StmtVisitor) VisitStmt

func (v *StmtVisitor) VisitStmt(s ast.Stmt)

VisitStmt visits statement

Jump to

Keyboard shortcuts

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