Documentation
¶
Index ¶
- func ApplyRuleFixes[M LintMessage](code string, diagnostics []M) (string, []M, bool)
- func RunLinter(programs []*compiler.Program, singleThreaded bool, allowFiles []string, ...) (int32, error)
- func RunLinterInProgram(program *compiler.Program, allowFiles []string, allowDirs []string, ...) int32
- type ConfiguredRule
- type DiagnosticHandler
- type LintMessage
- type RuleHandler
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, typeInfoFiles map[string]struct{}, fileFilters []func(string) bool) (int32, error)
RunLinter runs all configured rules across the given programs in parallel.
- allowFiles: if non-nil, only lint files in this list; nil = all files
- allowDirs: if non-nil, also lint files under these dirs (OR with allowFiles)
- typeInfoFiles: files with type info; gap files not in this set skip type-aware rules
- fileFilters: optional per-program ownership filters (parallel to programs). In multi-config mode, each filter ensures a program only lints files owned by its nearest config. nil or missing entries = no filter (process all).
func RunLinterInProgram ¶ added in v0.1.9
func RunLinterInProgram(program *compiler.Program, allowFiles []string, allowDirs []string, skipFiles []string, getRulesForFile RuleHandler, typeCheck bool, onDiagnostic DiagnosticHandler, typeInfoFiles map[string]struct{}, fileFilter func(string) bool) int32
RunLinterInProgram lints files in a single Program. Files are filtered through skipFiles, allowFiles/allowDirs, and the optional fileFilter before rule execution. fileFilter is used in multi-config mode for ownership-based deduplication: only files owned by this program's config pass the filter. Pass nil to lint all files.
Types ¶
type ConfiguredRule ¶
type ConfiguredRule struct {
Name string
Settings map[string]interface{}
Severity rule.DiagnosticSeverity
RequiresTypeInfo bool
Run func(ctx rule.RuleContext) rule.RuleListeners
}
func FilterNonTypeAwareRules ¶ added in v0.4.0
func FilterNonTypeAwareRules(rules []ConfiguredRule) []ConfiguredRule
FilterNonTypeAwareRules returns only rules that do not require type information.
type DiagnosticHandler ¶ added in v0.1.9
type DiagnosticHandler = func(diagnostic rule.RuleDiagnostic)
type LintMessage ¶
type RuleHandler ¶ added in v0.1.9
type RuleHandler = func(sourceFile *ast.SourceFile) []ConfiguredRule
Click to show internal directories.
Click to hide internal directories.