deps

package
v1.81.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(filepath string, language heartbeat.Language) ([]string, error)

Detect parses the dependencies from a heartbeat file of a specific language.

func WithDetection

func WithDetection(c Config) heartbeat.HandleOption

WithDetection initializes and returns a heartbeat handle option, which can be used in a heartbeat processing pipeline to detect dependencies inside the entity file of heartbeats of type FileType. Will prioritize local file if available.

Types

type Config

type Config struct {
	// FilePatterns will be matched against a file entities name and if matching, will skip
	// dependency scanning.
	FilePatterns []regex.Regex
}

Config contains configurations for dependency scanning.

type DependencyParser

type DependencyParser interface {
	Parse(filepath string) ([]string, error)
}

DependencyParser is a dependency parser for a programming language.

type ParserC

type ParserC struct {
	State  StateC
	Output []string
}

ParserC is a dependency parser for the c programming language. It is not thread safe.

func (*ParserC) Parse

func (p *ParserC) Parse(filepath string) ([]string, error)

Parse parses dependencies from C file content using the C lexer.

type ParserCSharp

type ParserCSharp struct {
	Buffer string
	Output []string
	State  StateCSharp
}

ParserCSharp is a dependency parser for the c# programming language. It is not thread safe.

func (*ParserCSharp) Parse

func (p *ParserCSharp) Parse(filepath string) ([]string, error)

Parse parses dependencies from C# file content using the chroma C# lexer.

type ParserElm

type ParserElm struct {
	State  StateElm
	Output []string
}

ParserElm is a dependency parser for the elm programming language. It is not thread safe.

func (*ParserElm) Parse

func (p *ParserElm) Parse(filepath string) ([]string, error)

Parse parses dependencies from Elm file content using the chroma Elm lexer.

type ParserGo

type ParserGo struct {
	Parenthesis int
	State       StateGo
	Output      []string
}

ParserGo is a dependency parser for the go programming language. It is not thread safe.

func (*ParserGo) Parse

func (p *ParserGo) Parse(filepath string) ([]string, error)

Parse parses dependencies from Golang file content using the chroma Golang lexer.

type ParserHTML

type ParserHTML struct {
	CurrentAttribute string
	CurrentTag       string
	State            StateHTML
	Output           []string
}

ParserHTML is a dependency parser for the HTML markup language. It is not thread safe.

func (*ParserHTML) Parse

func (p *ParserHTML) Parse(filepath string) ([]string, error)

Parse parses dependencies from HTML file content via ReadCloser using the chroma HTML lexer.

type ParserHaskell

type ParserHaskell struct {
	State  StateHaskell
	Output []string
}

ParserHaskell is a dependency parser for the Haskell programming language. It is not thread safe.

func (*ParserHaskell) Parse

func (p *ParserHaskell) Parse(filepath string) ([]string, error)

Parse parses dependencies from Haskell file content using the chroma Haskell lexer.

type ParserHaxe

type ParserHaxe struct {
	State  StateHaxe
	Output []string
}

ParserHaxe is a dependency parser for the Haxe programming language. It is not thread safe.

func (*ParserHaxe) Parse

func (p *ParserHaxe) Parse(filepath string) ([]string, error)

Parse parses dependencies from Haxe file content using the chroma Haxe lexer.

type ParserJSON

type ParserJSON struct {
	Level  int
	Output []string
	State  StateJSON
}

ParserJSON is a dependency parser for JSON parser. It is not thread safe.

func (*ParserJSON) Parse

func (p *ParserJSON) Parse(filepath string) ([]string, error)

Parse parses dependencies from JSON file content using the chroma JSON lexer.

type ParserJava

type ParserJava struct {
	Buffer string
	Output []string
	State  StateJava
}

ParserJava is a dependency parser for the java programming language. It is not thread safe.

func (*ParserJava) Parse

func (p *ParserJava) Parse(filepath string) ([]string, error)

Parse parses dependencies from Java file content using the chroma Java lexer.

type ParserJavaScript

type ParserJavaScript struct {
	State  StateJavaScript
	Output []string
}

ParserJavaScript is a dependency parser for the JavaScript programming language. It is not thread safe.

func (*ParserJavaScript) Parse

func (p *ParserJavaScript) Parse(filepath string) ([]string, error)

Parse parses dependencies from JavaScript file content using the chroma JavaScript lexer.

type ParserKotlin

