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 ¶
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
// RootDir is the project root directory (parent of .mdsmith.yml).
// Used by rules that need to read files relative to the project root.
RootDir string
}
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 ¶
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 ¶
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 (include short-circuits when FS is nil). RootFS is set when RootDir is configured for potential future use, but currently has no effect on stdin since the include rule requires FS to be non-nil.