research

package
v9.3.0+incompatible 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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaximumAllowedTypoDistance is the default value of the maximum Levenshtein distance
	// between two identifiers to consider them a typo-fix pair.
	DefaultMaximumAllowedTypoDistance = 4
	// ConfigTyposDatasetMaximumAllowedDistance is the name of the configuration option
	// (`TyposDatasetBuilder.Configure()`) which sets the maximum Levenshtein distance between
	// two identifiers to consider them a typo-fix pair.
	ConfigTyposDatasetMaximumAllowedDistance = "TyposDatasetBuilder.MaximumAllowedDistance"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Typo

type Typo struct {
	Wrong   string
	Correct string
	Commit  plumbing.Hash
	File    string
	Line    int
}

Typo carries the information about a typo-fix pair.

type TyposDatasetBuilder

type TyposDatasetBuilder struct {
	core.NoopMerger

	// MaximumAllowedDistance is the maximum Levenshtein distance between two identifiers
	// to consider them a typo-fix pair.
	MaximumAllowedDistance int
	// contains filtered or unexported fields
}

TyposDatasetBuilder collects pairs of typo-fix in source code identifiers.

func (*TyposDatasetBuilder) Configure

func (tdb *TyposDatasetBuilder) Configure(facts map[string]interface{}) error

Configure sets the properties previously published by ListConfigurationOptions().

func (*TyposDatasetBuilder) Consume

func (tdb *TyposDatasetBuilder) 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 (*TyposDatasetBuilder) Description

func (tdb *TyposDatasetBuilder) Description() string

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

func (*TyposDatasetBuilder) Finalize

func (tdb *TyposDatasetBuilder) Finalize() interface{}

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

func (*TyposDatasetBuilder) Flag

func (tdb *TyposDatasetBuilder) Flag() string

Flag for the command line switch which enables this analysis.

func (*TyposDatasetBuilder) Fork

func (tdb *TyposDatasetBuilder) Fork(n int) []core.PipelineItem

Fork clones this pipeline item.

func (*TyposDatasetBuilder) Initialize

func (tdb *TyposDatasetBuilder) 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 (*TyposDatasetBuilder) ListConfigurationOptions

func (tdb *TyposDatasetBuilder) ListConfigurationOptions() []core.ConfigurationOption

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

func (*TyposDatasetBuilder) Name

func (tdb *TyposDatasetBuilder) Name() string

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

func (*TyposDatasetBuilder) Provides

func (tdb *TyposDatasetBuilder) 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 (*TyposDatasetBuilder) Requires

func (tdb *TyposDatasetBuilder) 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 (*TyposDatasetBuilder) Serialize

func (tdb *TyposDatasetBuilder) 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 TyposResult

type TyposResult struct {
	Typos []Typo
}

TyposResult is returned by TyposDatasetBuilder.Finalize() and carries the found typo-fix pairs of identifiers.

Jump to

Keyboard shortcuts

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