license

package
v0.1.0-alpha.26 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package license provides license policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeaderCheck

type HeaderCheck struct {
	// contains filtered or unexported fields
}

HeaderCheck enforces a license header on source code files.

func (HeaderCheck) Errors

func (l HeaderCheck) Errors() []error

Errors returns any violations of the check.

func (HeaderCheck) Message

func (l HeaderCheck) Message() string

Message returns to check message.

func (HeaderCheck) Name

func (l HeaderCheck) Name() string

Name returns the name of the check.

type License

type License struct {
	// SkipPaths applies gitignore-style patterns to file paths to skip completely
	// parts of the tree which shouldn't be scanned (e.g. .git/)
	SkipPaths []string `mapstructure:"skipPaths"`
	// IncludeSuffixes is the regex used to find files that the license policy
	// should be applied to.
	IncludeSuffixes []string `mapstructure:"includeSuffixes"`
	// ExcludeSuffixes is the Suffixes used to find files that the license policy
	// should not be applied to.
	ExcludeSuffixes []string `mapstructure:"excludeSuffixes"`
	// AllowPrecedingComments, when enabled, allows blank lines and `//` and `#` line comments
	// before the license header. Useful for code generators that put build constraints or
	// "DO NOT EDIT" lines before the license.
	AllowPrecedingComments bool `mapstructure:"allowPrecedingComments"`
	// Header is the contents of the license header.
	Header string `mapstructure:"header"`
}

License implements the policy.Policy interface and enforces source code license headers.

func (*License) Compliance

func (l *License) Compliance(options *policy.Options) (*policy.Report, error)

Compliance implements the policy.Policy.Compliance function.

func (License) ValidateLicenseHeader

func (l License) ValidateLicenseHeader() policy.Check

ValidateLicenseHeader checks the header of a file and ensures it contains the provided value.

Jump to

Keyboard shortcuts

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