Documentation
¶
Index ¶
- type PathPattern
- type Rule
- func (r *Rule) ApplySettings(settings map[string]any) error
- func (r *Rule) Category() string
- func (r *Rule) Check(f *lint.File) []lint.Diagnostic
- func (r *Rule) DefaultSettings() map[string]any
- func (r *Rule) Fix(f *lint.File) []byte
- func (r *Rule) ID() string
- func (r *Rule) Name() string
- func (r *Rule) SettingMergeMode(key string) rule.MergeMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathPattern ¶ added in v0.14.0
PathPattern records a kind's `path-pattern:` constraint: the kind that declared it and the glob the workspace-relative path of every file in the kind must match. Populated by the config merge layer from KindBody.PathPattern.
type Rule ¶
type Rule struct {
Schema string // path to schema file
InlineSchema *schema.Schema // parsed inline schema (when set)
Placeholders []string // placeholder tokens to treat as opaque
PathPatterns []PathPattern // kind-level path-pattern entries
}
Rule checks that a document's heading structure matches a schema.
A rule instance holds at most one schema source: a path to a proto.md file (Schema) or an already-parsed inline schema (InlineSchema). The kind-level loader rejects configurations that set both on the same kind; the merge logic in internal/config clears the other source whenever a later layer installs a new one, so the rule never has to disambiguate at runtime.
func (*Rule) ApplySettings ¶
ApplySettings implements rule.Configurable.
func (*Rule) Check ¶
func (r *Rule) Check(f *lint.File) []lint.Diagnostic
Check implements rule.Rule.
func (*Rule) DefaultSettings ¶
DefaultSettings implements rule.Configurable.
func (*Rule) Fix ¶ added in v0.14.0
Fix implements rule.FixableRule. The rule does not modify the document body — it returns f.Source unchanged — but when the inline schema declares an `index:` block, Fix emits the JSON side-output next to the source file. `mdsmith check` skips the write, preserving check's read-only contract (plan 143).
Fix swallows the WriteIndex error because Fix returns bytes, not diagnostics. WriteIndex itself records any failure in the package-level cache keyed by f.Path; the next Check reads that cache and surfaces the underlying I/O error in place of the generic "missing / out of date" message, so users are not trapped in a fix loop without signal.