typhoon

package module
v0.0.0-...-7637714 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: MIT Imports: 13 Imported by: 0

README

typhoon

Typhoon is a golang static analyzer made in go. Its goal is to target similar string literals in order to be able to identify typos

Yes, the name is a poor attempt at a word play with typo

Usage (command line args)

  • dir: string - Path containing the source to analyze. If none, will use os.Getwd()
  • dist: int - Levenshtein-Damerau distance threshold (default 2)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApproximateMatches

func GetApproximateMatches(tree Tree, queries []string, distance int) *map[string][]*ResultInfo

func ParseArgs

func ParseArgs() (*int, string)

Types

type ByNode

type ByNode []*Node

func (ByNode) Len

func (a ByNode) Len() int

func (ByNode) Less

func (a ByNode) Less(i, j int) bool

func (ByNode) Swap

func (a ByNode) Swap(i, j int)

type Node

type Node struct {
	Word     string
	Children map[int]*Node
	Position *token.Position
}

func NewNode

func NewNode(word string, position *token.Position) *Node

func (*Node) AddChild

func (n *Node) AddChild(key int, word string, position *token.Position)

func (*Node) ContainsKey

func (n *Node) ContainsKey(key int) bool

func (*Node) Keys

func (n *Node) Keys() []int

func (*Node) Node

func (n *Node) Node(key int) *Node

type ResultCandidate

type ResultCandidate struct {
	Query     string
	NodeWords string
	Result    []*Node
}

type ResultInfo

type ResultInfo struct {
	Node              *Node
	AssociatedQueries string
}

type Tree

type Tree struct {
	Root *Node
	Size int
}

func IndexSourcesFromPath

func IndexSourcesFromPath(pathArgPtr *string) (Tree, []string)

func (*Tree) Add

func (tree *Tree) Add(word string, position *token.Position)

func (*Tree) RecursiveSearch

func (tree *Tree) RecursiveSearch(node *Node, matches *[]*Node, word string, distance int)

func (*Tree) Search

func (tree *Tree) Search(word string, distance int) []*Node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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