leaves

package
v5.0.0-...-3530ffb Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigBurndownGranularity is the name of the option to set BurndownAnalysis.Granularity.
	ConfigBurndownGranularity = "Burndown.Granularity"
	// ConfigBurndownSampling is the name of the option to set BurndownAnalysis.Sampling.
	ConfigBurndownSampling = "Burndown.Sampling"
	// ConfigBurndownTrackFiles enables burndown collection for files.
	ConfigBurndownTrackFiles = "Burndown.TrackFiles"
	// ConfigBurndownTrackPeople enables burndown collection for authors.
	ConfigBurndownTrackPeople = "Burndown.TrackPeople"
	// ConfigBurndownDebug enables some extra debug assertions.
	ConfigBurndownDebug = "Burndown.Debug"
	// DefaultBurndownGranularity is the default number of days for BurndownAnalysis.Granularity
	// and BurndownAnalysis.Sampling.
	DefaultBurndownGranularity = 30
)
View Source
const (
	// ConfigShotnessXpathStruct is the name of the configuration option (ShotnessAnalysis.Configure())
	// which sets the UAST XPath to choose the analysed nodes.
	ConfigShotnessXpathStruct = "Shotness.XpathStruct"
	// ConfigShotnessXpathName is the name of the configuration option (ShotnessAnalysis.Configure())
	// which sets the UAST XPath to find the name of the nodes chosen by ConfigShotnessXpathStruct.
	// These XPath-s can be different for some languages.
	ConfigShotnessXpathName = "Shotness.XpathName"

	// DefaultShotnessXpathStruct is the default UAST XPath to choose the analysed nodes.
	// It extracts functions.
	DefaultShotnessXpathStruct = "//*[@roleFunction and @roleDeclaration]"
	// DefaultShotnessXpathName is the default UAST XPath to choose the names of the analysed nodes.
	// It looks at the current tree level and at the immediate children.
	DefaultShotnessXpathName = "/*[@roleFunction and @roleIdentifier and @roleName] | /*/*[@roleFunction and @roleIdentifier and @roleName]"
)
View Source
const (
	// ConfigDevsConsiderEmptyCommits is the name of the option to set DevsAnalysis.ConsiderEmptyCommits.
	ConfigDevsConsiderEmptyCommits = "Devs.ConsiderEmptyCommits"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BurndownAnalysis

type BurndownAnalysis struct {
	// Granularity sets the size of each band - the number of days it spans.
	// Smaller values provide better resolution but require more work and eat more
	// memory. 30 days is usually enough.
	Granularity int
	// Sampling sets how detailed is the statistic - the size of the interval in
	// days between consecutive measurements. It may not be greater than Granularity. Try 15 or 30.
	Sampling int

	// TrackFiles enables or disables the fine-grained per-file burndown analysis.
	// It does not change the project level burndown results.
	TrackFiles bool

	// The number of developers for which to collect the burndown stats. 0 disables it.
	PeopleNumber int

	// Debug activates the debugging mode. Analyse() runs slower in this mode
	// but it accurately checks all the intermediate states for invariant
	// violations.
	Debug bool
	// contains filtered or unexported fields
}

BurndownAnalysis allows to gather the line burndown statistics for a Git repository. It is a LeafPipelineItem. Reference: https://erikbern.com/2016/12/05/the-half-life-of-code.html

func (*BurndownAnalysis) Configure

func (analyser *BurndownAnalysis) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*BurndownAnalysis) Consume

func (analyser *BurndownAnalysis) Consume(deps map[string]interface{}) (map[string]interface{}, error)

Consume runs this PipelineItem on the next commit's data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.

func (*BurndownAnalysis) Description

func (analyser *BurndownAnalysis) Description() string

Description returns the text which explains what the analysis is doing.

func (*BurndownAnalysis) Deserialize

func (analyser *BurndownAnalysis) Deserialize(pbmessage []byte) (interface{}, error)

Deserialize converts the specified protobuf bytes to BurndownResult.

func (*BurndownAnalysis) Finalize

func (analyser *BurndownAnalysis) Finalize() interface{}

Finalize returns the result of the analysis. Further Consume() calls are not expected.

func (*BurndownAnalysis) Flag

func (analyser *BurndownAnalysis) Flag() string

Flag for the command line switch which enables this analysis.

func (*BurndownAnalysis) Fork

func (analyser *BurndownAnalysis) Fork(n int) []core.PipelineItem

Fork clones this item. Everything is copied by reference except the files which are copied by value.

func (*BurndownAnalysis) Initialize

func (analyser *BurndownAnalysis) Initialize(repository *git.Repository)

Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.

func (*BurndownAnalysis) ListConfigurationOptions

func (analyser *BurndownAnalysis) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*BurndownAnalysis) Merge

func (analyser *BurndownAnalysis) Merge(branches []core.PipelineItem)

Merge combines several items together. We apply the special file merging logic here.

func (*BurndownAnalysis) MergeResults

func (analyser *BurndownAnalysis) MergeResults(
	r1, r2 interface{}, c1, c2 *core.CommonAnalysisResult) interface{}

MergeResults combines two BurndownResult-s together.

func (*BurndownAnalysis) Name

func (analyser *BurndownAnalysis) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*BurndownAnalysis) Provides

func (analyser *BurndownAnalysis) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*BurndownAnalysis) Requires

func (analyser *BurndownAnalysis) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

func (*BurndownAnalysis) Serialize

func (analyser *BurndownAnalysis) Serialize(result interface{}, binary bool, writer io.Writer) error

Serialize converts the analysis result as returned by Finalize() to text or bytes. The text format is YAML and the bytes format is Protocol Buffers.

type BurndownResult

type BurndownResult struct {
	// [number of samples][number of bands]
	// The number of samples depends on Sampling: the less Sampling, the bigger the number.
	// The number of bands depends on Granularity: the less Granularity, the bigger the number.
	GlobalHistory DenseHistory
	// The key is the path inside the Git repository. The value's dimensions are the same as
	// in GlobalHistory.
	FileHistories map[string]DenseHistory
	// [number of people][number of samples][number of bands]
	PeopleHistories []DenseHistory
	// [number of people][number of people + 2]
	// The first element is the total number of lines added by the author.
	// The second element is the number of removals by unidentified authors (outside reversedPeopleDict).
	// The rest of the elements are equal the number of line removals by the corresponding
	// authors in reversedPeopleDict: 2 -> 0, 3 -> 1, etc.
	PeopleMatrix DenseHistory
	// contains filtered or unexported fields
}

BurndownResult carries the result of running BurndownAnalysis - it is returned by BurndownAnalysis.Finalize().

type CouplesAnalysis

type CouplesAnalysis struct {
	core.NoopMerger
	core.OneShotMergeProcessor
	// PeopleNumber is the number of developers for which to build the matrix. 0 disables this analysis.
	PeopleNumber int
	// contains filtered or unexported fields
}

CouplesAnalysis calculates the number of common commits for files and authors. The results are matrices, where cell at row X and column Y is the number of commits which changed X and Y together. In case with people, the numbers are summed for every common file.

func (*CouplesAnalysis) Configure

func (couples *CouplesAnalysis) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*CouplesAnalysis) Consume

func (couples *CouplesAnalysis) Consume(deps map[string]interface{}) (map[string]interface{}, error)

Consume runs this PipelineItem on the next commit data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.

func (*CouplesAnalysis) Description

func (couples *CouplesAnalysis) Description() string

Description returns the text which explains what the analysis is doing.

func (*CouplesAnalysis) Deserialize

func (couples *CouplesAnalysis) Deserialize(pbmessage []byte) (interface{}, error)

Deserialize converts the specified protobuf bytes to CouplesResult.

func (*CouplesAnalysis) Finalize

func (couples *CouplesAnalysis) Finalize() interface{}

Finalize returns the result of the analysis. Further Consume() calls are not expected.

func (*CouplesAnalysis) Flag

func (couples *CouplesAnalysis) Flag() string

Flag for the command line switch which enables this analysis.

func (*CouplesAnalysis) Fork

func (couples *CouplesAnalysis) Fork(n int) []core.PipelineItem

Fork clones this pipeline item.

func (*CouplesAnalysis) Initialize

func (couples *CouplesAnalysis) Initialize(repository *git.Repository)

Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.

func (*CouplesAnalysis) ListConfigurationOptions

func (couples *CouplesAnalysis) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*CouplesAnalysis) MergeResults

func (couples *CouplesAnalysis) MergeResults(r1, r2 interface{}, c1, c2 *core.CommonAnalysisResult) interface{}

