code_coverage

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LineIdx = iota
	InstructionIdx
	ComplexityIdx
	ClassIdx
	MethodIdx
	BranchIdx
	LinePercentIdx
	InstructionPercentIdx
	ClassCoveredPercentIdx
	LineCoveredIdx
)

Variables

View Source
var (
	ProjectFormatter = "总行数: %.0f <br/>覆盖行数: %0.f<br/>行覆盖率: %.2f%%"
	PackageFormatter = "%s <br/>总行数: %.0f <br/>覆盖行数: %.0f<br/>行覆盖率: %.2f%%<br/>class覆盖率: %.2f%%"
)

Functions

func GetJacocoAddr

func GetJacocoAddr(projectID uint64) string

Types

type Class

type Class struct {
	Name           string    `xml:"name,attr"`
	SourceFilename string    `xml:"sourcefilename,attr"`
	Methods        []Method  `xml:"method"`
	Counters       []Counter `xml:"counter"`
}

type CodeCoverage

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

func New

func New(options ...Option) *CodeCoverage

func (*CodeCoverage) Cancel

Cancel Cancel record

func (*CodeCoverage) End

End End record

func (*CodeCoverage) EndCallBack

EndCallBack Record end callBack

func (*CodeCoverage) GetCodeCoverageRecord

func (svc *CodeCoverage) GetCodeCoverageRecord(id uint64) (*apistructs.CodeCoverageExecRecordDto, error)

GetCodeCoverageRecord Get code coverage record

func (*CodeCoverage) JudgeApplication

func (svc *CodeCoverage) JudgeApplication(projectID uint64, orgID uint64, userID string) (bool, error, string)

func (*CodeCoverage) JudgeCanEnd

func (svc *CodeCoverage) JudgeCanEnd(projectID uint64) (bool, error)

func (*CodeCoverage) JudgeRunningRecordExist

func (svc *CodeCoverage) JudgeRunningRecordExist(projectID uint64) error

JudgeRunningRecordExist Judge running record exist

func (*CodeCoverage) ListCodeCoverageRecord

func (svc *CodeCoverage) ListCodeCoverageRecord(req apistructs.CodeCoverageListRequest) (data apistructs.CodeCoverageExecRecordData, err error)

ListCodeCoverageRecord list code coverage record

func (*CodeCoverage) ReadyCallBack

func (svc *CodeCoverage) ReadyCallBack(req apistructs.CodeCoverageUpdateRequest) error

ReadyCallBack Record ready callBack

func (*CodeCoverage) ReportCallBack

func (svc *CodeCoverage) ReportCallBack(req apistructs.CodeCoverageUpdateRequest) error

ReportCallBack Record report callBack

func (*CodeCoverage) Start

Start Start record

type Counter

type Counter struct {
	Covered int         `xml:"covered,attr"`
	Missed  int         `xml:"missed,attr"`
	Type    CounterType `xml:"type,attr"`
}

type CounterType

type CounterType string
var (
	LineCounter        CounterType = "LINE"
	InstructionCounter CounterType = "INSTRUCTION"
	ComplexityCounter  CounterType = "COMPLEXITY"
	ClassCounter       CounterType = "CLASS"
	MethodCounter      CounterType = "METHOD"
	BranchCounter      CounterType = "BRANCH"
)

func (CounterType) GetValueIdx

func (c CounterType) GetValueIdx() int

func (CounterType) IsBranchType

func (c CounterType) IsBranchType() bool

func (CounterType) IsClassType

func (c CounterType) IsClassType() bool

func (CounterType) IsInstructionType

func (c CounterType) IsInstructionType() bool

func (CounterType) IsLineType

func (c CounterType) IsLineType() bool

type Method

type Method struct {
	Name     string    `xml:"name,attr"`
	Desc     string    `xml:"desc,attr"`
	Line     int       `xml:"line,attr"`
	Counters []Counter `xml:"counter"`
}

type Option

type Option func(*CodeCoverage)

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

func WithDBClient

func WithDBClient(db *dao.DBClient) Option

func WithEnvConfig

func WithEnvConfig(envConfig *environment.EnvConfig) Option

type Package

type Package struct {
	Name     string    `xml:"name,attr"`
	Classes  []Class   `xml:"class"`
	Counters []Counter `xml:"counter"`
}

type Report

type Report struct {
	ProjectID   uint64    `json:"projectID"`
	ProjectName string    `json:"projectName"`
	XMLName     xml.Name  `xml:"report"`
	Packages    []Package `xml:"package"`
	Counters    []Counter `xml:"counter"`
}

Jump to

Keyboard shortcuts

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