backend

package
v0.0.0-...-9a7fe83 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package backend contains the necessary functions to classify a license.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassifierBackend

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

ClassifierBackend is an object that handles classifying a license.

func New

func New(threshold float64, forbiddenOnly bool) (*ClassifierBackend, error)

New creates a new backend working on the local filesystem.

func (*ClassifierBackend) ClassifyLicenses

func (b *ClassifierBackend) ClassifyLicenses(filenames []string, headers bool) (errors []error)

ClassifyLicenses runs the license classifier over the given file.

func (*ClassifierBackend) ClassifyLicensesWithContext

func (b *ClassifierBackend) ClassifyLicensesWithContext(ctx context.Context, filenames []string, headers bool) (errors []error)

ClassifyLicensesWithContext runs the license classifier over the given file; ensure that it will respect the timeout and cancelation in the provided context.

func (*ClassifierBackend) Close

func (b *ClassifierBackend) Close()

Close does nothing here since there's nothing to close.

func (*ClassifierBackend) GetResults

func (b *ClassifierBackend) GetResults() results.LicenseTypes

GetResults returns the results of the classifications.

type ClassifierInterface

type ClassifierInterface interface {
	Close()
	ClassifyLicenses(filenames []string, headers bool) []error
	ClassifyLicensesWithContext(ctx context.Context, filenames []string, headers bool) []error
	GetResults() results.LicenseTypes
}

ClassifierInterface is the interface each backend must implement.

Jump to

Keyboard shortcuts

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