leaves

package
v9.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 29 Imported by: 4

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"
	// ConfigBurndownHibernationThreshold sets the hibernation threshold for the underlying
	// RBTree allocator. It is useful to trade CPU time for reduced peak memory consumption
	// if there are many branches.
	ConfigBurndownHibernationThreshold = "Burndown.HibernationThreshold"
	// ConfigBurndownHibernationToDisk sets whether the hibernated RBTree allocator must be saved
	// on disk rather than kept in memory.
	ConfigBurndownHibernationToDisk = "Burndown.HibernationOnDisk"
	// ConfigBurndownHibernationDirectory sets the name of the temporary directory to use for
	// saving hibernated RBTree allocators.
	ConfigBurndownHibernationDirectory = "Burndown.HibernationDirectory"
	// 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.
	// The format is Semantic UASTv2, see https://docs.sourced.tech/babelfish/using-babelfish/uast-querying
	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.
	// The format is Semantic UASTv2, see https://docs.sourced.tech/babelfish/using-babelfish/uast-querying
	ConfigShotnessXpathName = "Shotness.XpathName"

	// DefaultShotnessXpathStruct is the default UAST XPath to choose the analysed nodes.
	// It extracts functions.
	DefaultShotnessXpathStruct = "//uast:FunctionGroup"
	// 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 = "/Nodes/uast:Alias/Name"
)
View Source
const (
	// ConfigDevsConsiderEmptyCommits is the name of the option to set DevsAnalysis.ConsiderEmptyCommits.
	ConfigDevsConsiderEmptyCommits = "Devs.ConsiderEmptyCommits"
)
View Source
const (
	// CouplesMaximumMeaningfulContextSize is the threshold on the number of files in a commit to
	// consider them as grouped together.
	CouplesMaximumMeaningfulContextSize = 1000
)

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

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

	// HibernationThreshold sets the hibernation threshold for the underlying
	// RBTree allocator. It is useful to trade CPU time for reduced peak memory consumption
	// if there are many branches.
	HibernationThreshold int

	// HibernationToDisk specifies whether the hibernated RBTree allocator must be saved on disk
	// rather than kept in memory.
	HibernationToDisk bool

	// HibernationDirectory is the name of the temporary directory to use for saving hibernated
	// RBTree allocators.
	HibernationDirectory string

	// 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) Boot

func (analyser *BurndownAnalysis) Boot() error

Boot decompresses the bound RBTree memory with the files.

func (*BurndownAnalysis) Configure

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

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) Hibernate

func (analyser *BurndownAnalysis) Hibernate() error

Hibernate compresses the bound RBTree memory with the files.

func (*BurndownAnalysis) Initialize

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

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 a path inside the Git repository. The value's dimensions are the same as
	// in GlobalHistory.
	FileHistories map[string]DenseHistory
	// The key is a path inside the Git repository. The value is a mapping from developer indexes
	// (see reversedPeopleDict) and the owned line numbers. Their sum equals to the total number of
	// lines in the file.
	FileOwnership map[string]map[int]int
	// [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 CommitStat added in v9.1.1

type CommitStat struct {
	Hash   string
	When   int64
	Author int
	Files  []FileStat
}

CommitStat is the statistics for a commit

type CommitsAnalysis added in v9.1.1

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

CommitsAnalysis extracts statistics for each commit

func (*CommitsAnalysis) Configure added in v9.1.1

func (ca *CommitsAnalysis) Configure(facts map[string]interface{}) error

Configure sets the properties previously published by ListConfigurationOptions().

func (*CommitsAnalysis) Consume added in v9.1.1

func (ca *CommitsAnalysis) 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 (*CommitsAnalysis) Description added in v9.1.1

func (ca *CommitsAnalysis) Description() string

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

func (*CommitsAnalysis) Finalize added in v9.1.1

func (ca *CommitsAnalysis) Finalize() interface{}

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

func (*CommitsAnalysis) Flag added in v9.1.1

func (ca *CommitsAnalysis) Flag() string

Flag for the command line switch which enables this analysis.

