Documentation
¶
Overview ¶
Package findings is the output layer: the findings model, the schema-valid machine document (self-validated through the strictspec findings reader before it is handed to the framework, which validates it again against the declared payload schema), the human-readable text rendering, and the exit-code rule.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Schema = strictcli.SchemaObject( map[string]interface{}{ "format_version": strictcli.SchemaConst(1), "strictcode_version": strictcli.SchemaType("string"), "workspace_root": strictcli.SchemaType("string"), "findings": strictcli.SchemaArray(strictcli.SchemaObject( map[string]interface{}{ "rule": strictcli.SchemaType("string"), "severity": strictcli.SchemaEnum("error", "warning"), "message": strictcli.SchemaType("string"), "target": strictcli.SchemaObject( map[string]interface{}{ "id": strictcli.SchemaType("string"), "kind": strictcli.SchemaEnum(nodeKindValues()...), "file": strictcli.SchemaType("string"), "line": strictcli.SchemaType("integer"), }, []string{"id", "kind", "file", "line"}, false, ), "fix": strictcli.SchemaObject( map[string]interface{}{ "tier": strictcli.SchemaType("integer"), "description": strictcli.SchemaType("string"), }, []string{"tier", "description"}, false, ), }, []string{"rule", "severity", "message", "target"}, false, )), }, []string{"format_version", "strictcode_version", "workspace_root", "findings"}, false, )
Schema is the analyze command's declared payload schema (strictcli §19.5), the closed-subset statement of the same document schema/strictspec/findings.schema.toml governs. The framework enforces it where it writes the envelope and --dump-schema publishes it, so a consumer has something to generate against without reading the strictspec document.
The target-kind enum is derived from the vocabulary rather than written out, because the vocabulary is where node kinds are declared and a second hand-kept list could only drift from it.
Functions ¶
func FailRun ¶
FailRun reports whether the findings set fails the run (nonzero exit): any error-severity finding does; warnings alone do not.
func RenderText ¶
RenderText renders the human-readable report: one line per finding (file:line: severity: message [rule]), then a summary.
Types ¶
type Document ¶
type Document struct {
// FormatVersion is the strictspec document version stamp, exact-match
// checked by the findings schema.
FormatVersion int `json:"format_version"`
StrictcodeVersion string `json:"strictcode_version"`
WorkspaceRoot string `json:"workspace_root"`
Findings []findingJSON `json:"findings"`
}
Document is the strictcode findings document: the analyze command's machine payload, carried as the envelope's payload member under --json. Its shape is owned by schema/strictspec/findings.schema.toml, which is why it keeps its own format_version and version stamps rather than deferring to the envelope's framing.
func Build ¶
Build assembles the findings document (sorted) and self-validates it against the findings schema — an invalid document is a bug and a hard error, never emitted output. The framework validates the same value again against Schema where it writes the envelope; the two duties are different authorities over the same document and both are kept.
type Target ¶
type Target struct {
// ID is the serialized qualified node ID (schema/SPEC.md section 2).
ID string
// Kind is the node kind.
Kind vocab.NodeKind
// File is the workspace-root-relative file path.
File string
// Line is the 1-based line, derived from the byte span at output time.
Line int
}
Target is what a finding points at: a node plus its site.