Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Issue ¶
type Issue struct {
// The category of the issue
Category Category
// The severity of the issue
Severity Severity
// The message to display to the user
Message string
// The file path of the file that the issue was found in
Filepath string
// (optional) The AST node that caused the issue
Node *sitter.Node
// Id is a unique ID for the issue.
// Issue that have 'Id's can be explained using the `globstar desc` command.
Id *string
}
type Language ¶
type Language int
const ( LangUnknown Language = iota LangPy LangJs // vanilla JS and JSX LangTs // TypeScript (not TSX) LangTsx // TypeScript with JSX extension LangJava LangRuby LangRust LangYaml LangCss LangDockerfile LangMarkdown LangSql LangKotlin LangOCaml LangLua LangBash LangCsharp LangElixir LangElm LangGo LangGroovy LangHcl LangHtml LangPhp LangScala LangSwift )
func LanguageFromFilePath ¶
LanguageFromFilePath returns the Language of the file at the given path returns `LangUnkown` if the language is not recognized (e.g: `.txt` files).
type ParseResult ¶
type ParseResult struct {
// Ast is the root node of the tree-sitter parse-tree
// representing this file
Ast *sitter.Node
// Source is the raw source code of the file
Source []byte
// FilePath is the path to the file that was parsed
FilePath string
// Language is the tree-sitter language used to parse the file
TsLanguage *sitter.Language
// Language is the language of the file
Language Language
}
ParseResult is the result of parsing a file.
func ParseFile ¶
func ParseFile(filePath string) (*ParseResult, error)
ParseFile parses the file at the given path using the appropriate tree-sitter grammar.
type Pass ¶
type Pass struct {
Analyzer *Analyzer
FileContext *ParseResult
Files []*ParseResult
Report func(*Pass, *sitter.Node, string)
}
Click to show internal directories.
Click to hide internal directories.