Documentation ¶
Index ¶
- Constants
- Variables
- func VisitEachNode(root nodes.Node, payload func(nodes.Node))
- type Change
- type Changes
- func (uc *Changes) Configure(facts map[string]interface{}) error
- func (uc *Changes) Consume(deps map[string]interface{}) (map[string]interface{}, error)
- func (uc *Changes) Fork(n int) []core.PipelineItem
- func (uc *Changes) Initialize(repository *git.Repository) error
- func (uc *Changes) ListConfigurationOptions() []core.ConfigurationOption
- func (uc *Changes) Name() string
- func (uc *Changes) Provides() []string
- func (uc *Changes) Requires() []string
- type ChangesSaver
- func (saver *ChangesSaver) Configure(facts map[string]interface{}) error
- func (saver *ChangesSaver) Consume(deps map[string]interface{}) (map[string]interface{}, error)
- func (saver *ChangesSaver) Description() string
- func (saver *ChangesSaver) Finalize() interface{}
- func (saver *ChangesSaver) Flag() string
- func (saver *ChangesSaver) Fork(n int) []core.PipelineItem
- func (saver *ChangesSaver) Initialize(repository *git.Repository) error
- func (saver *ChangesSaver) ListConfigurationOptions() []core.ConfigurationOption
- func (saver *ChangesSaver) Name() string
- func (saver *ChangesSaver) Provides() []string
- func (saver *ChangesSaver) Requires() []string
- func (saver *ChangesSaver) Serialize(result interface{}, binary bool, writer io.Writer) error
- type ChangesXPather
- type Extractor
- func (exr *Extractor) Configure(facts map[string]interface{}) error
- func (exr *Extractor) Consume(deps map[string]interface{}) (map[string]interface{}, error)
- func (exr *Extractor) Dispose()
- func (exr *Extractor) Features() []string
- func (exr *Extractor) Fork(n int) []core.PipelineItem
- func (exr *Extractor) Initialize(repository *git.Repository) error
- func (exr *Extractor) ListConfigurationOptions() []core.ConfigurationOption
- func (exr *Extractor) Name() string
- func (exr *Extractor) Provides() []string
- func (exr *Extractor) Requires() []string
- type FileDiffRefiner
- func (ref *FileDiffRefiner) Configure(facts map[string]interface{}) error
- func (ref *FileDiffRefiner) Consume(deps map[string]interface{}) (map[string]interface{}, error)
- func (ref *FileDiffRefiner) Features() []string
- func (ref *FileDiffRefiner) Fork(n int) []core.PipelineItem
- func (ref *FileDiffRefiner) Initialize(repository *git.Repository) error
- func (ref *FileDiffRefiner) ListConfigurationOptions() []core.ConfigurationOption
- func (ref *FileDiffRefiner) Name() string
- func (ref *FileDiffRefiner) Provides() []string
- func (ref *FileDiffRefiner) Requires() []string
Constants ¶
const ( // ConfigUASTEndpoint is the name of the configuration option (Extractor.Configure()) // which sets the Babelfish server address. ConfigUASTEndpoint = "UAST.Endpoint" // ConfigUASTTimeout is the name of the configuration option (Extractor.Configure()) // which sets the maximum amount of time to wait for a Babelfish server response. ConfigUASTTimeout = "UAST.Timeout" // ConfigUASTPoolSize is the name of the configuration option (Extractor.Configure()) // which sets the number of goroutines to run for UAST parse queries. ConfigUASTPoolSize = "UAST.PoolSize" // ConfigUASTFailOnErrors is the name of the configuration option (Extractor.Configure()) // which enables early exit in case of any Babelfish UAST parsing errors. ConfigUASTFailOnErrors = "UAST.FailOnErrors" // ConfigUASTIgnoreMissingDrivers is the name of the configuration option (Extractor.Configure()) // which sets the ignored missing driver names. ConfigUASTIgnoreMissingDrivers = "UAST.IgnoreMissingDrivers" // DefaultBabelfishEndpoint is the default address of the Babelfish parsing server. DefaultBabelfishEndpoint = "0.0.0.0:9432" // DefaultBabelfishTimeout is the default value of the RPC timeout in seconds. DefaultBabelfishTimeout = 20 // FeatureUast is the name of the Pipeline feature which activates all the items related to UAST. FeatureUast = "uast" // DependencyUasts is the name of the dependency provided by Extractor. DependencyUasts = "uasts" )
const ( // ConfigUASTChangesSaverOutputPath is the name of the configuration option // (ChangesSaver.Configure()) which sets the target directory where to save the files. ConfigUASTChangesSaverOutputPath = "ChangesSaver.OutputPath" )
const (
// DependencyUastChanges is the name of the dependency provided by Changes.
DependencyUastChanges = "changed_uasts"
)
Variables ¶
var ( // DefaultBabelfishWorkers is the default number of parsing RPC goroutines. DefaultBabelfishWorkers = runtime.NumCPU() * 2 // DefaultIgnoredMissingDrivers is the languages which are ignored if the Babelfish driver is missing. DefaultIgnoredMissingDrivers = []string{"markdown", "text", "yaml", "json"} )
Functions ¶
Types ¶
type Changes ¶
type Changes struct { core.NoopMerger // contains filtered or unexported fields }
Changes is a structured analog of TreeDiff: it provides UASTs for every logical change in a commit. It is a PipelineItem.
func (*Changes) Configure ¶
Configure sets the properties previously published by ListConfigurationOptions().
func (*Changes) Consume ¶
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 (*Changes) Fork ¶
func (uc *Changes) Fork(n int) []core.PipelineItem
Fork clones this PipelineItem.
func (*Changes) Initialize ¶
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 (*Changes) ListConfigurationOptions ¶
func (uc *Changes) ListConfigurationOptions() []core.ConfigurationOption
ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
func (*Changes) Name ¶
Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
type ChangesSaver ¶
type ChangesSaver struct { core.NoopMerger core.OneShotMergeProcessor // OutputPath points to the target directory with UASTs OutputPath string // contains filtered or unexported fields }
ChangesSaver dumps changed files and corresponding UASTs for every commit. it is a LeafPipelineItem.
func (*ChangesSaver) Configure ¶
func (saver *ChangesSaver) Configure(facts map[string]interface{}) error
Configure sets the properties previously published by ListConfigurationOptions().
func (*ChangesSaver) Consume ¶
func (saver *ChangesSaver) 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 (*ChangesSaver) Description ¶
func (saver *ChangesSaver) Description() string
Description returns the text which explains what the analysis is doing.
func (*ChangesSaver) Finalize ¶
func (saver *ChangesSaver) Finalize() interface{}
Finalize returns the result of the analysis. Further Consume() calls are not expected.
func (*ChangesSaver) Flag ¶
func (saver *ChangesSaver) Flag() string
Flag for the command line switch which enables this analysis.
func (*ChangesSaver) Fork ¶
func (saver *ChangesSaver) Fork(n int) []core.PipelineItem
Fork clones this PipelineItem.
func (*ChangesSaver) Initialize ¶
func (saver *ChangesSaver) 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 (*ChangesSaver) ListConfigurationOptions ¶
func (saver *ChangesSaver) ListConfigurationOptions() []core.ConfigurationOption
ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
func (*ChangesSaver) Name ¶
func (saver *ChangesSaver) Name() string
Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
func (*ChangesSaver) Provides ¶
func (saver *ChangesSaver) 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 (*ChangesSaver) Requires ¶
func (saver *ChangesSaver) 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.
type ChangesXPather ¶
type ChangesXPather struct {
XPath string
}
ChangesXPather extracts changed UAST nodes from files changed in the current commit.
type Extractor ¶
type Extractor struct { core.NoopMerger Endpoint string Context func() (context.Context, context.CancelFunc) PoolSize int FailOnErrors bool ProcessedFiles map[string]int IgnoredMissingDrivers map[string]bool // contains filtered or unexported fields }
Extractor retrieves UASTs from Babelfish server which correspond to changed files in a commit. It is a PipelineItem.
func (*Extractor) Configure ¶
Configure sets the properties previously published by ListConfigurationOptions().
func (*Extractor) Consume ¶
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 (*Extractor) Features ¶
Features which must be enabled for this PipelineItem to be automatically inserted into the DAG.
func (*Extractor) Fork ¶
func (exr *Extractor) Fork(n int) []core.PipelineItem
Fork clones this PipelineItem.
func (*Extractor) Initialize ¶
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 (*Extractor) ListConfigurationOptions ¶
func (exr *Extractor) ListConfigurationOptions() []core.ConfigurationOption
ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
func (*Extractor) Name ¶
Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
type FileDiffRefiner ¶
type FileDiffRefiner struct { core.NoopMerger // contains filtered or unexported fields }
FileDiffRefiner uses UASTs to improve the human interpretability of diffs. It is a PipelineItem. The idea behind this algorithm is simple: in case of multiple choices which are equally optimal, choose the one which touches less AST nodes.
func (*FileDiffRefiner) Configure ¶
func (ref *FileDiffRefiner) Configure(facts map[string]interface{}) error
Configure sets the properties previously published by ListConfigurationOptions().
func (*FileDiffRefiner) Consume ¶
func (ref *FileDiffRefiner) 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 (*FileDiffRefiner) Features ¶
func (ref *FileDiffRefiner) Features() []string
Features which must be enabled for this PipelineItem to be automatically inserted into the DAG.
func (*FileDiffRefiner) Fork ¶
func (ref *FileDiffRefiner) Fork(n int) []core.PipelineItem
Fork clones this PipelineItem.
func (*FileDiffRefiner) Initialize ¶
func (ref *FileDiffRefiner) 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 (*FileDiffRefiner) ListConfigurationOptions ¶
func (ref *FileDiffRefiner) ListConfigurationOptions() []core.ConfigurationOption
ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
func (*FileDiffRefiner) Name ¶
func (ref *FileDiffRefiner) Name() string
Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
func (*FileDiffRefiner) Provides ¶
func (ref *FileDiffRefiner) 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 (*FileDiffRefiner) Requires ¶
func (ref *FileDiffRefiner) 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.