Documentation
¶
Overview ¶
Package issuesync reconciles a run's findings with a tracker's issues: it opens an issue for each BAD/ERROR finding (deduped by check+target) and closes the ones whose finding has recovered. The tracker is abstracted behind Client so the reconcile logic is unit-tested with a fake; a gh-backed client lives in the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyFromTitle ¶
KeyFromTitle extracts the "check/target" key from a managed issue title, or "" if the title isn't one of ours.
Types ¶
type Client ¶
type Client interface {
List(ctx context.Context) ([]Issue, error)
Create(ctx context.Context, title, body string) error
Close(ctx context.Context, number int, comment string) error
}
Client is the subset of a tracker (GitHub, …) that issuesync needs.
type Report ¶
type Report struct {
Created []string // keys of opened issues
Closed []string // keys of closed (recovered) issues
Unchanged int
}
Report summarises what a reconcile did (or would do, in dry-run).
func Reconcile ¶
func Reconcile(ctx context.Context, c Client, findings []engine.Finding, dryRun bool) (Report, error)
Reconcile opens issues for current problems missing one and closes managed issues whose problem has recovered. It is idempotent. With dryRun, it reports the actions without calling Create/Close.