Documentation
¶
Overview ¶
Package complexity provides AST-based complexity analysis for functions across 206 languages using gotreesitter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnrichWithXref ¶
EnrichWithXref populates fan-in and fan-out metrics by matching functions against xref definitions.
Types ¶
type FunctionMetrics ¶
type FunctionMetrics struct {
File string `json:"file"`
Name string `json:"name"`
Kind string `json:"kind"`
Language string `json:"language"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Lines int `json:"lines"`
Cyclomatic int `json:"cyclomatic"`
Cognitive int `json:"cognitive"`
MaxNesting int `json:"max_nesting"`
Parameters int `json:"parameters"`
FanIn int `json:"fan_in"`
FanOut int `json:"fan_out"`
Returns int `json:"returns"`
BoolDepth int `json:"bool_depth"`
}
FunctionMetrics holds all computed complexity metrics for a single function or method.
type Options ¶
type Options struct {
MinCyclomatic int
Sort string // "cyclomatic", "cognitive", "lines", "nesting"
Top int
}
Options controls filtering, sorting, and limiting of the analysis output.
type Report ¶
type Report struct {
Functions []FunctionMetrics `json:"functions"`
Summary Summary `json:"summary"`
}
Report contains the full complexity analysis result.
type Summary ¶
type Summary struct {
Count int `json:"count"`
AvgCyclomatic float64 `json:"avg_cyclomatic"`
MaxCyclomatic int `json:"max_cyclomatic"`
P90Cyclomatic int `json:"p90_cyclomatic"`
AvgCognitive float64 `json:"avg_cognitive"`
MaxCognitive int `json:"max_cognitive"`
AvgLines float64 `json:"avg_lines"`
MaxLines int `json:"max_lines"`
AvgMaxNesting float64 `json:"avg_max_nesting"`
}
Summary holds aggregate statistics across all analyzed functions.
Click to show internal directories.
Click to hide internal directories.