normalise

package
v0.0.0-...-0979862 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter interface {
	// Convert reads scanner output and produces a SARIF report.
	Convert(r io.Reader) (*sarif.SarifReport, error)
}

Converter converts scanner output in a specific format to a SARIF report.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry maps format names to converters.

func NewDefaultRegistry

func NewDefaultRegistry() *Registry

NewDefaultRegistry creates a registry pre-loaded with all built-in converters.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new converter registry.

func (*Registry) Convert

func (reg *Registry) Convert(format string, r io.Reader) (*sarif.SarifReport, error)

Convert looks up the converter for the given format and runs it.

func (*Registry) Formats

func (reg *Registry) Formats() []string

Formats returns the list of registered format names.

func (*Registry) Get

func (reg *Registry) Get(format string) (Converter, bool)

Get returns the converter for the given format name.

func (*Registry) Register

func (reg *Registry) Register(format string, c Converter)

Register adds a converter for the given format name.

type SarifConverter

type SarifConverter struct{}

SarifConverter implements Converter for native SARIF 2.1.0 output. This is a passthrough that delegates to the existing sarif.Parse().

func (*SarifConverter) Convert

func (s *SarifConverter) Convert(r io.Reader) (*sarif.SarifReport, error)

type SemgrepConverter

type SemgrepConverter struct{}

SemgrepConverter implements Converter for Semgrep's native JSON format.

func (*SemgrepConverter) Convert

func (s *SemgrepConverter) Convert(r io.Reader) (*sarif.SarifReport, error)

type SemgrepError

type SemgrepError struct {
	Message string `json:"message"`
	Level   string `json:"level"`
}

SemgrepError represents an error entry in Semgrep output.

type SemgrepExtra

type SemgrepExtra struct {
	Message  string          `json:"message"`
	Severity string          `json:"severity"`
	Metadata SemgrepMetadata `json:"metadata"`
	Lines    string          `json:"lines"`
}

SemgrepExtra contains additional finding metadata.

type SemgrepMetadata

type SemgrepMetadata struct {
	CWE        interface{} `json:"cwe"` // string or []string
	Confidence string      `json:"confidence"`
	Category   string      `json:"category"`
}

SemgrepMetadata contains rule metadata from Semgrep.

type SemgrepOutput

type SemgrepOutput struct {
	Results []SemgrepResult `json:"results"`
	Errors  []SemgrepError  `json:"errors"`
	Version string          `json:"version"`
}

SemgrepOutput represents the top-level structure of Semgrep's native JSON output.

type SemgrepPos

type SemgrepPos struct {
	Line   int `json:"line"`
	Col    int `json:"col"`
	Offset int `json:"offset"`
}

SemgrepPos represents a position in a file.

type SemgrepResult

type SemgrepResult struct {
	CheckID string       `json:"check_id"`
	Path    string       `json:"path"`
	Start   SemgrepPos   `json:"start"`
	End     SemgrepPos   `json:"end"`
	Extra   SemgrepExtra `json:"extra"`
}

SemgrepResult represents a single finding in Semgrep's native JSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL