Documentation
¶
Index ¶
- func IsLicenseFile(filename string, overrideIgnore bool) (bool, float64)
- func IsLicenseMatchConfident(dl License) bool
- func LicenseCheck(ctx context.Context, cfg *config.Configuration, fsys fs.FS, deep bool) ([]License, []LicenseDiff, error)
- type Classifier
- type License
- type LicenseDiff
- type LicenseFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLicenseFile ¶ added in v0.25.0
IsLicenseFile checks if a file is a license file based on its name. Returns true/fals if the file is a license file, and the weight value associated with the match, as some matches are potentially more relevant. overrideIgnore skips over ignored paths to allow linters to correctly determine whether a path is a valid license file (e.g., to avoid listing each instance of a given LICENSE file as a duplicate)
func IsLicenseMatchConfident ¶ added in v0.24.0
IsLicenseMatchConfident checks if the license match is confident enough to be considered valid.
func LicenseCheck ¶
func LicenseCheck(ctx context.Context, cfg *config.Configuration, fsys fs.FS, deep bool) ([]License, []LicenseDiff, error)
LicenseCheck checks the licenses of the files in the given filesystem against the melange configuration. If deep is true, the entire tree is scanned. If deep is false, only the top directory and one level down are scanned.
Types ¶
type Classifier ¶
Classifier can detect the type of a software license.
func NewClassifier ¶
func NewClassifier() (Classifier, error)
NewClassifier creates a license classifier.
type License ¶
type License struct {
Name string
Type golicenses.Type
Confidence float64
Source string
Overrides string
}
License represents a software license, as detected by licenseclassifier.
func CollectLicenseInfo ¶
func CollectLicenseInfo(ctx context.Context, fsys fs.FS, deep bool, cfg *config.Configuration) ([]License, error)
CollectLicenseInfo collects license information from the given filesystem. If deep is true, the entire tree is scanned. If deep is false, only the top directory and one level down are scanned.
type LicenseDiff ¶
type LicenseDiff struct {
Path string
Is string
Should string
Override string
NewType golicenses.Type
}
LicenseDiff represents a difference between the detected license and the expected license.
type LicenseFile ¶
LicenseFile represents a license file, with its name, path, and relevance score.
func FindLicenseFiles ¶
func FindLicenseFiles(fsys fs.FS, deep bool) ([]LicenseFile, error)
FindLicenseFiles returns a list of license files in a directory, sorted by their relevance score. If deep is true, the entire tree is scanned. If deep is false, only the top directory and one level down are scanned, returning the list of most likely licenses of the project itself (not vendored dependencies)