paragraphstructure

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

func (r *Rule) ApplySettings(s map[string]any) error

ApplySettings implements rule.Configurable.

func (*Rule) Category

func (r *Rule) Category() string

Category implements rule.Rule.

func (*Rule) Check

func (r *Rule) Check(f *lint.File) []lint.Diagnostic

Check implements rule.Rule.

func (*Rule) DefaultSettings

func (r *Rule) DefaultSettings() map[string]any

DefaultSettings implements rule.Configurable.

func (*Rule) EnabledByDefault added in v0.23.0

func (r *Rule) EnabledByDefault() bool

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 }`.

func (*Rule) ID

func (r *Rule) ID() string

ID implements rule.Rule.

func (*Rule) Name

func (r *Rule) Name() string

Name implements rule.Rule.

func (*Rule) SettingMergeMode added in v0.7.0

func (r *Rule) SettingMergeMode(key string) rule.MergeMode

SettingMergeMode implements rule.ListMerger.

Jump to

Keyboard shortcuts

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