Documentation
¶
Overview ¶
Package engine scores one PR: fetch, plan calls, ask, and decide. The score, action, and replay commands all go through Score.
Index ¶
Constants ¶
View Source
const OwnCheck = "LGTM"
OwnCheck is LGTM's check run name (ghout.CheckName). It is never counted as a required check of its own PR.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Config *config.Config
Decider jev.Decider
Limits prstate.Limits // zero means prstate.DefaultLimits
// Fetch reads the PR's diff. Nil reads it from GitHub.
Fetch prstate.Fetcher
// Trusted reports whether a fork PR's author has write access. Nil
// asks GitHub; replay passes a stored answer.
Trusted func(ctx context.Context, pr prstate.PR) (bool, error)
// CI returns the required checks that failed on the PR's head. Nil asks
// GitHub; replay passes one that returns nothing, since a merged PR's CI
// says little about scoring it again.
CI func(ctx context.Context, pr prstate.PR) ([]string, error)
}
Options configure a scoring run.
type QuestionResult ¶
type QuestionResult struct {
rubric.Question
Value float64
Err error
Answer *jev.Answer // from the lowest-scoring call when batched
Calls int
}
QuestionResult is one question's outcome.
type Result ¶
type Result struct {
PR prstate.PR
Mode config.Mode
Model string
ApproveAt float64
DenyAt float64
VetoAt float64
Verdict verdict.Result
Questions []QuestionResult // rubric order
Excluded []prstate.File
Unseen []prstate.Unseen
Partial []string
// LockSources are lockfile package sources outside the allowed
// registries; any of them holds approve.
LockSources []prstate.LockSource
AutoRuns []prstate.AutoRun
// CIFailed are required checks that failed on the head; CIErr says why
// they couldn't be read, which doesn't hold the PR.
CIFailed []string
CIErr error
// Sensitive are changed paths that config marks sensitive.
Sensitive []string
// ChangedLines counts added and deleted lines in files the model sees.
ChangedLines int
Untrusted bool
TrustErr error
Served []string // distinct model versions the replies named
Usage jev.Usage
CostUSD float64
Calls int
}
Result is everything a report needs.
func Score ¶
Score never returns an error: every failure becomes a needs-human result whose Verdict.Failure says why.
Click to show internal directories.
Click to hide internal directories.