licensedb

package
v4.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoLicenseFound is raised if no license files were found.
	ErrNoLicenseFound = errors.New("no license file was found")
)

Functions

func Detect

func Detect(fs filer.Filer) (map[string]api.Match, error)

Detect returns the most probable reference licenses matched for the given file tree. Each match has the confidence assigned, from 0 to 1, 1 means 100% confident.

func InvestigateLicenseText

func InvestigateLicenseText(text []byte) map[string]float32

InvestigateLicenseText takes the license text and returns the most probable reference licenses matched. Each match has the confidence assigned, from 0 to 1, 1 means 100% confident.

func Preload

func Preload()

Preload database with licenses - load internal database from assets into memory. This method is an optimization for cases when the `Detect` method should return fast, e.g. in HTTP web servers where connection timeout can occur during detect `Preload` method could be called before server startup. This method os optional and it's not required to be called, other APIs loads license database lazily on first invocation.

Types

type Match

type Match struct {
	License    string  `json:"license"`
	Confidence float32 `json:"confidence"`
	File       string  `json:"file"`
}

Match describes the level of confidence for the detected License

type Result

type Result struct {
	Arg     string  `json:"project,omitempty"`
	Matches []Match `json:"matches,omitempty"`
	ErrStr  string  `json:"error,omitempty"`
}

Result gathers license detection results for a project path

func Analyse

func Analyse(args ...string) []Result

Analyse runs license analysis on each item in `args`

Directories

Path Synopsis
wmh

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL