requiredtextpatterns

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: 7 Imported by: 0

Documentation

Overview

Package requiredtextpatterns implements MDS057, which flags heading-bounded sections whose body text does not match a configured regex.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pattern

type Pattern struct {
	Source      string
	Regex       *regexp.Regexp
	Message     string
	SkipIndices []int
}

Pattern is a compiled required-text pattern with optional message and skip-indices.

type Rule

type Rule struct {
	Patterns []Pattern
}

Rule flags heading-bounded sections whose plain text does not match a configured regular expression. Walks every heading in the document and, for each one, gathers the prose under the heading (paragraphs, including those in nested sub-sections) and tests each configured pattern against the gathered text. A failing pattern emits one diagnostic anchored at the heading line so the per-scope override from plan 146 keeps only diagnostics that fall inside the configured scope's line range.

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

func (r *Rule) EnabledByDefault() bool

EnabledByDefault implements rule.Defaultable.

func (*Rule) ID

func (r *Rule) ID() string

ID implements rule.Rule.

func (*Rule) Name

func (r *Rule) Name() string

Name implements rule.Rule.

Jump to

Keyboard shortcuts

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