Documentation
¶
Overview ¶
Package scan runs a multi-layer code quality pipeline over a Go project directory and produces a signed attestation of the results.
Class: domain UseWhen: Quality gate after builds. Produces ATTESTATION.md and signed attestation.json.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultExecRunner ¶
type DefaultExecRunner struct{}
DefaultExecRunner executes real commands via os/exec.
type ExecRunner ¶
type ExecRunner interface {
Run(ctx context.Context, dir string, name string, args ...string) (stdout, stderr []byte, exitCode int, err error)
}
ExecRunner is the interface through which layers invoke external binaries. Using this abstraction makes all exec calls injectable in tests.
type Layer ¶
type Layer interface {
Name() string
Run(ctx context.Context, projectDir string) (*LayerResult, error)
}
Layer is the interface implemented by every scan layer.
type LayerResult ¶
type LayerResult struct {
Name string
Pass bool
Findings []Finding
Duration time.Duration
RawOutput string
}
LayerResult holds the output of a single scan layer.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline runs a sequence (or concurrent set) of Layers and aggregates results.
func NewPipeline ¶
func NewPipeline(layers []Layer, opts ...PipelineOption) *Pipeline
NewPipeline constructs a Pipeline with the given layers and options.
type PipelineOption ¶
type PipelineOption func(*Pipeline)
PipelineOption configures a Pipeline.
func WithLayers ¶
func WithLayers(layers []Layer) PipelineOption
WithLayers overrides the layer set at run time, replacing whatever was passed to NewPipeline.
func WithParallel ¶
func WithParallel(parallel bool) PipelineOption
WithParallel enables or disables concurrent layer execution.
type PipelineResult ¶
type PipelineResult struct {
LayerResults []LayerResult
Pass bool
StartedAt time.Time
FinishedAt time.Time
}
PipelineResult aggregates results from all layers in a pipeline run.
func (*PipelineResult) Deduplicate ¶
func (r *PipelineResult) Deduplicate() []Finding
Deduplicate returns a flat slice of findings across all LayerResults with duplicates removed. When two findings share the same File and Line, only the highest-severity one is kept.