Documentation
¶
Overview ¶
Package starcode provides Starlark source file capture with glob pattern matching, .gitignore awareness, and optional .bzl file inclusion.
Index ¶
- type Provider
- type Sources
- func (s *Sources) Analyze(cfg staranalysis.AnalysisConfig) (*staranalysis.AnalysisReport, error)
- func (s *Sources) Count() int
- func (s *Sources) Index(withDocstrings, withGlobals bool) (*starindex.Index, error)
- func (s *Sources) Paths() []string
- func (s *Sources) Stats(withBytes, withLOC bool) (*starstats.Stats, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
op.ProviderBase
Root string
}
Provider performs Starlark source capture.
+devlore:access=immediate
func NewProvider ¶
func (*Provider) Capture ¶
Capture collects Starlark source files matching the given pattern. If gitignore is true, files excluded by .gitignore rules are skipped. If includeBzl is true, .bzl files are included alongside .star files.
+devlore:defaults gitignore=true,includeBzl=true
Parameters:
- pattern: the glob pattern to match (supports **).
- gitignore: when true, skip files excluded by .gitignore rules.
- includeBzl: when true, include .bzl files alongside .star files.
Returns:
- *Sources: the captured file set with root and sorted paths.
- error: non-nil if the root directory cannot be resolved or the walk fails.
type Sources ¶
type Sources struct {
Root string // absolute root directory
Files []string // absolute paths, sorted
}
Sources holds a captured set of Starlark source files.
func (*Sources) Analyze ¶
func (s *Sources) Analyze(cfg staranalysis.AnalysisConfig) (*staranalysis.AnalysisReport, error)
Analyze performs a combined analysis of all captured files.
+devlore:struct_param cfg=staranalysis.AnalysisConfig
Parameters:
- cfg: the analysis configuration.
Returns:
- *staranalysis.AnalysisReport: the combined analysis report.
- error: non-nil if analysis fails.
func (*Sources) Index ¶
Index parses all captured files and extracts functions, loads, and globals. If withDocstrings is true, function docstrings are extracted. If withGlobals is true, top-level assignments are captured.
+devlore:defaults withDocstrings=true,withGlobals=true
Parameters:
- withDocstrings: when true, extract function docstrings.
- withGlobals: when true, capture top-level assignments.
Returns:
- *starindex.Index: the parsed index with functions, loads, and globals.
- error: non-nil if parsing fails.
func (*Sources) Paths ¶
Paths returns the file paths relative to Root.
Returns:
- []string: relative paths for all captured files.
func (*Sources) Stats ¶
Stats computes line and byte statistics for all captured files. If withBytes is true, byte counts are included. If withLOC is true, line counts (LOC, SLOC, comments, blanks) are included.
+devlore:defaults withBytes=true,withLOC=true
Parameters:
- withBytes: when true, include byte counts.
- withLOC: when true, include line counts (LOC, SLOC, comments, blanks).
Returns:
- *starstats.Stats: the computed statistics.
- error: non-nil if stat computation fails.