func (*CommitsAnalysis) Fork added in v9.1.1

func (ca *CommitsAnalysis) Fork(n int) []core.PipelineItem

Fork clones this pipeline item.

func (*CommitsAnalysis) Initialize added in v9.1.1

func (ca *CommitsAnalysis) Initialize(repository *git.Repository) error

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 (*CommitsAnalysis) ListConfigurationOptions added in v9.1.1

func (ca *CommitsAnalysis) ListConfigurationOptions() []core.ConfigurationOption

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

func (*CommitsAnalysis) Name added in v9.1.1

func (ca *CommitsAnalysis) Name() string

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

func (*CommitsAnalysis) Provides added in v9.1.1

func (ca *CommitsAnalysis) 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 (*CommitsAnalysis) Requires added in v9.1.1

func (ca *CommitsAnalysis) 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 (*CommitsAnalysis) Serialize added in v9.1.1

func (ca *CommitsAnalysis) 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 CommitsResult added in v9.1.1

type CommitsResult struct {
	Commits []*CommitStat
	// contains filtered or unexported fields
}

CommitsResult is returned by CommitsAnalysis.Finalize() and carries the statistics per commit.

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{}) error

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) error

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 is how many times developers changed files which were also changed by other developers.
	// The mapping's key is the other developer, and the value is the sum over all the files both developers changed.
	// Each element of that sum is min(C1, C2) where Ci is the number of commits developer i made which touched the file.
	PeopleMatrix []map[int]int64
	// PeopleFiles is how many times developers changed files. The first dimension (left []) is developers,
	// and the second dimension (right []) is file indexes.
	PeopleFiles [][]int
	// FilesMatrix is how many times file pairs occurred in the same commit.
	FilesMatrix []map[int]int64
	// FilesLines is the number of lines contained in each file from the last analyzed commit.
	FilesLines []int
	// Files is the names of the files. The order matches PeopleFiles' indexes and FilesMatrix.
	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.

y                  x

type DevDay

type DevDay struct {
	// Commits is the number of commits made by a particular developer in a particular day.
	Commits int
	items.LineStats
	// LanguagesDetection carries fine-grained line stats per programming language.
	Languages map[string]items.LineStats
}

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. Those numbers are additionally measured per language.

func (*DevsAnalysis) Configure

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

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) error

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 {
	// Hashes is the list of commit hashes which changed this file.
	Hashes []plumbing.Hash
	// People is the mapping from developers to the number of lines they altered.
	People map[int]items.LineStats
}

FileHistory is the gathered stats about a particular file.

type FileHistoryAnalysis

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

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

func (*FileHistoryAnalysis) Configure

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

Configure sets the properties previously published by ListConfigurationOptions().

func (*FileHistoryAnalysis) Consume

func (history *FileHistoryAnalysis) 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 (*FileHistoryAnalysis) Description

func (history *FileHistoryAnalysis) Description() string

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

func (*FileHistoryAnalysis) Finalize

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

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

func (*FileHistoryAnalysis) Flag

func (history *FileHistoryAnalysis) Flag() string

Flag for the command line switch which enables this analysis.

func (*FileHistoryAnalysis) Fork

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

Fork clones this PipelineItem.

func (*FileHistoryAnalysis) Initialize

func (history *FileHistoryAnalysis) Initialize(repository *git.Repository) error

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 (*FileHistoryAnalysis) ListConfigurationOptions

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

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

func (*FileHistoryAnalysis) Name

func (history *FileHistoryAnalysis) Name() string

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

func (*FileHistoryAnalysis) Provides

func (history *FileHistoryAnalysis) 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 (*FileHistoryAnalysis) Requires

func (history *FileHistoryAnalysis) 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 (*FileHistoryAnalysis) Serialize

func (history *FileHistoryAnalysis) 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]FileHistory
}

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

type FileStat added in v9.1.1

type FileStat struct {
	Name     string
	Language string
	items.LineStats
}

FileStat is the statistics for a file in a commit

type NodeSummary

type NodeSummary struct {
	Type string
	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{}) error

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) 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) error

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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