Documentation
¶
Index ¶
Constants ¶
const (
LicenseListSourceUrl = "https://raw.githubusercontent.com/spdx/license-list-data/main/json/licenses.json"
)
const SimilarityThreshold = 0.9
SimilarityThreshold defines that names must meet a threshold of at least 90%
Variables ¶
This section is empty.
Functions ¶
func GenerateMapping ¶
GenerateMapping extracts SPDX license identifiers from a CycloneDC license list. * If a SPDX expression is provided, it is parsed and the found licenses * Else if an ID is provided, it is verified and added to the results * Else if a name is passed, the best matching (at least 90% match) name, on equality, the latest is selected * Else if a URL is passed, the SPDX license containing the URL is selected
Types ¶
type License ¶
type License struct {
Reference string `json:"reference"`
IsDeprecatedLicenseId bool `json:"isDeprecatedLicenseId"`
DetailsUrl string `json:"detailsUrl"`
ReferenceNumber int `json:"referenceNumber"`
Name string `json:"name"`
LicenseId string `json:"licenseId"`
SeeAlso []string `json:"seeAlso"`
IsOsiApproved bool `json:"isOsiApproved"`
}
License represents a single license of the SPDX license list in JSON format
type LicenseList ¶
type LicenseList struct {
LicenseListVersion string `json:"licenseListVersion"`
Licenses []License `json:"licenses"`
}
LicenseList represents the structure of the SPDX license list in JSON format
func (*LicenseList) FindByName ¶
func (ll *LicenseList) FindByName(name string) (License, float64)
FindByName searches for licenses ba similar names Returns the best-matching license and the similarity percentage
func (*LicenseList) FindByUrl ¶
func (ll *LicenseList) FindByUrl(url string) *License
FindByUrl searches an url in all SPDX licenses in the fields reference, detailsUrl and all seeAlso additional links
func (*LicenseList) ValidId ¶
func (ll *LicenseList) ValidId(id string) bool
ValidId checks if an ID is a valid SPDX license IO