linter

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRuleFixes

func ApplyRuleFixes[M LintMessage](code string, diagnostics []M) (string, []M, bool)

func RunLinter

func RunLinter(programs []*compiler.Program, singleThreaded bool, allowFiles []string, allowDirs []string, excludedPaths []string, getRulesForFile RuleHandler, typeCheck bool, onDiagnostic DiagnosticHandler) (int32, error)

when allowedFiles is passed as nil which means all files are allowed when allowedFiles is passed as slice, only files in the slice are allowed when allowDirs is set, files under those directories are also allowed (OR logic with allowFiles)

func RunLinterInProgram added in v0.1.9

func RunLinterInProgram(program *compiler.Program, allowFiles []string, allowDirs []string, skipFiles []string, getRulesForFile RuleHandler, typeCheck bool, onDiagnostic DiagnosticHandler) int32

Types

type ConfiguredRule

type ConfiguredRule struct {
	Name     string
	Severity rule.DiagnosticSeverity
	Run      func(ctx rule.RuleContext) rule.RuleListeners
}

type DiagnosticHandler added in v0.1.9

type DiagnosticHandler = func(diagnostic rule.RuleDiagnostic)

type LintMessage

type LintMessage interface {
	Fixes() []rule.RuleFix
}

type RuleHandler added in v0.1.9

type RuleHandler = func(sourceFile *ast.SourceFile) []ConfiguredRule

Jump to

Keyboard shortcuts

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