Documentation ¶
Index ¶
- func CheckLicenseAllowList(license *License, path string) bool
- func Walk(ctx context.Context, config *Config) error
- type Config
- type CustomProjectLicense
- type File
- type FileTree
- type License
- type Licenses
- func (l *Licenses) GetFilesWithBadLicenseUsage() []string
- func (l *Licenses) GetFilesWithProhibitedLicenses() []string
- func (l *Licenses) MatchFile(data []byte, path string, metrics *Metrics) (bool, *License)
- func (l *Licenses) MatchSingleLicenseFile(data []byte, path string, metrics *Metrics, ft *FileTree)
- type Match
- type Metrics
- type UnlicensedFiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLicenseAllowList ¶
Types ¶
type Config ¶
type Config struct { SkipDirs []string `json:"skipDirs"` DontSkipDirs []string `json:"dontSkipDirs"` SkipFiles []string `json:"skipFiles"` ProhibitedLicenseTypes []string `json:"prohibitedLicenseTypes"` TextExtensionList []string `json:"textExtensionList"` StrictTextExtensionList []string `json:"strictTextExtensionList"` ExitOnDirRestrictedLicense bool `json:"exitOnDirRestrictedLicense"` ExitOnProhibitedLicenseTypes bool `json:"exitOnProhibitedLicenseTypes"` ExitOnUnlicensedFiles bool `json:"exitOnUnlicensedFiles"` StrictAnalysis bool `json:"strictAnalysis"` OutputLicenseFile bool `json:"outputLicenseFile"` MaxReadSize int `json:"maxReadSize"` OutputFilePrefix string `json:"outputFilePrefix"` OutputFileExtensions []string `json:"outputFileExtensions"` SingleLicenseFiles []string `json:"singleLicenseFiles"` StopLicensePropagation []string `json:"stopLicensePropagation"` LicensePatternDir string `json:"licensePatternDir"` CustomProjectLicenses []CustomProjectLicense `json:"customProjectLicenses"` FlutterLicenses []string `json:"flutterLicenses"` NoticeTxtFiles []string `json:"noticeTxtFiles"` BaseDir string `json:"baseDir"` Target string `json:"target"` LogLevel string `json:"logLevel"` LicenseAllowList map[string][]string `json:"licenseAllowList"` }
Config values are populated from the the json file at the default or user-specified path
func NewConfig ¶
Init populates Config object with values found in the json config file.
Both SkipFiles and SingleLicenseFiles are lowered.
func (*Config) Merge ¶
Merge two Config struct objects into one.
- List fields are concatenated together.
- boolean fields will be true if either one is true. (left || right)
- Regular fields will be equal to the left struct field ("c") if it's not equal to the default value ("" for strings, 0 for ints), otherwise they will be set to the right struct field.
type CustomProjectLicense ¶
type File ¶
type File struct { Name string Path string `json:"path"` Symlink string `json:"symlink"` Parent *FileTree `json:"-"` Licenses []*License `json:"licenses"` }
func (*File) MarshalJSON ¶
Use a custom Marshal function to make Files easier to read in JSON: reduce associated license information down to a string list.
type FileTree ¶
type FileTree struct { Name string `json:"name"` Path string `json:"path"` SingleLicenseFiles map[string][]*License `json:"project licenses"` Files []*File `json:"files"` Children []*FileTree `json:"children"` Parent *FileTree `json:"-"` StrictAnalysis bool `json:"strict analysis"` sync.RWMutex }
FileTree is an in memory representation of the state of the repository.
type License ¶
type License struct { Category string `json:"category"` ValidType bool `json:"valid license"` sync.Mutex AllowedDirs []string BadLicenseUsage []string // contains filtered or unexported fields }
License contains a searchable regex pattern for finding license text in source files and LICENSE files across the repository.
type Licenses ¶
type Licenses struct {
// contains filtered or unexported fields
}
Licenses is an object that facilitates operations on each License object in bulk
func NewLicenses ¶
NewLicenses returns a Licenses object with each license pattern loaded from the .lic folder location specified in Config
func (*Licenses) GetFilesWithBadLicenseUsage ¶
func (*Licenses) GetFilesWithProhibitedLicenses ¶
type Match ¶
type Match struct {
// contains filtered or unexported fields
}
Match is used to store a single match result alongside the License along with a list of all matching files
type UnlicensedFiles ¶
type UnlicensedFiles struct {
// contains filtered or unexported fields
}