Documentation
¶
Overview ¶
Package matcherkit contains shared helper functions for matcher implementations.
Index ¶
- func MissingLicensePackages(packages []*model.Package) []*model.Package
- func NormalizeLicenseSet(values []string, sourceType string) []model.PackageLicense
- func NormalizeLicenseSetFrom(values []string, licenseType, source string) []model.PackageLicense
- func RegistryPackagesForGraph(g *model.Graph, reg *model.PackageRegistry, target *model.DependencyNode) []*model.Package
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MissingLicensePackages ¶
MissingLicensePackages returns the packages eligible for external license lookup.
func NormalizeLicenseSet ¶
func NormalizeLicenseSet(values []string, sourceType string) []model.PackageLicense
NormalizeLicenseSet converts raw license strings into Bomly package licenses, classifying each value by validating it (ADR-0035 in bomly-cli's dev-docs/adr, enforced at write time via spdxkit). Value preserves the input after whitespace trimming — nothing else is altered — while SPDXExpression is set only when the value actually is SPDX: the canonical current spelling for a license-list identifier (deprecated entries fold to their replacements), the validated expression otherwise. Free text such as "non-standard" leaves SPDXExpression empty instead of masquerading as an expression. The sourceType argument is a license *type* -- "declared" or "concluded" -- and always was: it is written to PackageLicense.Type, and this module's own callers pass "declared". A matcher that wants to record which component supplied the claim wants NormalizeLicenseSetFrom instead. The two are independent facts, and one argument carrying both is what let a matcher name reach a field that turned out to be a closed vocabulary.
func NormalizeLicenseSetFrom ¶ added in v0.8.0
func NormalizeLicenseSetFrom(values []string, licenseType, source string) []model.PackageLicense
NormalizeLicenseSetFrom is NormalizeLicenseSet with provenance: source names the component that supplied the claim, such as a matcher name, and reaches PackageLicense.Source.
It exists as a second entry point rather than a wider signature because NormalizeLicenseSet is exported and its meaning is not this release's to change. Passing "" for source is exactly NormalizeLicenseSet.
func RegistryPackagesForGraph ¶
func RegistryPackagesForGraph(g *model.Graph, reg *model.PackageRegistry, target *model.DependencyNode) []*model.Package
RegistryPackagesForGraph seeds the PURL-keyed package registry from the graph's dependency nodes and returns the registry packages that matchers should enrich. Under the typed union only dependency nodes exist to matching — module and manifest nodes are structural and never reach external sources — and a dependency node's ID is its canonical package URL, so PackageRef is set to it directly. Packages are deduplicated by PURL so a matcher enriches each unique package once regardless of how many dependency records reference it.
When a target is set, only the target dependency is considered.
Types ¶
This section is empty.