Documentation ¶
Overview ¶
Package old is an old (v0.1.0) copy of the licensecheck package, for easier comparison with the new Scan API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
A Checker matches a set of known licenses.
type Coverage ¶
type Coverage struct { // Percent is the fraction of the total text, in normalized words, that // matches any valid license, expressed as a percentage across all of the // licenses matched. Percent float64 // Match describes, in sequential order, the matches of the input text // across the various licenses. Typically it will be only one match long, // but if the input text is a concatenation of licenses it will contain // a match value for each element of the concatenation. Match []Match }
Coverage describes how the text matches various licenses.
func Cover ¶
Cover computes the coverage of the text according to the license set compiled into the package.
An input text may match multiple licenses. If that happens, Match contains only disjoint matches. If multiple licenses match a particular section of the input, the best match is chosen so the returned coverage describes at most one match for each section of the input.
type License ¶
A License describes a single license that can be recognized. At least one of the Text or the URL should be set.
func BuiltinLicenses ¶
func BuiltinLicenses() []License
BuiltinLicenses returns the list of licenses built into the package. That is, the built-in checker is equivalent to New(BuiltinLicenses()).
type Match ¶
type Match struct { Name string // The (file) name of the license it matches. Type Type // The type of the license: BSD, MIT, etc. Percent float64 // The fraction of words between Start and End that are matched. Start int // The byte offset of the first word in the input that matches. End int // The byte offset of the end of the last word in the input that matches. // IsURL reports that the matched text identifies a license by indirection // through a URL. If set, Start and End specify the location of the URL // itself, and Percent is always 100.0. IsURL bool }
Match describes how a section of the input matches a license.
type Options ¶
type Options struct { MinLength int // Minimum length of run, in words, to count as a matching substring. Threshold int // Percentage threshold to report a match. Slop int // Maximum allowable gap in a near-contiguous match. }
Options allow us to adjust parameters for the matching algorithm. TODO: Delete this once the package has been fine-tuned.