MergeResults combines two CouplesAnalysis-s together.

func (*CouplesAnalysis) Name

func (couples *CouplesAnalysis) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*CouplesAnalysis) Provides

func (couples *CouplesAnalysis) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*CouplesAnalysis) Requires

func (couples *CouplesAnalysis) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

func (*CouplesAnalysis) Serialize

func (couples *CouplesAnalysis) Serialize(result interface{}, binary bool, writer io.Writer) error

Serialize converts the analysis result as returned by Finalize() to text or bytes. The text format is YAML and the bytes format is Protocol Buffers.

type CouplesResult

type CouplesResult struct {
	PeopleMatrix []map[int]int64
	PeopleFiles  [][]int
	FilesMatrix  []map[int]int64
	Files        []string
	// contains filtered or unexported fields
}

CouplesResult is returned by CouplesAnalysis.Finalize() and carries couples matrices from authors and files.

type DenseHistory

type DenseHistory = [][]int64

DenseHistory is the matrix [number of samples][number of bands] -> number of lines.

type DevDay

type DevDay struct {
	// Commits is the number of commits made by a particular developer in a particular day.
	Commits int
	// Added is the number of added lines by a particular developer in a particular day.
	Added int
	// Removed is the number of removed lines by a particular developer in a particular day.
	Removed int
	// Changed is the number of changed lines by a particular developer in a particular day.
	Changed int
}

DevDay is the statistics for a development day and a particular developer.

type DevsAnalysis

type DevsAnalysis struct {
	core.NoopMerger
	core.OneShotMergeProcessor
	// ConsiderEmptyCommits indicates whether empty commits (e.g., merges) should be taken
	// into account.
	ConsiderEmptyCommits bool
	// contains filtered or unexported fields
}

DevsAnalysis calculates the number of commits through time per developer. It also records the numbers of added, deleted and changed lines through time per developer.

func (*DevsAnalysis) Configure

func (devs *DevsAnalysis) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*DevsAnalysis) Consume

func (devs *DevsAnalysis) Consume(deps map[string]interface{}) (map[string]interface{}, error)

Consume runs this PipelineItem on the next commit data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.

func (*DevsAnalysis) Description

func (devs *DevsAnalysis) Description() string

Description returns the text which explains what the analysis is doing.

func (*DevsAnalysis) Deserialize

func (devs *DevsAnalysis) Deserialize(pbmessage []byte) (interface{}, error)

Deserialize converts the specified protobuf bytes to DevsResult.

func (*DevsAnalysis) Finalize

func (devs *DevsAnalysis) Finalize() interface{}

Finalize returns the result of the analysis. Further Consume() calls are not expected.

func (*DevsAnalysis) Flag

func (devs *DevsAnalysis) Flag() string

Flag for the command line switch which enables this analysis.

func (*DevsAnalysis) Fork

func (devs *DevsAnalysis) Fork(n int) []core.PipelineItem

Fork clones this pipeline item.

func (*DevsAnalysis) Initialize

func (devs *DevsAnalysis) Initialize(repository *git.Repository)

Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.

func (*DevsAnalysis) ListConfigurationOptions

func (devs *DevsAnalysis) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*DevsAnalysis) MergeResults

func (devs *DevsAnalysis) MergeResults(r1, r2 interface{}, c1, c2 *core.CommonAnalysisResult) interface{}

MergeResults combines two DevsAnalysis-es together.

func (*DevsAnalysis) Name

func (devs *DevsAnalysis) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*DevsAnalysis) Provides

func (devs *DevsAnalysis) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*DevsAnalysis) Requires

func (devs *DevsAnalysis) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

func (*DevsAnalysis) Serialize

func (devs *DevsAnalysis) Serialize(result interface{}, binary bool, writer io.Writer) error

Serialize converts the analysis result as returned by Finalize() to text or bytes. The text format is YAML and the bytes format is Protocol Buffers.

type DevsResult

type DevsResult struct {
	// Days is <day index> -> <developer index> -> daily stats
	Days map[int]map[int]*DevDay
	// contains filtered or unexported fields
}

DevsResult is returned by DevsAnalysis.Finalize() and carries the daily statistics per developer.

type FileHistory

type FileHistory struct {
	core.NoopMerger
	core.OneShotMergeProcessor
	// contains filtered or unexported fields
}

