Documentation
¶
Overview ¶
Package audit defines the wire types every detector emits and the shared serializer that renders them as JSON or text.
Finding is the per-smell record. Report is the top-level envelope. Severity ranks findings from CRITICAL down to LOW; Emit sorts and writes a Report to stdout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Emit ¶
Emit serializes a report in the requested format ("json" or "text"). Findings are sorted by severity, smell ID, then location for stable output across runs.
func ResolvedTags ¶
ResolvedTags splits a comma-separated --tags flag value into the slice that goes into the report envelope. Returns nil when no tags were supplied.
Types ¶
type Finding ¶
type Finding struct {
Smell string `json:"smell"`
SmellID string `json:"smell_id"`
Severity Severity `json:"severity"`
Location string `json:"location"`
Message string `json:"message"`
Evidence map[string]any `json:"evidence,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
}
Finding is one entry in a lagotto audit. Every detector emits zero or more findings; the JSON shape is the stable downstream contract.
Field semantics:
- Smell: human-readable name ("Receiver Monolith")
- SmellID: short stable ID ("G1") — use this in tooling
- Severity: CRITICAL | HIGH | MEDIUM | LOW
- Location: directory and (for type-level smells) the type name
- Message: one-line summary suitable for a terminal
- Evidence: structured per-detector data (method counts, file lists, package paths) for tooling that wants to drill in
- Suggestion: concrete imperative remediation guidance
type Report ¶
type Report struct {
Root string `json:"root"`
Tags []string `json:"tags,omitempty"`
Findings []Finding `json:"findings"`
}
Report is the top-level audit envelope written to stdout. Root is the path the audit was run against, Tags echoes the build tags the loader used, and Findings is severity-sorted (CRITICAL first).