analyzer

package
v0.4.3-0...-af5a74a Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPackage

func LoadPackage(dir string) (*astrav.Package, error)

LoadPackage loads a go package from a folder

Types

type PatternReport

type PatternReport struct {
	// PatternRating is the pattern similarity with the closest pattern
	PatternRating float64
	// OptimalLimit is the exercise limit (similarity) for approve as optimal
	OptimalLimit float64
	// ApproveLimit is the exercise limit (similarity) for approve with comments
	ApproveLimit float64
	// Match is true if one of the patterns was a perfect match
	PerfectMatch bool
	// MinDiff is a git-like diff to the closest pattern
	MinDiff string
}

PatternReport contain information on pattern matching

func CheckPattern

func CheckPattern(exercise string, solution *astrav.Package) (*PatternReport, error)

CheckPattern checks if the given package matches any good pattern

type Result

type Result struct {
	Status   Status         `json:"status"`
	Comments []sugg.Comment `json:"comments"`
	Errors   []string       `json:"errors,omitempty"`
	Severity int            `json:"-"`
	Rating   float64        `json:"-"`
	MinDiff  string         `json:"-"`
}

Result defines the result of the analyzer

func Analyze

func Analyze(exercise string, path string) Result

Analyze analyses a solution and returns the Result

func GetResultFromFile

func GetResultFromFile(dir string) (*Result, error)

GetResultFromFile returns the content of the `expected.json` file in given path.

func NewErrResult

func NewErrResult(err error) Result

NewErrResult creates a result with an error.

type Status

type Status string

Status defines the status of a solution to be acted upon by exercism.

const (
	Approve       Status = "approve"
	Disapprove    Status = "disapprove"
	ReferToMentor Status = "refer_to_mentor"
	Ejected       Status = "ejected"
)

status constants

Jump to

Keyboard shortcuts

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