engine

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRules

func CheckRules(f *lint.File, rules []rule.Rule, effective map[string]config.RuleCfg) ([]lint.Diagnostic, []error)

CheckRules runs all enabled rules against f, cloning and applying settings for Configurable rules. It adjusts diagnostics using f.AdjustDiagnostics and returns the collected diagnostics and any settings-application errors.

func ConfigureRule

func ConfigureRule(rl rule.Rule, cfg config.RuleCfg) (rule.Rule, error)

ConfigureRule clones a rule and applies settings from cfg if the rule implements Configurable and cfg has settings. Returns the configured rule (or the original if no settings apply) and any error from ApplySettings.

Types

type Result

type Result struct {
	// FilesChecked is the number of files processed (after ignore filtering).
	FilesChecked int
	Diagnostics  []lint.Diagnostic
	Errors       []error
}

Result holds the output of a lint run.

type Runner

type Runner struct {
	Config           *config.Config
	Rules            []rule.Rule
	StripFrontMatter bool
	Logger           *vlog.Logger
}

Runner drives the linting pipeline: for each file it reads the content, builds a File (parsing the AST once), determines the effective rule configuration, runs enabled rules, and collects diagnostics.

func (*Runner) Run

func (r *Runner) Run(paths []string) *Result

Run lints the files at the given paths and returns a Result containing all diagnostics (sorted by file, line, column) and any errors encountered.

func (*Runner) RunSource

func (r *Runner) RunSource(path string, source []byte) *Result

RunSource lints in-memory source bytes (e.g. from stdin) and returns a Result. It creates a File via NewFileFromSource, determines the effective config, and uses CheckRules (which includes clone+settings logic and line-offset adjustment).

The File's FS field is left nil because in-memory source has no meaningful filesystem context. Rules that access f.FS must handle nil.

Jump to

Keyboard shortcuts

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