parser_cobertura

package
v0.0.0-...-e66fd96 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoberturaParser

func NewCoberturaParser(fileReader filereader.Reader) parsers.IParser

Types

type ClassXML

type ClassXML 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    MethodsXML `xml:"methods"`
	Lines      LinesXML   `xml:"lines"`
}

<class>

type ClassesXML

type ClassesXML struct {
	Class []ClassXML `xml:"class"`
}

<classes>

type CoberturaParser

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

CoberturaParser implements the parsers.IParser interface for Cobertura XML reports.

func (*CoberturaParser) Name

func (p *CoberturaParser) Name() string

func (*CoberturaParser) Parse

func (p *CoberturaParser) Parse(filePath string, config parsers.ParserConfig) (*parsers.ParserResult, error)

Parse unmarshals the Cobertura XML report and delegates the conversion to a flat list of FileCoverage objects to the processingOrchestrator.

func (*CoberturaParser) SupportsFile

func (p *CoberturaParser) SupportsFile(filePath string) bool

SupportsFile performs a fast check to see if this parser can handle the given file. It verifies the file has a ".xml" extension and that its root element is "<coverage>".

type CoberturaRoot

type CoberturaRoot 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         Sources  `xml:"sources"`
	Packages        Packages `xml:"packages"`
}

<coverage>

type ConditionXML

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

<condition>

type ConditionsXML

type ConditionsXML struct {
	Condition []ConditionXML `xml:"condition"`
}

<conditions>

type LineXML

type LineXML struct {
	Number            string        `xml:"number,attr"`
	Hits              string        `xml:"hits,attr"`
	Branch            string        `xml:"branch,attr"` // "true" or "false"
	ConditionCoverage string        `xml:"condition-coverage,attr"`
	Conditions        ConditionsXML `xml:"conditions"`
}

<line>

type LinesXML

type LinesXML struct {
	Line []LineXML `xml:"line"`
}

<lines>

type MethodXML

type MethodXML struct {
	Name       string   `xml:"name,attr"`
	Signature  string   `xml:"signature,attr"`
	LineRate   string   `xml:"line-rate,attr"`
	BranchRate string   `xml:"branch-rate,attr"`
	Complexity string   `xml:"complexity,attr"`
	Lines      LinesXML `xml:"lines"` // Lines specific to this method
}

<method>

type MethodsXML

type MethodsXML struct {
	Method []MethodXML `xml:"method"`
}

<methods>

type PackageXML

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

<package>

type Packages

type Packages struct {
	Package []PackageXML `xml:"package"`
}

<packages>

type Sources

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

<sources>

Jump to

Keyboard shortcuts

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