Documentation
¶
Index ¶
- func ApplyRootSignals(repoPath string, signals []RootSignal, detection *language.Detection, ...) error
- func BuildDependencyReportFromStats(name, languageID string, stats DependencyStats) report.DependencyReport
- func BuildRequestedDependencies[S any](req language.Request, scan S, normalizeDependencyID func(string) string, ...) ([]report.DependencyReport, []string)
- func BuildRequestedDependenciesWithWeights[S any](req language.Request, scan S, normalizeDependencyID func(string) string, ...) ([]report.DependencyReport, []string)
- func BuildTopReports(topN int, dependencies []string, ...) ([]report.DependencyReport, []string)
- func CountUsage(content []byte, imports []ImportRecord) map[string]int
- func DedupeWarnings(warnings []string) []string
- func DefaultRepoPath(repoPath string) string
- func DetectMatched(ctx context.Context, repoPath string, ...) (bool, error)
- func FallbackDependency(module string, normalize func(string) string) string
- func FinalizeDetection(repoPath string, detection language.Detection, roots map[string]struct{}) language.Detection
- func FirstContentColumn(line string) int
- func HasWildcardImport(imports []report.ImportUse) bool
- func IsGradleVersionCatalogFile(name string) bool
- func IsPathWithin(root, candidate string) bool
- func LastModuleSegment(module string) string
- func ListDependencies(files []FileUsage, normalize func(string) string) []string
- func Location(filePath string, line, column int) report.Location
- func LocationFromLine(filePath string, index int, line string) report.Location
- func MapSlice[T any, R any](items []T, mapper func(T) R) []R
- func MaskCommentsAndStrings(content []byte) []byte
- func MaskCommentsAndStringsForFile(content []byte, filePath string) []byte
- func MaskCommentsAndStringsWithProfile(content []byte, profile maskProfile) []byte
- func NewReport(rawRepoPath string, now func() time.Time) (string, report.Report, error)
- func NormalizeDependencyID(value string) string
- func ReadYAMLUnderRepo[T any](repoPath, path string) (T, error)
- func RecommendationPriorityRank(priority string) int
- func ResolveMinUsageRecommendationThreshold(value *int) int
- func ResolveRemovalCandidateWeights(value *report.RemovalCandidateWeights) report.RemovalCandidateWeights
- func ShouldSkipCommonDir(name string) bool
- func ShouldSkipDir(name string, languageSpecific map[string]bool) bool
- func SortRecommendations(recommendations []report.Recommendation, priorityRank func(string) int)
- func SortReportsByWaste(reports []report.DependencyReport, weights ...report.RemovalCandidateWeights)
- func SortRiskCues(cues []report.RiskCue)
- func SortedKeys(values map[string]struct{}) []string
- func StripLineComment(line, marker string) string
- func TopCountKeys(values map[string]int, limit int) []string
- func UniqueCleanPaths(values []string) []string
- func UniqueTrimmedStrings(values []string) []string
- func WalkContextErr(ctx context.Context, walkErr error) error
- func WalkRepoFiles(ctx context.Context, repoPath string, maxFiles int, skipDir func(string) bool, ...) error
- func WasteScore(dep report.DependencyReport) (float64, bool)
- type DependencyStats
- type FileUsage
- type GradleCatalogLibrary
- type GradleCatalogResolver
- type ImportRecord
- type RootSignal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyRootSignals ¶ added in v0.1.2
func BuildDependencyReportFromStats ¶ added in v0.1.4
func BuildDependencyReportFromStats(name, languageID string, stats DependencyStats) report.DependencyReport
func BuildRequestedDependencies ¶ added in v0.1.3
func BuildRequestedDependenciesWithWeights ¶ added in v0.1.3
func BuildRequestedDependenciesWithWeights[S any](req language.Request, scan S, normalizeDependencyID func(string) string, buildDependency func(string, S) (report.DependencyReport, []string), resolveWeights func(*report.RemovalCandidateWeights) report.RemovalCandidateWeights, buildTop func(int, S, report.RemovalCandidateWeights) ([]report.DependencyReport, []string)) ([]report.DependencyReport, []string)
func BuildTopReports ¶
func BuildTopReports(topN int, dependencies []string, buildReport func(string) (report.DependencyReport, []string), weights ...report.RemovalCandidateWeights) ([]report.DependencyReport, []string)
func CountUsage ¶
func CountUsage(content []byte, imports []ImportRecord) map[string]int
func DedupeWarnings ¶ added in v1.2.0
func DefaultRepoPath ¶
func DetectMatched ¶
func FallbackDependency ¶ added in v0.1.5
func FinalizeDetection ¶
func FinalizeDetection(repoPath string, detection language.Detection, roots map[string]struct{}) language.Detection
FinalizeDetection applies shared post-processing for language detection. It enforces a confidence floor (35) only when matched, always caps confidence at 95, and ensures matched detections have at least one root before returning sorted roots.
func FirstContentColumn ¶
func HasWildcardImport ¶
func IsGradleVersionCatalogFile ¶ added in v1.2.0
func IsPathWithin ¶ added in v0.1.2
func LastModuleSegment ¶ added in v0.1.5
func ListDependencies ¶
func LocationFromLine ¶ added in v0.1.2
func MaskCommentsAndStrings ¶ added in v1.3.2
MaskCommentsAndStrings blanks comment and string literal content while preserving newlines and byte offsets for line/column calculations.
func MaskCommentsAndStringsForFile ¶ added in v1.3.2
func MaskCommentsAndStringsWithProfile ¶ added in v1.3.2
func NormalizeDependencyID ¶ added in v0.1.2
func ReadYAMLUnderRepo ¶ added in v0.1.5
func RecommendationPriorityRank ¶ added in v1.2.0
func ResolveMinUsageRecommendationThreshold ¶ added in v1.2.0
func ResolveRemovalCandidateWeights ¶ added in v1.2.0
func ResolveRemovalCandidateWeights(value *report.RemovalCandidateWeights) report.RemovalCandidateWeights
func ShouldSkipCommonDir ¶ added in v0.1.2
func ShouldSkipDir ¶ added in v0.1.2
func SortRecommendations ¶ added in v0.1.5
func SortRecommendations(recommendations []report.Recommendation, priorityRank func(string) int)
func SortReportsByWaste ¶
func SortReportsByWaste(reports []report.DependencyReport, weights ...report.RemovalCandidateWeights)
SortReportsByWaste annotates each report with a removal-candidate score before sorting.
func SortRiskCues ¶ added in v1.2.0
func SortedKeys ¶
func StripLineComment ¶ added in v0.1.2
func UniqueCleanPaths ¶ added in v0.1.5
func UniqueTrimmedStrings ¶ added in v0.1.5
func WalkRepoFiles ¶ added in v0.1.2
func WasteScore ¶
func WasteScore(dep report.DependencyReport) (float64, bool)
Types ¶
type DependencyStats ¶
type DependencyStats struct {
HasImports bool
UsedCount int
TotalCount int
UsedPercent float64
TopSymbols []report.SymbolUsage
UsedImports []report.ImportUse
UnusedImports []report.ImportUse
WildcardImports int
}
func BuildDependencyStats ¶
func BuildDependencyStats(dependency string, files []FileUsage, normalize func(string) string) DependencyStats
type FileUsage ¶
type FileUsage struct {
Imports []ImportRecord
Usage map[string]int
}
func MapFileUsages ¶
func MapFileUsages[T any](files []T, importsOf func(T) []ImportRecord, usageOf func(T) map[string]int) []FileUsage
type GradleCatalogLibrary ¶ added in v1.2.0
type GradleCatalogResolver ¶ added in v1.2.0
type GradleCatalogResolver struct {
// contains filtered or unexported fields
}
func LoadGradleCatalogResolver ¶ added in v1.2.0
func LoadGradleCatalogResolver(repoPath string) (GradleCatalogResolver, []string)
func (*GradleCatalogResolver) ParseDependencyReferences ¶ added in v1.2.0
func (r *GradleCatalogResolver) ParseDependencyReferences(buildFilePath, content string) ([]GradleCatalogLibrary, []string)
type ImportRecord ¶
type ImportRecord struct {
Dependency string
Module string
Name string
Local string
Location report.Location
Wildcard bool
}
func ParseImportLines ¶ added in v0.1.2
func ParseImportLines(content []byte, filePath string, parseLine func(string, int) []ImportRecord) []ImportRecord
type RootSignal ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.