blame

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlameDistribution

type BlameDistribution struct {
	// Freq contains likelihood counts that a commit was responsible
	// for the observed digest. The counts apply to the last len(Freq)
	// commits. When used as output structure in the GetBlame function
	// Freq contains the indices of commits.
	Freq []int `json:"freq"`

	// Old indicates whether the digest has been seen prior to the current
	// tile. In that case the blame might be unreliable.
	Old bool `json:"old"`
}

BlameDistribution contains a rough estimation of the probabilities that a commit was responsible for the contained digest. We also use it as the output structure for the front end.

type Blamer

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

Blamer calculates blame lists by continously loading tiles and changed expectations. It is not thread safe. The client of this package needs to make sure there are no conflicts.

func New

func New(storages *storage.Storage) *Blamer

New returns a new Blamer instance and error. The error is not nil if the first run of calculating the blame lists failed.

func (*Blamer) Calculate

func (b *Blamer) Calculate(tile *tiling.Tile) error

Calculate calculates the blame list from the given tile.

func (*Blamer) GetAllBlameLists

func (b *Blamer) GetAllBlameLists() (map[string]map[string]*BlameDistribution, []*tiling.Commit)

func (*Blamer) GetBlame

func (b *Blamer) GetBlame(testName string, digest string, commits []*tiling.Commit) *BlameDistribution

GetBlame returns the indices of the provided list of commits that likely caused the given test name/digest pair. If the result is empty we are not able to determine blame, because the test name/digest appeared prior to the current tile.

func (*Blamer) GetBlamesForTest

func (b *Blamer) GetBlamesForTest(testName string) []*WeightedBlame

GetBlamesForTest returns the list of authors that have blame assigned to them for the given test.

type WeightedBlame

type WeightedBlame struct {
	Author string  `json:"author"`
	Prob   float64 `json:"prob"`
}

WeightedBlame combines an authors name with a probabily that she is on a blamelist this is aggregated over the digests of a test.

type WeightedBlameSlice

type WeightedBlameSlice []*WeightedBlame

Sorting wrapper around WeightedBlame.

func (WeightedBlameSlice) Len

func (w WeightedBlameSlice) Len() int

func (WeightedBlameSlice) Less

func (w WeightedBlameSlice) Less(i, j int) bool

func (WeightedBlameSlice) Swap

func (w WeightedBlameSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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