Documentation
¶
Overview ¶
Package extent holds the statement of how far one run of a command looked (itd-2611211024360819): what it looked at, what it did not look at and why, what it could not check this time, and, where a model did the judging, how hard that judging looked. Every declared command attaches it to its result under one member, `extent`; the name is not `coverage`, which several results and the lifeboat probe already use for something else.
The package imports no other core, so every core can import it. The core returns the statement and writes nothing; Lines, in render.go, is the one renderer every surface prints.
Every identifier a recorded statement carries comes from a closed set, and encoding refuses one outside it. The reasons and causes are held by testdata/identifiers.golden: a release may add one, written there as well, and never rename or remove one (criterion 24).
Decoding is strict: an identifier outside its set is refused, and with it the whole statement. A build reading a statement written by a later release that added an identifier therefore refuses it. Whether a reader should tolerate an identifier it does not know is left open here, for the step that first stores statements where another build reads them back.
Index ¶
Constants ¶
const GapsFlag = "--gaps"
GapsFlag is the one flag a declared command takes to list every gap.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cause ¶
type Cause string
Cause says why a registry kind was left out in this run.
const ( // CauseHostRun: the host's agents run it, not this command. CauseHostRun Cause = "host_run" // CauseOtherRun: it is left to another way of running the command. CauseOtherRun Cause = "other_run" // CauseNotArmed: the configuration armed no such check. CauseNotArmed Cause = "not_armed" // CauseNothingToRead: the check was armed and the run had nothing to read // it against. CauseNothingToRead Cause = "nothing_to_read" )
The four causes, in their order of precedence: where more than one applies, an entry carries the first (Statement.LeaveOut picks it).
func (Cause) MarshalText ¶
MarshalText refuses a cause outside the closed set.
func (*Cause) UnmarshalText ¶
UnmarshalText refuses a cause outside the closed set.
type Depth ¶
type Depth struct {
Role string `json:"role"`
Lane string `json:"lane,omitempty"`
Issue string `json:"issue,omitempty"`
Class *Told `json:"class,omitempty"`
Runs Runs `json:"runs"`
Effort *Told `json:"effort,omitempty"`
}
Depth is how hard one judging role looked, keyed by the lane whose change it judged or by the issue whose remedy it judged, or by its role alone. An entry whose role ran no judging run gives a count of zero and neither a class nor an effort.
type Gap ¶
type Gap struct {
Check string `json:"check"`
Kind string `json:"kind,omitempty"`
Reason Reason `json:"reason"`
Text string `json:"text"`
}
Gap is one check that could not be made in this run. Kind names the kind it bears on, where there is one: a kind in LookedAt when the run read it all the same, or a kind in neither list when the failed check stopped it being read at all.
type Looked ¶
Looked is one registry kind the run looked at, with how many it found by what the command counts as a finding. A kind in which nothing was found is an entry with a count of zero.
type Mark ¶
type Mark string
Mark stands in place of a depth value abcd does not have.
func (Mark) MarshalText ¶
MarshalText refuses a mark outside the closed set.
func (*Mark) UnmarshalText ¶
UnmarshalText refuses a mark outside the closed set.
type NotLooked ¶
type NotLooked struct {
ID string `json:"id"`
Label string `json:"label"`
Source Source `json:"source"`
Cause Cause `json:"cause,omitempty"`
}
NotLooked is one kind the run did not look at. Only a SourceLeftOut entry carries a Cause.
type Origin ¶
type Origin string
Origin says where a depth value came from.
func (Origin) MarshalText ¶
MarshalText refuses an origin outside the closed set.
func (*Origin) UnmarshalText ¶
UnmarshalText refuses an origin outside the closed set.
type Reason ¶
type Reason string
Reason says why a check could not be made in this run.
const ( // ReasonUnreadable: a store or file could not be read. ReasonUnreadable Reason = "unreadable" // ReasonUnreachable: a remote or forge did not answer. ReasonUnreachable Reason = "unreachable" // ReasonToolMissing: a program the check needs is absent. ReasonToolMissing Reason = "tool_missing" // ReasonTimedOut: the check ran out of time. ReasonTimedOut Reason = "timed_out" // ReasonCheckFailed: the check ran and returned an error of none of the // other kinds. ReasonCheckFailed Reason = "check_failed" )
The five reasons, in the order the renderer counts them.
func (Reason) MarshalText ¶
MarshalText refuses a reason outside the closed set.
func (*Reason) UnmarshalText ¶
UnmarshalText refuses a reason outside the closed set.
type RenderOptions ¶
type RenderOptions struct {
// AllGaps lists every gap in full under the count line, which then names
// no flag: the person passed GapsFlag, or no one can pass it (the sweep
// abcd runs on its own).
AllGaps bool
}
RenderOptions shapes the text of a statement.
type Runs ¶
Runs is the number of judging runs: either the count with where it came from, or a Mark in its place.
func (Runs) MarshalJSON ¶
MarshalJSON writes the count only where no Mark stands in its place, so a count of zero is recorded and a count abcd was not told is not.
func (*Runs) UnmarshalJSON ¶
UnmarshalJSON reads what MarshalJSON writes, strictly (decodeStrict).
type Source ¶
type Source string
Source says where a not-looked-at entry comes from.
const ( // SourceLeftOut: a registry kind this run did not look at, taken from the // code, with a Cause. SourceLeftOut Source = "left_out" // SourceExclusion: what the command's code leaves out by a rule it reads // itself. It stands in every run. SourceExclusion Source = "exclusion" // SourceListed: a kind on the command's hand-written list. It stands in // every run. SourceListed Source = "listed" )
func (Source) MarshalText ¶
MarshalText refuses a source outside the closed set.
func (*Source) UnmarshalText ¶
UnmarshalText refuses a source outside the closed set.
type Statement ¶
type Statement struct {
LookedAt []Looked
NotLookedAt []NotLooked
CouldNotCheck []Gap
Depth []Depth
// NoClearState marks a command that has no clear state (the drive of a
// drain): its statement carries no verdict member at all.
NoClearState bool
}
Statement is how far one run looked. The three lists are recorded on every run, empty or not. Depth is recorded only where a model did the judging.
func (*Statement) LeaveOut ¶
LeaveOut records a registry kind this run did not look at. Where more than one cause applies it records the first of host_run, other_run, not_armed and nothing_to_read; given no cause, the entry is left without one and the statement fails to encode.
func (Statement) Lines ¶
func (s Statement) Lines(o RenderOptions) []string
Lines renders the statement as the lines every command prints, in this order:
- "Looked at:" and the labels, or "Looked at: nothing";
- "Left out in this run:" and each left-out kind with its cause, where there is one;
- "Known not looked at:" and the exclusions and the hand-written list, only on the verdicts clear and clear_except_gaps;
- "Could not check:" and one count of checks for each reason, naming GapsFlag, or, with AllGaps, naming no flag and followed by every gap; no such line when there is no gap;
- one "Judged by:" line for each depth entry;
- a summary: clear except for the gaps on clear_except_gaps, or, where no kind was looked at, that nothing was checked and why.
Every value taken from the statement is masked for one line of a terminal.
func (Statement) MarshalJSON ¶
MarshalJSON validates s and writes it with its derived verdict. A statement Validate refuses fails to encode.
func (*Statement) UnmarshalJSON ¶
UnmarshalJSON reads what MarshalJSON writes, strictly (decodeStrict), and then as Validate judges it. An absent verdict reads as no clear state, and a verdict the entries do not derive is refused.
A depth value's origin is read as recorded, and the renderer marks only a receipt's value as the host's account. A caller that decodes a statement a host or any other party could have written must set each depth value's origin itself rather than trust the recorded one, or a value a host wrote would read as one abcd's own state recorded.
func (Statement) Validate ¶
Validate reports the first way s cannot be recorded: an identifier outside its set, a kind both looked at and not looked at (criterion 12) or named twice, a cause on an entry not left out in this run or none on one that is, an entry missing its identifier, label, check or text, or a depth entry that gives a value and a mark at once, or neither, for any of its three values: a role that ran judging runs gives its class and its effort too, and only a role that ran none gives neither.
type Told ¶
type Told struct {
Values []string `json:"values,omitempty"`
From Origin `json:"from,omitempty"`
Mark Mark `json:"mark,omitempty"`
}
Told is a depth value that is a list (the classes the judging runs ran at, the efforts each was asked for): either the values with where they came from, or a Mark in their place.
type Verdict ¶
type Verdict string
Verdict is the statement's own verdict. It is derived from the entries, never set, so it cannot be made to read clean.
const ( // VerdictClear: something was looked at, nothing was found and every // check was made. VerdictClear Verdict = "clear" // VerdictClearExceptGaps: something was looked at and nothing was found, // and at least one check could not be made. VerdictClearExceptGaps Verdict = "clear_except_gaps" // VerdictFound: something was found. VerdictFound Verdict = "found" // VerdictNone: no registry kind was looked at, whatever the reason, so the // statement gives no verdict. VerdictNone Verdict = "none" )
func (Verdict) MarshalText ¶
MarshalText refuses a verdict outside the closed set.
func (*Verdict) UnmarshalText ¶
UnmarshalText refuses a verdict outside the closed set.