Documentation
¶
Overview ¶
Package starcomplexity computes cyclomatic and cognitive complexity metrics for Starlark source files.
Index ¶
Constants ¶
const (
ComputeComplexity op.ActionName = "starcomplexity.compute_complexity"
)
Action-name constants for the starcomplexity provider's plan-mode actions.
Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComplexityReport ¶
type ComplexityReport struct {
Files []FileComplexity
}
ComplexityReport holds complexity results for all analyzed files.
type FileComplexity ¶
type FileComplexity struct {
Path string
Functions []FunctionComplexity
}
FileComplexity holds complexity results for a single file.
type FunctionComplexity ¶
type FunctionComplexity struct {
Name string
Line int
Cyclomatic int
Cognitive int
MaxNesting int
LOC int
Params int
}
FunctionComplexity holds complexity metrics for a single function.
type Provider ¶
type Provider struct {
op.ProviderBase
Root string
}
Provider computes cyclomatic and cognitive complexity metrics for Starlark source files.
func NewProvider ¶
func NewProvider(ctx *op.RuntimeEnvironment) *Provider
NewProvider creates a starcomplexity provider bound to the given runtime environment, rooted at the environment's Root when present.
func (*Provider) ComputeComplexity ¶
func (p *Provider) ComputeComplexity(files []string) (*ComplexityReport, error)
ComputeComplexity analyzes the given files for function complexity.