cobertura

package
v0.0.0-...-54fde68 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class struct {
	Name       string    `xml:"name,attr"`
	Filename   string    `xml:"filename,attr"`
	LineRate   float32   `xml:"line-rate,attr"`
	BranchRate float32   `xml:"branch-rate,attr"`
	Complexity float32   `xml:"complexity,attr"`
	Methods    []*Method `xml:"methods>method"`
	Lines      Lines     `xml:"lines>line"`
}

func (Class) HitRate

func (class Class) HitRate() float32

HitRate returns a float32 from 0.0 to 1.0 representing what fraction of lines have hits

func (Class) NumLines

func (class Class) NumLines() (numLines int64)

NumLines returns the number of lines

func (Class) NumLinesWithHits

func (class Class) NumLinesWithHits() (numLinesWithHits int64)

NumLinesWithHits returns the number of lines with a hit count > 0

type Coverage

type Coverage struct {
	XMLName         xml.Name   `xml:"coverage"`
	LineRate        float32    `xml:"line-rate,attr"`
	BranchRate      float32    `xml:"branch-rate,attr"`
	Version         string     `xml:"version,attr"`
	Timestamp       int64      `xml:"timestamp,attr"`
	LinesCovered    int64      `xml:"lines-covered,attr"`
	LinesValid      int64      `xml:"lines-valid,attr"`
	BranchesCovered int64      `xml:"branches-covered,attr"`
	BranchesValid   int64      `xml:"branches-valid,attr"`
	Complexity      float32    `xml:"complexity,attr"`
	Sources         []*Source  `xml:"sources>source"`
	Packages        []*Package `xml:"packages>package"`
}

func (*Coverage) FromProfiles

func (cov *Coverage) FromProfiles(profiles []*gocover.Profile) error

func (Coverage) HitRate

func (cov Coverage) HitRate() float32

HitRate returns a float32 from 0.0 to 1.0 representing what fraction of lines have hits

func (Coverage) NumLines

func (cov Coverage) NumLines() (numLines int64)

NumLines returns the number of lines

func (Coverage) NumLinesWithHits

func (cov Coverage) NumLinesWithHits() (numLinesWithHits int64)

NumLinesWithHits returns the number of lines with a hit count > 0

type Line

type Line struct {
	Number int   `xml:"number,attr"`
	Hits   int64 `xml:"hits,attr"`
}

type Lines

type Lines []*Line

Lines is a slice of Line pointers, with some convenience methods

func (*Lines) AddOrUpdateLine

func (lines *Lines) AddOrUpdateLine(lineNumber int, hits int64)

AddOrUpdateLine adds a line if it is a different line than the last line recorded. If it's the same line as the last line recorded then we update the hits down if the new hits is less; otherwise just leave it as-is

func (Lines) HitRate

func (lines Lines) HitRate() (hitRate float32)

HitRate returns a float32 from 0.0 to 1.0 representing what fraction of lines have hits

func (Lines) NumLines

func (lines Lines) NumLines() int64

NumLines returns the number of lines

func (Lines) NumLinesWithHits

func (lines Lines) NumLinesWithHits() (numLinesWithHits int64)

NumLinesWithHits returns the number of lines with a hit count > 0

type Method

type Method struct {
	Name       string  `xml:"name,attr"`
	Signature  string  `xml:"signature,attr"`
	LineRate   float32 `xml:"line-rate,attr"`
	BranchRate float32 `xml:"branch-rate,attr"`
	Complexity float32 `xml:"complexity,attr"`
	Lines      Lines   `xml:"lines>line"`
}

func (Method) HitRate

func (method Method) HitRate() float32

HitRate returns a float32 from 0.0 to 1.0 representing what fraction of lines have hits

func (Method) NumLines

func (method Method) NumLines() int64

NumLines returns the number of lines

func (Method) NumLinesWithHits

func (method Method) NumLinesWithHits() int64

NumLinesWithHits returns the number of lines with a hit count > 0

type Package

type Package struct {
	Name       string   `xml:"name,attr"`
	LineRate   float32  `xml:"line-rate,attr"`
	BranchRate float32  `xml:"branch-rate,attr"`
	Complexity float32  `xml:"complexity,attr"`
	Classes    []*Class `xml:"classes>class"`
}

func (Package) HitRate

func (pkg Package) HitRate() float32

HitRate returns a float32 from 0.0 to 1.0 representing what fraction of lines have hits

func (Package) NumLines

func (pkg Package) NumLines() (numLines int64)

NumLines returns the number of lines

func (Package) NumLinesWithHits

func (pkg Package) NumLinesWithHits() (numLinesWithHits int64)

NumLinesWithHits returns the number of lines with a hit count > 0

type Source

type Source struct {
	Path string `xml:",chardata"`
}

Jump to

Keyboard shortcuts

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