lint

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityWarning = "warning"
	SeverityError   = "error"

	CodeDeadRule            = "dead-rule"
	CodeDeadFlow            = "dead-flow"
	CodeMissingInverse      = "missing-inverse"
	CodeMissingConcurrency  = "missing-concurrency"
	CodeMissingCapability   = "missing-capability"
	CodeOverbroadCapability = "overbroad-capability"
	CodeMissingResources    = "missing-resources"
	CodeUnsafeExpression    = "unsafe-expression"
	CodeDivisionByZero      = "division-by-zero"
	CodeEmptyFactPath       = "empty-fact-path"
	CodeUnusedBinding       = "unused-binding"
	CodeBindingNoReturn     = "binding-no-return"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	File     string
	Pos      lexer.Position
	Severity string
	Code     string
	Message  string
}

Issue represents a linter finding.

func LintFile

func LintFile(file *ast.File, path string, verbs VerbLookup) []Issue

LintFile runs lint checks on a parsed file.

func LintFileWithOptions

func LintFileWithOptions(file *ast.File, path string, verbs VerbLookup, options LintOptions) []Issue

LintFileWithOptions runs lint checks with custom options.

type LintOptions

type LintOptions struct {
	UnsafeMode UnsafeMode
	VerbMode   VerbMode
}

LintOptions configures lint behavior.

func DefaultOptions

func DefaultOptions() LintOptions

DefaultOptions returns the default lint options.

type UnsafeMode

type UnsafeMode string

UnsafeMode controls how unsafe expression usage is reported.

const (
	UnsafeIgnore UnsafeMode = "ignore"
	UnsafeWarn   UnsafeMode = "warn"
	UnsafeError  UnsafeMode = "error"
)

func ParseUnsafeMode

func ParseUnsafeMode(raw string) (UnsafeMode, error)

ParseUnsafeMode parses a string into UnsafeMode.

type VerbLookup

type VerbLookup interface {
	GetVerb(name string) (*verb.Spec, bool)
}

VerbLookup provides access to verb specifications.

type VerbMode

type VerbMode string

VerbMode controls how verb-related lint issues are reported.

const (
	VerbIgnore VerbMode = "ignore"
	VerbWarn   VerbMode = "warn"
	VerbError  VerbMode = "error"
)

func ParseVerbMode

func ParseVerbMode(raw string) (VerbMode, error)

ParseVerbMode parses a string into VerbMode.

Jump to

Keyboard shortcuts

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