Documentation
¶
Overview ¶
Package calc calculates coverage through summarizing and also stores all the coverage structs used by or produced by the process
Copyright 2019 The Knative Authors ¶
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 ¶
- func SortCoverages(cs []Coverage)
- type Coverage
- func (c *Coverage) IsCoverageLow(covThresholdInt int) bool
- func (c *Coverage) LineCovLink() string
- func (c *Coverage) Name() string
- func (c *Coverage) Percentage() string
- func (c *Coverage) PercentageForTestgrid() string
- func (c *Coverage) Ratio() (ratio float32, err error)
- func (c *Coverage) SetLineCovLink(link string)
- func (c *Coverage) String() string
- type CoverageList
- func (g *CoverageList) CovThresInt() int
- func (g *CoverageList) GetDirs() []string
- func (g *CoverageList) Group() *[]Coverage
- func (g *CoverageList) Item(index int) *Coverage
- func (g *CoverageList) Map() map[string]Coverage
- func (g *CoverageList) Percentage() string
- func (g *CoverageList) Report(itemized bool)
- func (g *CoverageList) Subset(prefix string) *CoverageList
- func (g *CoverageList) Summarize()
- type GroupChanges
- type Incremental
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 ¶
IsCoverageLow checks if the coverage is less than the threshold.
func (*Coverage) LineCovLink ¶
func (*Coverage) Percentage ¶
Percentage returns the percentage of statements covered
func (*Coverage) PercentageForTestgrid ¶
PercentageForTestgrid returns the percentage of statements covered
func (*Coverage) SetLineCovLink ¶
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 ¶
ContentForGithubPost constructs the message covbot posts
type Incremental ¶
type Incremental struct {
// contains filtered or unexported fields
}
func (Incremental) String ¶
func (inc Incremental) String() string