type ParserKotlin struct {
	State  StateKotlin
	Output []string
}

ParserKotlin is a dependency parser for the Kotlin programming language. It is not thread safe.

func (*ParserKotlin) Parse

func (p *ParserKotlin) Parse(filepath string) ([]string, error)

Parse parses dependencies from Kotlin file content using the chroma Kotlin lexer.

type ParserObjectiveC

type ParserObjectiveC struct {
	State  StateObjectiveC
	Output []string
}

ParserObjectiveC is a dependency parser for the objective-c programming language. It is not thread safe.

func (*ParserObjectiveC) Parse

func (p *ParserObjectiveC) Parse(filepath string) ([]string, error)

Parse parses dependencies from Objective-C file content using the chroma Objective-C lexer.

type ParserPHP

type ParserPHP struct {
	State  StatePHP
	Output []string
}

ParserPHP is a dependency parser for the php programming language. It is not thread safe.

func (*ParserPHP) Parse

func (p *ParserPHP) Parse(filepath string) ([]string, error)

Parse parses dependencies from PHP file content using the chroma PHP lexer.

type ParserPython

type ParserPython struct {
	State  StatePython
	Buffer string
	Output []string
}

ParserPython is a dependency parser for the python programming language. It is not thread safe.

func (*ParserPython) Parse

func (p *ParserPython) Parse(filepath string) ([]string, error)

Parse parses dependencies from Python file content using the chroma Python lexer.

type ParserRust

type ParserRust struct {
	State  StateRust
	Output []string
}

ParserRust is a dependency parser for the rust programming language. It is not thread safe.

func (*ParserRust) Parse

func (p *ParserRust) Parse(filepath string) ([]string, error)

Parse parses dependencies from Rust file content using the chroma Rust lexer.

type ParserScala

type ParserScala struct {
	State  StateScala
	Output []string
}

ParserScala is a dependency parser for the Scala programming language. It is not thread safe.

func (*ParserScala) Parse

func (p *ParserScala) Parse(filepath string) ([]string, error)

Parse parses dependencies from Scala file content using the chroma Scala lexer.

type ParserSwift

type ParserSwift struct {
	State  StateSwift
	Output []string
}

ParserSwift is a dependency parser for the swift programming language. It is not thread safe.

func (*ParserSwift) Parse

func (p *ParserSwift) Parse(filepath string) ([]string, error)

Parse parses dependencies from Swift file content using the chroma Swift lexer.

type ParserUnknown

type ParserUnknown struct {
	Output []string
}

ParserUnknown is a dependency parser for unknown parser. It is not thread safe.

func (*ParserUnknown) Parse

func (p *ParserUnknown) Parse(fp string) ([]string, error)

Parse parses dependencies from any file content via ReadCloser using the chroma golang lexer.

type ParserVbNet

type ParserVbNet struct {
	Buffer string
	Output []string
	State  StateVbNet
}

ParserVbNet is a dependency parser for the vb.net programming language. It is not thread safe.

func (*ParserVbNet) Parse

func (p *ParserVbNet) Parse(filepath string) ([]string, error)

Parse parses dependencies from VB.Net file content using the chroma VB.Net lexer.

type StateC

type StateC int

StateC is a token parsing state.

const (
	// StateCUnknown represents a unknown token parsing state.
	StateCUnknown StateC = iota
	// StateCImport means we are in import section during token parsing.
	StateCImport
)

type StateCSharp

type StateCSharp int

StateCSharp is a token parsing state.

const (
	// StateCSharpUnknown represents a unknown token parsing state.
	StateCSharpUnknown StateCSharp = iota
	// StateCSharpImport means we are in import section during token parsing.
	StateCSharpImport
)

type StateElm

type StateElm int

StateElm is a token parsing state.

const (
	// StateElmUnknown represents a unknown token parsing state.
	StateElmUnknown StateElm = iota
	// StateElmImport means we are in import during token parsing.
	StateElmImport
)

type StateGo

type StateGo int

StateGo is a token parsing state.

const (
	// StateGoUnknown represents a unknown token parsing state.
	StateGoUnknown StateGo = iota
	// StateGoImport means we are in import section during token parsing.
	StateGoImport
)

type StateHTML

type StateHTML int

StateHTML is a token parsing state.

const (
	// StateHTMLUnknown represents an unknown token parsing state.
	StateHTMLUnknown StateHTML = iota
	// StateHTMLTag means we are inside an html tag during token parsing.
	StateHTMLTag
)

