Documentation
¶
Overview ¶
Package report provides a pluggable section registry for stringer report. Each section consumes metrics from collectors and renders a focused analysis.
Index ¶
- Constants
- Variables
- func ColorAssessment(val string) string
- func ColorRiskLevel(val string) string
- func ColorStability(val string) string
- func List() []string
- func Register(s Section)
- func SectionTitle(title string) string
- type Alignment
- type ColorFunc
- type Column
- type Recommendation
- type Section
- type Table
Constants ¶
const ( SeverityHigh = "high" SeverityMedium = "medium" SeverityLow = "low" )
Severity levels for recommendations.
Variables ¶
var ErrMetricsNotAvailable = errors.New("metrics not available")
ErrMetricsNotAvailable indicates a section's required metrics are missing, typically because the corresponding collector was not run.
Functions ¶
func ColorAssessment ¶
ColorAssessment colors test coverage assessments.
func ColorRiskLevel ¶
ColorRiskLevel colors CRITICAL/WARNING/ok risk labels.
func ColorStability ¶
ColorStability colors stability labels.
func List ¶
func List() []string
List returns the names of all registered sections in registration order.
func Register ¶
func Register(s Section)
Register adds a section to the global registry. It panics if a section with the same name is already registered.
func SectionTitle ¶
SectionTitle renders a bold section title.
Types ¶
type Column ¶
type Column struct {
Header string
Align Alignment
Color ColorFunc // optional per-cell color function
}
Column describes a single table column.
type Recommendation ¶
Recommendation is a single actionable suggestion derived from metrics.
type Section ¶
type Section interface {
// Name returns the unique identifier for this section (e.g., "lottery-risk").
Name() string
// Description returns a human-readable description of what this section reports.
Description() string
// Analyze processes the scan result and prepares internal state for rendering.
// Returns ErrMetricsNotAvailable (wrapped) if required metrics are missing.
Analyze(result *signal.ScanResult) error
// Render writes the section output to w.
Render(w io.Writer) error
}
Section is a pluggable report section that analyzes scan results and renders a focused report segment.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table renders aligned text tables to an io.Writer.