go-coverage: github.com/sguiheux/go-coverage Index | Files

package coverage

import "github.com/sguiheux/go-coverage"


Package Files

coverage.go types.go types_clover.go types_cobertura.go

type CloverClass Uses

type CloverClass struct {
    Name    string             `xml:"name,attr"`
    Metrics CloverClassMetrics `xml:"metrics"`

type CloverClassMetrics Uses

type CloverClassMetrics struct {
    Complexity          int64   `xml:"complexity,attr"`
    Elements            int64   `xml:"elements,attr"`
    CoveredElements     int64   `xml:"coveredelements,attr"`
    Conditionnals       int64   `xml:"conditionals,attr"`
    CoveredConditionals int64   `xml:"coveredconditionals,attr"`
    Statements          int64   `xml:"statements,attr"`
    CoveredStatements   int64   `xml:"coveredstatements,attr"`
    CoveredMethods      int64   `xml:"coveredmethods,attr"`
    Methods             int64   `xml:"methods,attr"`
    TestDuration        float64 `xml:"testduration,attr"`
    TestFailures        int64   `xml:"testfailures,attr"`
    TestPasses          int64   `xml:"testpasses,attr"`
    TestRuns            int64   `xml:"testruns,attr"`

type CloverCoverage Uses

type CloverCoverage struct {
    XMLName   xml.Name      `xml:"coverage"`
    Clover    string        `xml:"clover,attr"`
    Generated int64         `xml:"generated,attr"`
    Project   CloverProject `xml:"project"`

type CloverFile Uses

type CloverFile struct {
    Name    string            `xml:"name,attr"`
    Path    string            `xml:"path,attr"`
    Metrics CloverFileMetrics `xml:"metrics"`
    Class   []CloverClass     `xml:"class"`
    Line    []CloverLine      `xml:"line"`

type CloverFileMetrics Uses

type CloverFileMetrics struct {
    Classes int64 `xml:"classes,attr"`
    Loc     int64 `xml:"loc,attr"`
    Ncloc   int64 `xml:"ncloc,attr"`

type CloverLine Uses

type CloverLine struct {
    Num          int64   `xml:"num,attr"`
    Type         string  `xml:"type,attr"`
    Complexity   int64   `xml:"complexity,attr"`
    Count        int64   `xml:"count,attr"`
    FalseCount   int64   `xml:"falsecount,attr"`
    TrueCount    int64   `xml:"truecount,attr"`
    Signature    int64   `xml:"signature,attr"`
    TestDuration float64 `xml:"testduration,attr"`
    TestSuccess  bool    `xml:"testsuccess,attr"`
    Visibility   string  `xml:"visibility,attr"`

type CloverMetric Uses

type CloverMetric struct {
    Packages int64 `xml:"packages,attr"`

type CloverPackage Uses

type CloverPackage struct {
    Name    string               `xml:"name,attr"`
    Metrics CloverPackageMetrics `xml:"metrics"`
    File    []CloverFile         `xml:"file"`

type CloverPackageMetrics Uses

type CloverPackageMetrics struct {
    Files int64 `xml:"files,attr"`

type CloverProject Uses

type CloverProject struct {
    Name      string          `xml:"name,attr"`
    Timestamp int64           `xml:"timestamp,attr"`
    Metrics   CloverMetric    `xml:"metrics"`
    Package   []CloverPackage `xml:"package"`

type CoberturaClass Uses

type CoberturaClass struct {
    Name       string           `xml:"name,attr"`
    FileName   string           `xml:"filename,attr"`
    LineRate   string           `xml:"line-rate,attr"`
    BranchRate string           `xml:"branch-rate,attr"`
    Complexity string           `xml:"complexity,attr"`
    Methods    CoberturaMethods `xml:"methods"`
    Lines      CoberturaLines   `xml:"lines"`

type CoberturaClasses Uses

type CoberturaClasses struct {
    Class []CoberturaClass `xml:"class"`

type CoberturaCondition Uses

type CoberturaCondition struct {
    Number   string `xml:"number,attr"`
    Type     string `xml:"type,attr"`
    Coverage string `xml:"coverage,attr"`

type CoberturaConditions Uses

type CoberturaConditions struct {
    Condition []CoberturaCondition `xml:"conditions,attr"`

type CoberturaCoverage Uses

type CoberturaCoverage struct {
    XMLName         xml.Name          `xml:"coverage"`
    LineRate        string            `xml:"line-rate,attr"`
    BranchRate      string            `xml:"branch-rate,attr"`
    LinesCovered    string            `xml:"lines-covered,attr"`
    LinesValid      string            `xml:"lines-valid,attr"`
    BranchesCovered string            `xml:"branches-covered,attr"`
    BranchesValid   string            `xml:"branches-valid,attr"`
    Complexity      string            `xml:"complexity,attr"`
    Version         string            `xml:"version,attr"`
    Timestamp       string            `xml:"timestamp,attr"`
    Sources         CoberturaSources  `xml:"sources"`
    Packages        CoberturaPackages `xml:"packages"`

type CoberturaLine Uses

type CoberturaLine struct {
    Number            string `xml:"number,attr"`
    Hits              string `xml:"hits,attr"`
    Branch            string `xml:"branch,attr"`
    ConditionCoverage string `xml:"condition-coverage,attr"`
    Conditions        []CoberturaConditions

type CoberturaLines Uses

type CoberturaLines struct {
    Line []CoberturaLine `xml:"line"`

type CoberturaMethod Uses

type CoberturaMethod struct {
    Name       string         `xml:"name,attr"`
    Signature  string         `xml:"signature,attr"`
    LineRate   string         `xml:"line-rate,attr"`
    BranchRate string         `xml:"branch-rate,attr"`
    Lines      CoberturaLines `xml:"lines"`

type CoberturaMethods Uses

type CoberturaMethods struct {
    Method []CoberturaMethod `xml:"method"`

type CoberturaPackage Uses

type CoberturaPackage struct {
    Name       string           `xml:"name,attr"`
    LineRate   string           `xml:"line-rate,attr"`
    BranchRate string           `xml:"branch-rate,attr"`
    Complexity string           `xml:"complexity,attr"`
    Classes    CoberturaClasses `xml:"classes"`

type CoberturaPackages Uses

type CoberturaPackages struct {
    Package []CoberturaPackage `xml:"package"`

type CoberturaSources Uses

type CoberturaSources struct {
    Source []string `xml:"source"`

type CoverageMode Uses

type CoverageMode string

CoverageMode represents the format of the coverage reprt

const (
    LCOV      CoverageMode = "lcov"
    COBERTURA CoverageMode = "cobertura"
    CLOVER    CoverageMode = "clover"

type FileReport Uses

type FileReport struct {
    Path             string `json:"path"`
    TotalLines       int    `json:"total_lines"`
    CoveredLines     int    `json:"covered_lines"`
    TotalFunctions   int    `json:"total_functions"`
    CoveredFunctions int    `json:"covered_functions"`
    TotalBranches    int    `json:"total_branches"`
    CoveredBranches  int    `json:"covered_branches"`

FileReport contains all informations about a file

type Parser Uses

type Parser struct {
    // contains filtered or unexported fields

Parser represents the lcov parser

func New Uses

func New(filePath string, mode CoverageMode) Parser

New creates a new lcov parser

func (Parser) Parse Uses

func (l Parser) Parse() (Report, error)

Parse parses the lcov file

type Report Uses

type Report struct {
    Files            []FileReport `json:"files"`
    TotalLines       int          `json:"total_lines"`
    CoveredLines     int          `json:"covered_lines"`
    TotalFunctions   int          `json:"total_functions"`
    CoveredFunctions int          `json:"covered_functions"`
    TotalBranches    int          `json:"total_branches"`
    CoveredBranches  int          `json:"covered_branches"`

Report represents the result of LcovParser.parse

Package coverage imports 8 packages (graph) and is imported by 12 packages. Updated 2019-08-24. Refresh now. Tools for package owners.