Documentation
¶
Overview ¶
Package sarif provides SARIF (Static Analysis Results Interchange Format) parsing and rendering.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizePath ¶
NormalizePath strips file:// prefix and cleans a SARIF URI to a relative path.
Types ¶
type ArtifactLocation ¶
ArtifactLocation identifies the file.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs valid SARIF 2.1.0 documents. Designed for fo wrap and as an importable library.
func NewBuilder ¶
NewBuilder creates a SARIF builder for the given tool.
type Document ¶
type Document struct {
Version string `json:"version"`
Schema string `json:"$schema,omitempty"`
Runs []Run `json:"runs"`
}
Document represents a SARIF 2.1.0 document. See: https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
type GroupedResults ¶
type GroupedResults struct {
Key string // file path or rule ID
Results []Result // issues in this group
}
GroupedResults organizes results by a grouping key.
func GroupByFile ¶
func GroupByFile(doc *Document) []GroupedResults
GroupByFile organizes results by file path.
type Location ¶
type Location struct {
PhysicalLocation PhysicalLocation `json:"physicalLocation"`
}
Location identifies where the issue was found.
type Message ¶
type Message struct {
Text string `json:"text"`
}
Message contains the issue description.
type PhysicalLocation ¶
type PhysicalLocation struct {
ArtifactLocation ArtifactLocation `json:"artifactLocation"`
Region Region `json:"region,omitempty"`
}
PhysicalLocation pinpoints the file and region.
type Region ¶
type Region struct {
StartLine int `json:"startLine,omitempty"`
StartColumn int `json:"startColumn,omitempty"`
EndLine int `json:"endLine,omitempty"`
EndColumn int `json:"endColumn,omitempty"`
}
Region identifies the specific location within the file.
type Result ¶
type Result struct {
RuleID string `json:"ruleId"`
Level string `json:"level"` // "error", "warning", "note", "none"
Message Message `json:"message"`
Locations []Location `json:"locations,omitempty"`
Related []Location `json:"relatedLocations,omitempty"`
Props json.RawMessage `json:"properties,omitempty"`
}
Result represents a single issue found by the tool.