Documentation
¶
Overview ¶
Package starstats computes line and byte statistics for Starlark source files.
Index ¶
Constants ¶
const (
ComputeStats op.ActionName = "starstats.compute_stats"
)
Action-name constants for the starstats 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 Provider ¶
type Provider struct {
op.ProviderBase
Root string
}
Provider computes line and byte statistics for Starlark source files.
func NewProvider ¶
func NewProvider(ctx *op.RuntimeEnvironment) *Provider
NewProvider creates a starstats provider bound to the given runtime environment, rooted at the environment's Root when present.
func (*Provider) ComputeStats ¶
ComputeStats computes line and byte statistics for the given files. If withBytes is true, byte counts are included. If withLOC is true, line counts (LOC, SLOC, comments, blanks) are included.
type Stats ¶
type Stats struct {
Files []FileStats
Totals StatsTotals
}
Stats holds per-file and aggregate statistics.
type StatsTotals ¶
type StatsTotals struct {
FileCount int
TotalBytes int64
TotalLOC, TotalSLOC, TotalComments, TotalBlanks int
}
StatsTotals aggregates statistics across all files.