rule

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r Rule)

Register adds a rule to the global registry.

func Reset

func Reset()

Reset clears the registry. Used for testing.

Types

type Configurable

type Configurable interface {
	ApplySettings(settings map[string]any) error
	DefaultSettings() map[string]any
}

Configurable is implemented by rules that have user-tunable settings.

type Defaultable

type Defaultable interface {
	EnabledByDefault() bool
}

Defaultable is implemented by rules that override the default enabled state in generated/runtime configs.

type FixableRule

type FixableRule interface {
	Rule
	Fix(f *lint.File) []byte
}

FixableRule is a Rule that can also auto-fix violations.

type Rule

type Rule interface {
	ID() string
	Name() string
	Category() string
	Check(f *lint.File) []lint.Diagnostic
}

Rule is a single lint rule that checks a Markdown file.

func All

func All() []Rule

All returns a copy of all registered rules.

func ByID

func ByID(id string) Rule

ByID returns the registered rule with the given ID, or nil.

func CloneRule

func CloneRule(r Rule) Rule

CloneRule creates a deep copy of a rule. If the rule implements Configurable, the clone is produced by creating a new zero-value instance and applying the original's DefaultSettings. Otherwise it falls back to a reflect-based shallow copy of the struct.

Jump to

Keyboard shortcuts

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