Documentation
¶
Overview ¶
Package types holds value types shared between the indexer and store packages, kept neutral to avoid an import cycle between them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallSite ¶
CallSite is a single call from one function to another. CalleeName is the textual name; Qualifier is the import path of the package the callee was selected from (fmt for fmt.Errorf, os.path for os.path.join), or "" for a local, builtin, or method call. Deferred marks a call made inside a defer statement or finally block.
type FileRecord ¶
type FileRecord struct {
Path string
Language string
Scope string
Imports []Import
HeaderHash string
HeaderText string
}
FileRecord is one parsed source file's file-level facts. HeaderHash is a hash of the file's normalized leading comment block, "" when there is none; HeaderText is that block's first line, for display.
type Fingerprint ¶
type Fingerprint struct {
FunctionLength int `json:"function_length"`
ParamCount int `json:"param_count"`
CommentDensity float64 `json:"comment_density"`
CommentStyle string `json:"comment_style"`
EarlyReturns int `json:"early_returns"`
NestingDepth int `json:"nesting_depth"`
BranchCount int `json:"branch_count"`
LoopCount int `json:"loop_count"`
LoopNestingDepth int `json:"loop_nesting_depth"`
Recursion string `json:"recursion"`
CallsIntoLoops bool `json:"calls_into_loops"`
ErrorStyle string `json:"error_style"`
PropagatesErrors *bool `json:"propagates_errors"`
AllocationCount int `json:"allocation_count"`
CleanupPattern string `json:"cleanup_pattern"`
AcquiresLocks []string `json:"acquires_locks"`
MutatesArgs *bool `json:"mutates_args"`
MutatesGlobals *bool `json:"mutates_globals"`
DoesIO bool `json:"does_io"`
// LowConfidenceFields lists field names whose values were computed
// via heuristic and may have higher false-positive/negative rates.
LowConfidenceFields []string `json:"low_confidence_fields,omitempty"`
// Convention facts: syntactic properties mined as conventions.
Exported bool `json:"exported"`
HasDoc bool `json:"has_doc"`
DocStartsWithName bool `json:"doc_starts_with_name"`
ReceiverType string `json:"receiver_type,omitempty"`
ReceiverName string `json:"receiver_name,omitempty"`
TestFunction bool `json:"test_function"`
Benchmark bool `json:"benchmark,omitempty"` // Go Benchmark* or Fuzz*: reports through testing.B/F
TestHelper bool `json:"test_helper"`
CallsTHelper bool `json:"calls_t_helper"`
CallsTParallel bool `json:"calls_t_parallel"`
// ErrorSites counts how each error-handling site in the function
// treats the error, by class name (see indexer/errors.go). Absent
// classes are zero.
ErrorSites map[string]int `json:"error_sites,omitempty"`
}
Fingerprint captures behavioral properties of a function. Fields above the divider are language-agnostic and computed in this stage; fields below are language-specific and filled by a separate stage. Pointer and zero-valued language-specific fields serialize to JSON null/""/[] to signal "not yet computed".
type FunctionRecord ¶
type FunctionRecord struct {
FilePath string
Language string
Name string
StartLine int
EndLine int
CodeChunk string
ASTShapeHash string
ASTShapeNamedHash string
Scope string
Calls []CallSite
Fingerprint Fingerprint
}
FunctionRecord is one named-function unit produced by the parser stage for downstream stages to consume. ASTShapeHash includes anonymous (grammar-token) child nodes; ASTShapeNamedHash includes only named nodes for a token-independent structural fingerprint. Scope is the mining scope the function belongs to: its directory, suffixed "#test" when the file is a test file.