Documentation
¶
Index ¶
- Variables
- func DetectReference(line string) bool
- func ExpandGlobPattern(pattern string) ([]string, error)
- func ExtractReference(line string) string
- func FormatOutput(result *ScanResult, singleFile bool, typeFilter string) string
- func RegisterPrefix(prefix string)
- type Reference
- type ScanResult
- type SourceRef
Constants ¶
This section is empty.
Variables ¶
var ( // DetectionRegex is rebuilt when prefixes change. DetectionRegex *regexp.Regexp )
Functions ¶
func DetectReference ¶
DetectReference checks if a line contains a source reference.
func ExpandGlobPattern ¶
ExpandGlobPattern expands a glob pattern to a list of file paths. Returns sorted file paths.
Supported patterns:
- "**/*" or "**" — matches all files recursively (special-cased)
- Standard filepath.Match patterns (e.g. "*.go", "src/*.txt")
Note: arbitrary recursive glob patterns like "src/**/*.go" are NOT supported. Only the exact literals "**" and "**/*" trigger recursive matching; all other patterns are matched per-segment via filepath.Match.
func ExtractReference ¶
ExtractReference extracts the reference string from a line.
func FormatOutput ¶
func FormatOutput(result *ScanResult, singleFile bool, typeFilter string) string
FormatOutput formats the scan results for output. If singleFile is true, returns a flat list. Otherwise, groups by file with headers.
func RegisterPrefix ¶
func RegisterPrefix(prefix string)
RegisterPrefix adds a short-notation prefix (e.g. "mytool") so that "mytool:feature/foo" is recognized as a source reference. Also registers "mytool.io" as an expanded URL domain.
Types ¶
type Reference ¶
Reference represents a parsed source reference found in source code.
func GetUniqueReferences ¶
func GetUniqueReferences(result *ScanResult, typeFilter string) []*Reference
GetUniqueReferences extracts unique references from a ScanResult, optionally filtered by type. Returns references sorted by (resolved_path, cross_repo_suffix).
func ParseReference ¶
ParseReference parses an extracted reference string and returns a Reference.
type ScanResult ¶
type ScanResult struct {
// FileRefs maps file path to list of references found in that file
FileRefs map[string][]*Reference
}
ScanResult represents the references found in a set of files.
func ScanFiles ¶
func ScanFiles(filePaths []string) (*ScanResult, error)
ScanFiles scans a list of files for source references. Returns a ScanResult with all references grouped by file. The result may be partial if some files fail; errors are accumulated and returned alongside whatever refs were successfully scanned.