task

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTaskUnknown indicates that a task is unknown.
	ErrTaskUnknown = errors.New("task unknown")
	// ErrTaskUnsupportedByModel indicates that the model does not support the task.
	ErrTaskUnsupportedByModel = errors.New("model does not support task")
)

Functions

This section is empty.

Types

type Context

type Context struct {
	// Language holds the language for which the task should be evaluated.
	Language language.Language
	// Repository holds the repository which should be evaluated.
	Repository Repository
	// Model holds the model which the task should be evaluated.
	Model model.Model

	// ResultPath holds the directory path where results should be written to.
	ResultPath string

	// Logger holds the logger for this tasks.
	Logger *log.Logger
}

Context holds the data need by a task to be run.

type Identifier

type Identifier string

Identifier holds the identifier of a task.

type Repository

type Repository interface {
	// Name holds the name of the repository.
	Name() (name string)
	// DataPath holds the absolute path to the repository.
	DataPath() (dataPath string)

	// SupportedTasks returns the list of task identifiers the repository supports.
	SupportedTasks() (tasks []Identifier)

	// Validate checks it the repository is well-formed.
	Validate(logger *log.Logger, language language.Language) (err error)

	// Reset resets the repository to its initial state.
	Reset(logger *log.Logger) (err error)
}

Repository defines a repository to be evaluated.

type Task

type Task interface {
	// Identifier returns the task identifier.
	Identifier() (identifier Identifier)

	// Run runs a task in a given repository.
	Run(ctx Context) (assessments map[Identifier]metrics.Assessments, problems []error, err error)
}

Task defines an evaluation task.

Jump to

Keyboard shortcuts

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