calc

package
v0.0.0-...-d7993bf Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package calc calculates coverage through summarizing and also stores all the coverage structs used by or produced by the process

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortCoverages

func SortCoverages(cs []Coverage)

Types

type Coverage

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

Coverage stores test coverage summary data for one file

func (*Coverage) IsCoverageLow

func (c *Coverage) IsCoverageLow(covThresholdInt int) bool

IsCoverageLow checks if the coverage is less than the threshold.

func (c *Coverage) LineCovLink() string

func (*Coverage) Name

func (c *Coverage) Name() string

Name returns the file name

func (*Coverage) Percentage

func (c *Coverage) Percentage() string

Percentage returns the percentage of statements covered

func (*Coverage) PercentageForTestgrid

func (c *Coverage) PercentageForTestgrid() string

PercentageForTestgrid returns the percentage of statements covered

func (*Coverage) Ratio

func (c *Coverage) Ratio() (ratio float32, err error)
func (c *Coverage) SetLineCovLink(link string)

func (*Coverage) String

func (c *Coverage) String() string

String returns the summary of coverage in string

type CoverageList

type CoverageList struct {
	*Coverage
	// contains filtered or unexported fields
}

CoverageList is a collection and summary over multiple file Coverage objects

func CovList

func CovList(f *artifacts.ProfileReader, keyProfileFile *os.File,
	concernedFiles map[string]bool, covThresInt int) (g *CoverageList)

CovList read profiling information from reader and constructs CoverageList. If called in presubmit, it also creates a filtered version of profile, that only includes files in corresponding github commit, less those files that are excluded from coverage calculation

func NewCoverageList

func NewCoverageList(name string, concernedFiles map[string]bool, covThresholdInt int) *CoverageList

NewCoverageList constructs new (file) group Coverage

func (*CoverageList) CovThresInt

func (g *CoverageList) CovThresInt() int

func (*CoverageList) GetDirs

func (g *CoverageList) GetDirs() []string

GetDirs gets a list a sub-directories that contains source code. The list will be shown on Testgrid

func (*CoverageList) Group

func (g *CoverageList) Group() *[]Coverage

Group returns the collection of file Coverage objects

func (*CoverageList) Item

func (g *CoverageList) Item(index int) *Coverage

Item returns the Coverage item in group by index

func (*CoverageList) Map

func (g *CoverageList) Map() map[string]Coverage

Map returns maps the file name to its coverage for faster retrieval & membership check

func (*CoverageList) Percentage

func (g *CoverageList) Percentage() string

func (*CoverageList) Report

func (g *CoverageList) Report(itemized bool)

Report summarizes overall coverage and then prints report

func (*CoverageList) Subset

func (g *CoverageList) Subset(prefix string) *CoverageList

Subset returns the subset obtained through applying filter

func (*CoverageList) Summarize

func (g *CoverageList) Summarize()

Summarize summarizes all items in the group and stores the result

type GroupChanges

type GroupChanges struct {
	Added     []Coverage
	Deleted   []Coverage
	Unchanged []Coverage
	Changed   []Incremental
	BaseGroup *CoverageList
	NewGroup  *CoverageList
}

func NewGroupChanges

func NewGroupChanges(baseList *CoverageList, newList *CoverageList) *GroupChanges

NewGroupChanges compares the newList of coverage against the base list and returns the result

func (*GroupChanges) ContentForGithubPost

func (changes *GroupChanges) ContentForGithubPost(files map[string]bool) (string, bool, bool)

ContentForGithubPost constructs the message covbot posts

type Incremental

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

func (Incremental) String

func (inc Incremental) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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