hercules.v9: gopkg.in/src-d/hercules.v9/leaves/research Index | Files

package research

import "gopkg.in/src-d/hercules.v9/leaves/research"

Index

Package Files

typos.go

Constants

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

type Typo Uses

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 Uses

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 Uses

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

Configure sets the properties previously published by ListConfigurationOptions().

func (*TyposDatasetBuilder) Consume Uses

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 Uses

func (tdb *TyposDatasetBuilder) Description() string

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

func (*TyposDatasetBuilder) Finalize Uses

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

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

func (*TyposDatasetBuilder) Flag Uses

func (tdb *TyposDatasetBuilder) Flag() string

Flag for the command line switch which enables this analysis.

func (*TyposDatasetBuilder) Fork Uses

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

Fork clones this pipeline item.

func (*TyposDatasetBuilder) Initialize Uses

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 Uses

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

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

func (*TyposDatasetBuilder) Name Uses

func (tdb *TyposDatasetBuilder) Name() string

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

func (*TyposDatasetBuilder) Provides Uses

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 Uses

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 Uses

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 Uses

type TyposResult struct {
    Typos []Typo
}

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

Package research imports 16 packages (graph) and is imported by 1 packages. Updated 2019-03-19. Refresh now. Tools for package owners.