coverage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CloverDefaultPath = "coverage.xml"
View Source
const GocoverDefaultPath = "coverage.out"

Variables

View Source
var LcovDefaultPath = []string{"coverage", "lcov.info"}
View Source
var SimplecovDefaultPath = []string{"coverage", ".resultset.json"}

Functions

This section is empty.

Types

type Clover

type Clover struct{}

func NewClover

func NewClover() *Clover

func (*Clover) ParseReport

func (c *Clover) ParseReport(path string) (*Coverage, string, error)

type CloverReport

type CloverReport struct {
	XMLName   xml.Name `xml:"coverage"`
	Generated string   `xml:"generated,attr"`
	Project   struct {
		Timestamp string             `xml:"timestamp,attr"`
		File      []CloverReportFile `xml:"file"`
		Metrics   struct {
			Files               int `xml:"files,attr"`
			Loc                 int `xml:"loc,attr"`
			Ncloc               int `xml:"ncloc,attr"`
			Classes             int `xml:"classes,attr"`
			Methods             int `xml:"methods,attr"`
			Coveredmethods      int `xml:"coveredmethods,attr"`
			Conditionals        int `xml:"conditionals,attr"`
			Coveredconditionals int `xml:"coveredconditionals,attr"`
			Statements          int `xml:"statements,attr"`
			Coveredstatements   int `xml:"coveredstatements,attr"`
			Elements            int `xml:"elements,attr"`
			Coveredelements     int `xml:"coveredelements,attr"`
		} `xml:"metrics"`
	} `xml:"project"`
}

type CloverReportFile

type CloverReportFile struct {
	XMLName xml.Name `xml:"file"`
	Name    string   `xml:"name,attr"`
	Metrics struct {
		Loc                 int `xml:"loc,attr"`
		Ncloc               int `xml:"ncloc,attr"`
		Classes             int `xml:"classes,attr"`
		Methods             int `xml:"methods,attr"`
		Coveredmethods      int `xml:"coveredmethods,attr"`
		Conditionals        int `xml:"conditionals,attr"`
		Coveredconditionals int `xml:"coveredconditionals,attr"`
		Statements          int `xml:"statements,attr"`
		Coveredstatements   int `xml:"coveredstatements,attr"`
		Elements            int `xml:"elements,attr"`
		Coveredelements     int `xml:"coveredelements,attr"`
	} `xml:"metrics"`
	Class struct {
		Name      string `xml:"name,attr"`
		Namespace string `xml:"namespace,attr"`
		Metrics   struct {
			Complexity          int `xml:"complexity,attr"`
			Methods             int `xml:"methods,attr"`
			Coveredmethods      int `xml:"coveredmethods,attr"`
			Conditionals        int `xml:"conditionals,attr"`
			Coveredconditionals int `xml:"coveredconditionals,attr"`
			Statements          int `xml:"statements,attr"`
			Coveredstatements   int `xml:"coveredstatements,attr"`
			Elements            int `xml:"elements,attr"`
			Coveredelements     int `xml:"coveredelements,attr"`
		} `xml:"metrics"`
	} `xml:"class"`
	Line []struct {
		Num        int     `xml:"num,attr"`
		Type       string  `xml:"type,attr"`
		Name       string  `xml:"name,attr"`
		Visibility string  `xml:"visibility,attr"`
		Complexity int     `xml:"complexity,attr"`
		Crap       float64 `xml:"crap,attr"`
		Count      int     `xml:"count,attr"`
	} `xml:"line"`
}

type Coverage

type Coverage struct {
	Type    Type          `json:"type"`
	Format  string        `json:"format"`
	Total   int           `json:"total"`
	Covered int           `json:"covered"`
	Files   FileCoverages `json:"files"`
}

func Measure

func Measure(path string) (*Coverage, string, error)

func New

func New() *Coverage

type FileCoverage

type FileCoverage struct {
	FileName string `json:"file"`
	Total    int    `json:"total"`
	Covered  int    `json:"covered"`
}

func NewFileCoverage

func NewFileCoverage(fileName string) *FileCoverage

type FileCoverages

type FileCoverages []*FileCoverage

func (FileCoverages) FindByFileName

func (coverages FileCoverages) FindByFileName(fileName string) (*FileCoverage, error)

type Gocover

type Gocover struct{}

func NewGocover

func NewGocover() *Gocover

func (*Gocover) ParseReport

func (g *Gocover) ParseReport(path string) (*Coverage, string, error)

type Lcov

type Lcov struct{}

func NewLcov

func NewLcov() *Lcov

func (*Lcov) ParseReport

func (l *Lcov) ParseReport(path string) (*Coverage, string, error)

type Processor

type Processor interface {
	Name() string
	ParseReport(path string) (*Coverage, string, error)
}

type Simplecov

type Simplecov struct{}

func NewSimplecov

func NewSimplecov() *Simplecov

func (*Simplecov) ParseReport

func (s *Simplecov) ParseReport(path string) (*Coverage, string, error)

type SimplecovCoverage

type SimplecovCoverage struct {
	Coverage map[string]SimplecovFileCoverage
}

type SimplecovFileCoverage

type SimplecovFileCoverage struct {
	Lines []interface{}
}

type SimplecovReport

type SimplecovReport map[string]SimplecovCoverage

type Type

type Type string
const (
	TypeLOC       Type = "loc"
	TypeStatement Type = "statement"
)

Jump to

Keyboard shortcuts

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