Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeverityColor ¶
SeverityColor returns the ANSI color code associated with the severity.
Types ¶
type Issue ¶
type Issue struct {
ID string `json:"id"` // Unique identifier of the rule (e.g., "sql-injection")
Title string `json:"title"` // Short title of the issue
Description string `json:"description"` // Detailed description of the issue
Severity Severity `json:"severity"` // Issue severity
Location Location `json:"location"` // Where the issue was found
Category string `json:"category"` // Category (security, performance, style, etc.)
Suggestion string `json:"suggestion"` // Suggested fix
References []string `json:"references"` // Links to documentation or references
FalsePos bool `json:"falsePositive"` // Marked as false positive (optional)
Ignored bool `json:"ignored"` // Manually ignored via CLI or config
}
Issue represents a single detected vulnerability, warning or code smell.
func (Issue) IsCritical ¶
IsCritical returns true if severity is CRITICAL.
func (Issue) IsIgnored ¶
IsIgnored returns true if the issue is manually ignored or marked as false positive.
func (Issue) IsSecurity ¶
IsSecurity returns true if the issue is of security-related category.
type Location ¶
type Location struct {
File string `json:"file"` // Path to the file
Line int `json:"line"` // Line number in the file (1-based)
Column int `json:"column"` // Column number in the line (1-based)
Function string `json:"function"` // Function or method name (optional)
PackagePath string `json:"package"` // Go package path (e.g., github.com/user/project/foo)
}
Location represents the position in the source code where an issue was found.
func NewLocationFromPos ¶
NewLocationFromPos creates a Location from a token.Position and optional metadata.
type Severity ¶
type Severity string
Severity represents the level of importance or impact of an issue.
func AllSeverities ¶
func AllSeverities() []Severity
AllSeverities returns the full list of valid severity levels in order.
func ParseSeverity ¶
ParseSeverity parses a string into a Severity value. Falls back to SeverityUnknown.