type StateHaskell

type StateHaskell int

StateHaskell is a token parsing state.

const (
	// StateHaskellUnknown represents an unknown token parsing state.
	StateHaskellUnknown StateHaskell = iota
	// StateHaskellImport means we are in import section during token parsing.
	StateHaskellImport
)

type StateHaxe

type StateHaxe int

StateHaxe is a token parsing state.

const (
	// StateHaxeUnknown represents an unknown token parsing state.
	StateHaxeUnknown StateHaxe = iota
	// StateHaxeImport means we are in import section during token parsing.
	StateHaxeImport
)

type StateJSON

type StateJSON int

StateJSON is a token parsing state.

const (
	// StateJSONUnknown represents a unknown token parsing state.
	StateJSONUnknown StateJSON = iota
	// StateJSONDependencies means we are in dependencies section during token parsing.
	StateJSONDependencies
)

type StateJava

type StateJava int

StateJava is a token parsing state.

const (
	// StateJavaUnknown represents a unknown token parsing state.
	StateJavaUnknown StateJava = iota
	// StateJavaImport means we are in import section during token parsing.
	StateJavaImport
	// StateJavaImportFinished means we finished import section during token parsing.
	StateJavaImportFinished
)

type StateJavaScript

type StateJavaScript int

StateJavaScript is a token parsing state.

const (
	// StateJavaScriptUnknown represents an unknown token parsing state.
	StateJavaScriptUnknown StateJavaScript = iota
	// StateJavaScriptImport means we are in import section during token parsing.
	StateJavaScriptImport
)

type StateKotlin

type StateKotlin int

StateKotlin is a token parsing state.

const (
	// StateKotlinUnknown represents an unknown token parsing state.
	StateKotlinUnknown StateKotlin = iota
	// StateKotlinImport means we are in import section during token parsing.
	StateKotlinImport
)

type StateObjectiveC

type StateObjectiveC int

StateObjectiveC is a token parsing state.

const (
	// StateObjectiveCUnknown represents a unknown token parsing state.
	StateObjectiveCUnknown StateObjectiveC = iota
	// StateObjectiveCHash means we are in hash section during token parsing.
	StateObjectiveCHash
)

type StatePHP

type StatePHP int

StatePHP is a token parsing state.

const (
	// StatePHPUnknown represents a unknown php token parsing state.
	StatePHPUnknown StatePHP = iota
	// StatePHPUse represents php token parsing state use.
	StatePHPUse
	// StatePHPUseFunction represents php token parsing state use function.
	StatePHPUseFunction
	// StatePHPInclude represents php token parsing state include.
	StatePHPInclude
	// StatePHPAs represents php token parsing state as.
	StatePHPAs
)

type StatePython

type StatePython int

StatePython is a token parsing state.

const (
	// StatePythonUnknown represents an unknown token parsing state.
	StatePythonUnknown StatePython = iota
	// StatePythonFrom means we are in from section of import during token parsing.
	StatePythonFrom
	// StatePythonImport means we are in import section during token parsing.
	StatePythonImport
)

type StateRust

type StateRust int

StateRust is a token parsing state.

const (
	// StateRustUnknown represents a unknown token parsing state.
	StateRustUnknown StateRust = iota
	// StateRustExtern means we are in extern section during token parsing.
	StateRustExtern
	// StateRustExternCrate means we are in extern crate section during token parsing.
	StateRustExternCrate
)

type StateScala

type StateScala int

StateScala is a token parsing state.

const (
	// StateScalaUnknown represents an unknown token parsing state.
	StateScalaUnknown StateScala = iota
	// StateScalaImport means we are in import section during token parsing.
	StateScalaImport
)

type StateSwift

type StateSwift int

StateSwift is a token parsing state.

const (
	// StateSwiftUnknown represents unknown token parsing state.
	StateSwiftUnknown StateSwift = iota
	// StateSwiftImport means we are in hash section during token parsing.
	StateSwiftImport
)

type StateVbNet

type StateVbNet int

StateVbNet is a token parsing state.

const (
	// StateVbNetUnknown represents a unknown token parsing state.
	StateVbNetUnknown StateVbNet = iota
	// StateVbNetImport means we are in import section during token parsing.
	StateVbNetImport
)

Jump to

Keyboard shortcuts

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