license

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentIndicatorNormalizer

func CommentIndicatorNormalizer(text string) string

CommentIndicatorNormalizer trims the leading characters of comments, such as /*, <!--, --, (*, etc..

func FlattenSpaceNormalizer

func FlattenSpaceNormalizer(text string) string

FlattenSpaceNormalizer flattens continuous spaces into a single space.

func GetLicenseContent added in v0.3.0

func GetLicenseContent(spdxID string) (string, error)

GetLicenseContent returns the content of the license file with the given Spdx ID.

func Identify

func Identify(content string, threshold int) (string, error)

Identify identifies the Spdx ID of the given license content. If it's a dual-license, it will return `<Licenses 1> and <Licenses 2>`.

func Normalize

func Normalize(license string) string

Normalize applies a chain of Normalizers to the license text to make it cleaner for identification.

func NormalizeHeader

func NormalizeHeader(header string) string

NormalizeHeader applies a chain of Normalizers to the file header to make it cleaner for identification.

func NormalizePattern

func NormalizePattern(pattern string) string

NormalizePattern applies a chain of Normalizers to the license pattern to make it cleaner for identification.

func OneLineNormalizer

func OneLineNormalizer(text string) string

OneLineNormalizer normalizes the text line by line and finally merge them into one line.

func SubstantiveTextsNormalizer

func SubstantiveTextsNormalizer(text string) string

SubstantiveTextsNormalizer normalizes the license text by substituting some words that doesn't change the meaning of the license.

Types

type Normalizer

type Normalizer func(string) string

Jump to

Keyboard shortcuts

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