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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const RepositoryConfigurationFileName = "repository.json"

RepositoryConfigurationFileName holds the file name for a repository configuration.

Variables

View Source
var (
	// AllIdentifiers holds all available task identifiers.
	AllIdentifiers []evaltask.Identifier
	// LookupIdentifier holds a map of all available task identifiers.
	LookupIdentifier = map[evaltask.Identifier]bool{}
)
View Source
var (
	// IdentifierWriteTests holds the identifier for the "write test" task.
	IdentifierWriteTests = registerIdentifier("write-tests")
	// IdentifierWriteTestsSymflowerFix holds the identifier for the "write test" task with the "symflower fix" applied.
	IdentifierWriteTestsSymflowerFix = registerIdentifier("write-tests-symflower-fix")
	// IdentifierCodeRepair holds the identifier for the "code repair" task.
	IdentifierCodeRepair = registerIdentifier("code-repair")
	// IdentifierTranspile holds the identifier for the "transpile" task.
	IdentifierTranspile = registerIdentifier("transpile")
	// IdentifierTranspileSymflowerFix holds the identifier for the "transpile" task with the "symflower fix" applied.
	IdentifierTranspileSymflowerFix = registerIdentifier("transpile-symflower-fix")
)

Functions

func ExecuteWithSymflowerFix

func ExecuteWithSymflowerFix(ctx evaltask.Context, logger *log.Logger, packagePath string) (testResult *language.TestResult, processingTime uint64, problems []error, err error)

ExecuteWithSymflowerFix runs the "symflower fix" command and calculates the new assessments.

func TaskForIdentifier

func TaskForIdentifier(taskIdentifier evaltask.Identifier) (task evaltask.Task, err error)

TaskForIdentifier returns a task based on the task identifier.

Types

type Repository

type Repository struct {
	RepositoryConfiguration
	// contains filtered or unexported fields
}

Repository holds data about a repository.

func TemporaryRepository

func TemporaryRepository(logger *log.Logger, testDataPath string, repositoryPathRelative string) (repository *Repository, cleanup func(), err error)

TemporaryRepository creates a temporary repository and initializes a git repo in it.

func (*Repository) DataPath

func (r *Repository) DataPath() (dataPath string)

DataPath holds the absolute path to the repository.

func (*Repository) Name

func (r *Repository) Name() (name string)

Name holds the name of the repository.

func (*Repository) Reset

func (r *Repository) Reset(logger *log.Logger) (err error)

Reset resets a repository back to its "initial" commit.

func (*Repository) SupportedTasks

func (r *Repository) SupportedTasks() (tasks []task.Identifier)

SupportedTasks returns the list of task identifiers the repository supports.

func (*Repository) Validate

func (r *Repository) Validate(logger *log.Logger, language language.Language) (err error)

Validate checks it the repository is well-formed.

type RepositoryConfiguration

type RepositoryConfiguration struct {
	Tasks []task.Identifier
}

RepositoryConfiguration holds the configuration of a repository.

func LoadRepositoryConfiguration

func LoadRepositoryConfiguration(path string) (config *RepositoryConfiguration, err error)

LoadRepositoryConfiguration loads a repository configuration from the given path.

type TaskArgumentsCodeRepair

type TaskArgumentsCodeRepair struct {
	// Mistakes holds the list of compilation errors for a package.
	Mistakes []string
}

TaskArgumentsCodeRepair holds extra arguments to be used in a query prompt.

type TaskArgumentsTranspile

type TaskArgumentsTranspile struct {
	// OriginLanguage holds the language we are transpiling from.
	OriginLanguage language.Language
	// OriginFilePath holds the path for the file containing the source code we want to transpile.
	OriginFilePath string
}

TaskArgumentsTranspile holds extra arguments to be used in a query prompt.

type TaskCodeRepair

type TaskCodeRepair struct {
}

TaskCodeRepair holds the code repair task.

func (*TaskCodeRepair) Identifier

func (t *TaskCodeRepair) Identifier() evaltask.Identifier

Identifier returns the code repair task identifier.

func (*TaskCodeRepair) Run

func (t *TaskCodeRepair) Run(ctx evaltask.Context) (repositoryAssessment map[evaltask.Identifier]metrics.Assessments, problems []error, err error)

Run performs source code repairing in a repository with compilation errors. This task requires the repository to consist of multiple packages, with each containing one faulty implementation file and a corresponding test file.

type TaskTranspile

type TaskTranspile struct{}

TaskTranspile holds the transpilation task.

func (*TaskTranspile) Identifier

func (t *TaskTranspile) Identifier() evaltask.Identifier

Identifier returns the transpilation task identifier.

func (*TaskTranspile) Run

func (t *TaskTranspile) Run(ctx evaltask.Context) (repositoryAssessment map[evaltask.Identifier]metrics.Assessments, problems []error, err error)

Run transpiles code between languages and runs predefined tests to check if the transpilation was successful.

type TaskWriteTests

type TaskWriteTests struct {
}

TaskWriteTests holds the write test task.

func (*TaskWriteTests) Identifier

func (t *TaskWriteTests) Identifier() evaltask.Identifier

Identifier returns the write test task identifier.

func (*TaskWriteTests) Run

func (t *TaskWriteTests) Run(ctx evaltask.Context) (repositoryAssessment map[evaltask.Identifier]metrics.Assessments, problems []error, err error)

TaskWriteTests generates test files for the given implementation file in a repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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