review

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfidenceBreakdown

type ConfidenceBreakdown struct {
	High   []Finding `json:"high"`
	Medium []Finding `json:"medium"`
	Low    []Finding `json:"low"`
}

ConfidenceBreakdown groups review findings by confidence band.

type Finding

type Finding struct {
	Concern    string             `json:"concern"`
	Severity   contracts.Severity `json:"severity"`
	File       string             `json:"file"`
	Line       int                `json:"line"`
	EndLine    int                `json:"end_line,omitempty"`
	Message    string             `json:"message"`
	Fix        string             `json:"fix,omitempty"`
	Reasoning  string             `json:"reasoning,omitempty"`
	CWE        string             `json:"cwe,omitempty"`
	Confidence float64            `json:"confidence"`
	SASTSource bool               `json:"sast_source,omitempty"`
}

Finding is the neutral review finding contract shared across Hawk and review engines.

func (Finding) Validate added in v0.1.13

func (f Finding) Validate() error

Validate reports whether the finding satisfies the minimum contract invariants: a non-blank Message, a non-negative Line, and a Confidence within [0, 1]. It returns a descriptive error naming the first violated field.

type InlineComment

type InlineComment struct {
	Path       string `json:"path"`
	StartLine  int    `json:"start_line"`
	EndLine    int    `json:"end_line,omitempty"`
	Body       string `json:"body"`
	Suggestion string `json:"suggestion,omitempty"`
}

InlineComment is a review finding mapped to a concrete diff position.

type Result

type Result struct {
	Findings []Finding          `json:"findings"`
	Comments []InlineComment    `json:"comments"`
	Stats    Stats              `json:"stats"`
	Report   string             `json:"report"`
	FailOn   contracts.Severity `json:"fail_on"`
	// FailOnSet reports whether FailOn was explicitly configured via
	// SetFailOn. When it is false, Failed() treats SeverityCritical as the
	// effective threshold: an unset FailOn must not fail the review on
	// informational findings just because SeverityInfo is the zero value.
	FailOnSet           bool                 `json:"fail_on_set,omitempty"`
	SASTFusion          *SASTFusionResult    `json:"sast_fusion,omitempty"`
	ConfidenceBreakdown *ConfidenceBreakdown `json:"confidence_breakdown,omitempty"`
}

Result is the neutral review result contract.

func (*Result) Failed

func (r *Result) Failed() bool

Failed reports whether any finding meets or exceeds the configured fail threshold. When the threshold was never set — a zero Result, or a Result whose FailOn field was assigned directly — SeverityCritical is used as the effective threshold, matching the sight and inspect engine defaults. Set the threshold via SetFailOn to make an explicit choice (including Info) take effect.

func (*Result) MaxSeverity

func (r *Result) MaxSeverity() contracts.Severity

MaxSeverity returns the highest severity present in the result.

func (*Result) SetFailOn added in v0.1.13

func (r *Result) SetFailOn(sev contracts.Severity)

SetFailOn sets the fail threshold used by Failed. Set the threshold through this method rather than assigning FailOn directly, so that the threshold is recorded as explicitly configured.

type SASTFusionResult

type SASTFusionResult struct {
	Confirmed   []Finding `json:"confirmed"`
	Dismissed   []Finding `json:"dismissed"`
	Unaddressed []Finding `json:"unaddressed"`
}

SASTFusionResult tracks how the LLM handled SAST findings during a review. Only populated when SAST-LLM fusion is active (preAnalysis enabled).

type Stats

type Stats struct {
	FilesReviewed       int                        `json:"files_reviewed"`
	HunksAnalyzed       int                        `json:"hunks_analyzed"`
	FindingsTotal       int                        `json:"findings_total"`
	BySeverity          map[contracts.Severity]int `json:"by_severity"`
	ByConcern           map[string]int             `json:"by_concern"`
	TokensUsed          int                        `json:"tokens_used"`
	DurationPerConcern  map[string]time.Duration   `json:"duration_per_concern"`
	AverageConfidence   float64                    `json:"average_confidence"`
	HighConfidenceCount int                        `json:"high_confidence_count"`
	LowConfidenceCount  int                        `json:"low_confidence_count"`
	// LLMErrors records non-fatal provider errors encountered during
	// analysis; findings may be partial when it is non-empty.
	LLMErrors []string `json:"llm_errors,omitempty"`
}

Stats captures review execution metrics.

Jump to

Keyboard shortcuts

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