Documentation
¶
Index ¶
- type Rule
- func (r *Rule) ApplySettings(s 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) EnabledByDefault() bool
- 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 Rule ¶
type Rule struct {
MaxSentences int
MaxWords int
Placeholders []string // placeholder tokens to treat as opaque
}
Rule checks that paragraphs do not exceed sentence and word limits.
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) EnabledByDefault ¶ added in v0.23.0
EnabledByDefault implements rule.Defaultable. MDS024 is opt-in because exact sentence counting and per-sentence word counting require the trained Punkt segmenter (github.com/neurosnap/sentences), which the neutral CPU profile recorded in plan 187 attributes ~20% of mdsmith's wall time on prose-heavy input. Punkt's cost is the trained model's regex execution (english.MultiPunctWordAnnotation.tokenAnnotation runs reAbbr and the token-type matchers with backtracking on every period-ending token), and no pure-Go Punkt-equivalent faster segmenter exists — plan 187 records the negative with a reusable equivalence harness. Users who want the diagnostic enable it explicitly; the default check path stops paying the ~20%.
NOTE: This is a behaviour change. Before this rule implemented rule.Defaultable, MDS024 ran on every default check. Existing .mdsmith.yml configs that did not pin paragraph-structure will no longer emit prose-structure diagnostics until they opt in via `rules: { paragraph-structure: true }`.