Documentation
¶
Index ¶
- func SetCategoriesConfig(config *types.CategoriesConfig)
- func ShouldAddPrimaryTech(rule types.Rule) bool
- func ShouldCreateComponent(rule types.Rule) bool
- func ShouldCreateEdges(rule types.Rule) bool
- type CodeStatsAnalyzer
- type ComponentRegistry
- type DependencyDetector
- type DependencyMatcher
- type LanguageDetector
- type Scanner
- func NewScanner(path string) (*Scanner, error)
- func NewScannerWithExcludes(path string, excludePatterns []string, verbose bool, useTreeView bool, ...) (*Scanner, error)
- func NewScannerWithOptions(path string, excludePatterns []string, verbose bool, useTreeView bool, ...) (*Scanner, error)
- func NewScannerWithOptionsAndLogger(path string, excludePatterns []string, verbose bool, useTreeView bool, ...) (*Scanner, error)
- func NewScannerWithOptionsAndRootID(path string, excludePatterns []string, verbose bool, useTreeView bool, ...) (*Scanner, error)
- func NewScannerWithSettings(path string, settings *config.Settings, mergedConfig *config.ScanConfig, ...) (*Scanner, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCategoriesConfig ¶
func SetCategoriesConfig(config *types.CategoriesConfig)
SetCategoriesConfig sets the global categories configuration
func ShouldAddPrimaryTech ¶
ShouldAddPrimaryTech determines if a rule should add primary tech when component is created Returns true if primary tech should be added, false otherwise
func ShouldCreateComponent ¶
ShouldCreateComponent determines if a rule should create a component Returns true if component should be created, false otherwise
func ShouldCreateEdges ¶
ShouldCreateEdges determines if a rule should create edges to its components Returns true if edges should be created, false otherwise
Types ¶
type CodeStatsAnalyzer ¶
type CodeStatsAnalyzer interface {
// ProcessFile analyzes a file
// language is the go-enry detected language name (used for grouping)
// If content is provided it will be used, otherwise file is read
ProcessFile(filename string, language string, content []byte)
// ProcessFileForComponent analyzes a file for a specific component
// componentID is used to group stats by component
// language is the go-enry detected language name (used for grouping)
// If content is provided it will be used, otherwise the file will be read
ProcessFileForComponent(filename string, language string, content []byte, componentID string)
// GetStats returns the aggregated statistics
GetStats() interface{}
// GetComponentStats returns statistics for a specific component
GetComponentStats(componentID string) interface{}
// IsEnabled returns whether code stats collection is enabled
IsEnabled() bool
// IsPerComponentEnabled returns whether per-component code stats collection is enabled
IsPerComponentEnabled() bool
}
CodeStatsAnalyzer interface for code statistics collection
type ComponentRegistry ¶
type ComponentRegistry struct {
// contains filtered or unexported fields
}
ComponentRegistry indexes components by their package identifiers per technology
func NewComponentRegistry ¶
func NewComponentRegistry() *ComponentRegistry
NewComponentRegistry creates a new component registry
func (*ComponentRegistry) Register ¶
func (r *ComponentRegistry) Register(component *types.Payload)
Register adds a component to the registry using registered package providers
type DependencyDetector ¶
type DependencyDetector struct {
// contains filtered or unexported fields
}
DependencyDetector handles dependency-based technology detection
func NewDependencyDetector ¶
func NewDependencyDetector(rules []types.Rule) *DependencyDetector
NewDependencyDetector creates a new dependency detector
func (*DependencyDetector) AddPrimaryTechIfNeeded ¶
func (d *DependencyDetector) AddPrimaryTechIfNeeded(payload *types.Payload, tech string)
AddPrimaryTechIfNeeded checks if a tech should be primary and adds it if needed
func (*DependencyDetector) MatchDependencies ¶
func (d *DependencyDetector) MatchDependencies(packages []string, depType string) map[string][]string
MatchDependencies matches a list of package names against dependency patterns
type DependencyMatcher ¶
DependencyMatcher represents a compiled dependency pattern
type LanguageDetector ¶
type LanguageDetector struct{}
LanguageDetector handles language detection using go-enry (GitHub Linguist)
func NewLanguageDetector ¶
func NewLanguageDetector() *LanguageDetector
NewLanguageDetector creates a new language detector
func (*LanguageDetector) DetectLanguage ¶
func (d *LanguageDetector) DetectLanguage(filename string, content []byte) string
DetectLanguage detects the programming language from a filename and optional content Uses content analysis for ambiguous extensions (e.g., .md could be Markdown or GCC Machine Description) Returns the detected language or empty string if not detected
func (*LanguageDetector) GetLanguageType ¶
func (d *LanguageDetector) GetLanguageType(language string) enry.Type
GetLanguageType returns the type of language (programming, markup, data, prose)
func (*LanguageDetector) IsLanguageFile ¶
func (d *LanguageDetector) IsLanguageFile(filename string) bool
IsLanguageFile checks if a file should be considered for language detection Excludes binary files, images, and other non-source files
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner handles the recursive directory scanning and technology detection logic
func NewScanner ¶
NewScanner creates a new scanner with the given options
func NewScannerWithExcludes ¶
func NewScannerWithExcludes(path string, excludePatterns []string, verbose bool, useTreeView bool, traceTimings bool, traceRules bool) (*Scanner, error)
NewScannerWithExcludes creates a new scanner with exclusion patterns
func NewScannerWithOptions ¶
func NewScannerWithOptions(path string, excludePatterns []string, verbose bool, useTreeView bool, traceTimings bool, traceRules bool, codeStats CodeStatsAnalyzer) (*Scanner, error)
NewScannerWithOptions creates a new scanner with all options including code stats
func NewScannerWithOptionsAndLogger ¶
func NewScannerWithOptionsAndLogger(path string, excludePatterns []string, verbose bool, useTreeView bool, traceTimings bool, traceRules bool, codeStats CodeStatsAnalyzer, logger *slog.Logger, rootID string, mergedConfig *config.ScanConfig) (*Scanner, error)
NewScannerWithOptionsAndLogger creates a new scanner with all options including logger
func NewScannerWithOptionsAndRootID ¶
func NewScannerWithOptionsAndRootID(path string, excludePatterns []string, verbose bool, useTreeView bool, traceTimings bool, traceRules bool, codeStats CodeStatsAnalyzer, rootID string) (*Scanner, error)
NewScannerWithOptionsAndRootID creates a new scanner with root ID override
func NewScannerWithSettings ¶
func NewScannerWithSettings(path string, settings *config.Settings, mergedConfig *config.ScanConfig, logger *slog.Logger) (*Scanner, error)
NewScannerWithSettings creates a new scanner with full settings support
func (*Scanner) ScanFile ¶
ScanFile performs analysis on a single file, treating it as a directory with just that file
func (*Scanner) SetUseLockFiles ¶
SetUseLockFiles sets whether lock files should be used for dependency resolution
func (*Scanner) UseLockFiles ¶
UseLockFiles returns whether lock files should be used for dependency resolution
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
githubactions
Package githubactions implements GitHub Actions workflow detection as a plugin-based component detector.
|
Package githubactions implements GitHub Actions workflow detection as a plugin-based component detector. |
|
Package parsers provides parsers for various dependency management files.
|
Package parsers provides parsers for various dependency management files. |
|
Package semver provides semantic version parsing and comparison for multiple package ecosystems.
|
Package semver provides semantic version parsing and comparison for multiple package ecosystems. |