loopquery

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleID = "query-in-loop"
)

Variables

This section is empty.

Functions

func New

func New(cfg *config.Config) *analysis.Analyzer

New creates the analyzer with default runtime behavior.

func NewWithRuntime

func NewWithRuntime(cfg *config.Config, opts RuntimeOptions) *analysis.Analyzer

NewWithRuntime creates the analyzer with explicit runtime options.

Types

type FindingCollector

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

FindingCollector stores emitted findings in memory.

func NewFindingCollector

func NewFindingCollector() *FindingCollector

func (*FindingCollector) Add

func (c *FindingCollector) Add(entry baseline.Entry) error

func (*FindingCollector) Entries

func (c *FindingCollector) Entries() []baseline.Entry

type FindingSink

type FindingSink interface {
	Add(entry baseline.Entry) error
}

FindingSink receives normalized findings emitted by the analyzer. Implementations must be safe for concurrent use.

type QueryFact

type QueryFact struct {
	HasDefiniteQuery bool
	HasPossibleQuery bool
}

QueryFact is exported across package boundaries to propagate whether a function definitely or possibly executes a database query.

func (*QueryFact) AFact

func (*QueryFact) AFact()

type RuntimeOptions

type RuntimeOptions struct {
	// Explain appends structured reasoning to diagnostics.
	Explain bool
	// PackagePatterns is used to build/lookup cross-package dynamic dispatch.
	PackagePatterns []string
	// BaselineModeOverride temporarily overrides config.Baseline.Mode.
	BaselineModeOverride string
	// DisableFactExport disables cross-package fact export.
	DisableFactExport bool
	// CaptureOnly records findings but suppresses pass.Report diagnostics.
	CaptureOnly bool
	// CaptureSink receives emitted findings for stats/baseline workflows.
	CaptureSink FindingSink
	// CapturePackageAllowset optionally limits which package findings are captured.
	CapturePackageAllowset map[string]struct{}
}

RuntimeOptions carries run-time behavior that should not come from global process state (env vars), making analyzer execution deterministic and testable.

Jump to

Keyboard shortcuts

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