FileHistory contains the intermediate state which is mutated by Consume(). It should implement LeafPipelineItem.

func (*FileHistory) Configure

func (history *FileHistory) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*FileHistory) Consume

func (history *FileHistory) Consume(deps map[string]interface{}) (map[string]interface{}, error)

Consume runs this PipelineItem on the next commit data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.

func (*FileHistory) Description

func (history *FileHistory) Description() string

Description returns the text which explains what the analysis is doing.

func (*FileHistory) Finalize

func (history *FileHistory) Finalize() interface{}

Finalize returns the result of the analysis. Further Consume() calls are not expected.

func (*FileHistory) Flag

func (history *FileHistory) Flag() string

Flag for the command line switch which enables this analysis.

func (*FileHistory) Fork

func (history *FileHistory) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*FileHistory) Initialize

func (history *FileHistory) Initialize(repository *git.Repository)

Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.

func (*FileHistory) ListConfigurationOptions

func (history *FileHistory) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*FileHistory) Name

func (history *FileHistory) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*FileHistory) Provides

func (history *FileHistory) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*FileHistory) Requires

func (history *FileHistory) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

func (*FileHistory) Serialize

func (history *FileHistory) Serialize(result interface{}, binary bool, writer io.Writer) error

Serialize converts the analysis result as returned by Finalize() to text or bytes. The text format is YAML and the bytes format is Protocol Buffers.

type FileHistoryResult

type FileHistoryResult struct {
	Files map[string][]plumbing.Hash
}

FileHistoryResult is returned by Finalize() and represents the analysis result.

type NodeSummary

type NodeSummary struct {
	InternalRole string
	Roles        []uast.Role
	Name         string
	File         string
}

NodeSummary carries the node attributes which annotate the "shotness" analysis' counters. These attributes are supposed to uniquely identify each node.

func (NodeSummary) String

func (node NodeSummary) String() string

type ShotnessAnalysis

type ShotnessAnalysis struct {
	core.NoopMerger
	core.OneShotMergeProcessor
	XpathStruct string
	XpathName   string
	// contains filtered or unexported fields
}

ShotnessAnalysis contains the intermediate state which is mutated by Consume(). It should implement LeafPipelineItem.

func (*ShotnessAnalysis) Configure

func (shotness *ShotnessAnalysis) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*ShotnessAnalysis) Consume

func (shotness *ShotnessAnalysis) Consume(deps map[string]interface{}) (map[string]interface{}, error)

Consume runs this PipelineItem on the next commit data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.

func (*ShotnessAnalysis) Description

func (shotness *ShotnessAnalysis) Description() string

Description returns the text which explains what the analysis is doing.

func (*ShotnessAnalysis) Features

func (shotness *ShotnessAnalysis) Features() []string

Features which must be enabled for this PipelineItem to be automatically inserted into the DAG.

func (*ShotnessAnalysis) Finalize

func (shotness *ShotnessAnalysis) Finalize() interface{}

Finalize returns the result of the analysis. Further Consume() calls are not expected.

func (*ShotnessAnalysis) Flag

func (shotness *ShotnessAnalysis) Flag() string

Flag returns the command line switch which activates the analysis.

func (*ShotnessAnalysis) Fork

func (shotness *ShotnessAnalysis) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*ShotnessAnalysis) Initialize

func (shotness *ShotnessAnalysis) Initialize(repository *git.Repository)

Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.

func (*ShotnessAnalysis) ListConfigurationOptions

func (shotness *ShotnessAnalysis) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*ShotnessAnalysis) Name

func (shotness *ShotnessAnalysis) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*ShotnessAnalysis) Provides

func (shotness *ShotnessAnalysis) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*ShotnessAnalysis) Requires

func (shotness *ShotnessAnalysis) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

func (*ShotnessAnalysis) Serialize

func (shotness *ShotnessAnalysis) Serialize(result interface{}, binary bool, writer io.Writer) error

Serialize converts the analysis result as returned by Finalize() to text or bytes. The text format is YAML and the bytes format is Protocol Buffers.

type ShotnessResult

type ShotnessResult struct {
	Nodes    []NodeSummary
	Counters []map[int]int
}

ShotnessResult is returned by ShotnessAnalysis.Finalize() and represents the analysis result.

Jump to

Keyboard shortcuts

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