rules

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupRule

func LookupRule(query string) (string, error)

LookupRule finds a rule by ID (e.g. "MDS001") or name (e.g. "line-length") and returns its README content with front matter stripped.

func StripFrontMatter added in v0.14.0

func StripFrontMatter(content string) string

StripFrontMatter removes the leading YAML front matter block (--- ... ---) and any immediately following blank line from content.

Types

type Maintainability added in v0.17.0

type Maintainability struct {
	Signal        string `yaml:"signal"`
	Fix           string `yaml:"fix"`
	ForDiagnostic bool   `yaml:"for-diagnostic"`
}

Maintainability captures a rule's adoption pattern: the structural shape a reviewer looks for (Signal) and the fix that turns it into the rule's declared form (Fix). ForDiagnostic gates whether the fix is appropriate to surface on an active diagnostic hover (true) or only as an adoption suggestion before the rule fires (false).

type MarkdownlintRule added in v0.23.0

type MarkdownlintRule struct {
	ID      string `yaml:"id"`
	Name    string `yaml:"name"`
	Partial bool   `yaml:"partial"`
}

MarkdownlintRule names a markdownlint rule that the mdsmith rule covers. Partial is true when the mdsmith rule implements only part of the corresponding markdownlint check; the coverage matrix at docs/research/markdownlint-coverage/README.md is the source of truth.

func (MarkdownlintRule) URL added in v0.23.0

func (r MarkdownlintRule) URL() string

URL returns the canonical markdownlint documentation URL for this rule. Markdownlint hosts per-rule docs at a stable per-ID path keyed on the lowercase ID, so the URL is derivable from ID alone.

type RuleInfo

type RuleInfo struct {
	ID              string
	Name            string
	Status          string
	Description     string
	Content         string
	Maintainability *Maintainability
	Markdownlint    []MarkdownlintRule
}

RuleInfo holds metadata extracted from a rule README's front matter.

func ListRules

func ListRules() ([]RuleInfo, error)

ListRules returns all embedded rules sorted by ID.

func LookupRuleInfo added in v0.17.0

func LookupRuleInfo(query string) (RuleInfo, error)

LookupRuleInfo finds a rule by ID (e.g. "MDS001") or name (e.g. "line-length") and returns its full metadata, including the parsed maintainability block and the raw README content (front matter not stripped).

Directories

Path Synopsis
Package all is a blank-import barrel that registers every production rule with the rule registry.
Package all is a blank-import barrel that registers every production rule with the rule registry.
Package ambiguousemphasis implements MDS047, which flags emphasis runs whose meaning a human cannot predict at a glance.
Package ambiguousemphasis implements MDS047, which flags emphasis runs whose meaning a human cannot predict at a glance.
Package blockquotewhitespace implements MDS059, which flags two blockquote defects: more than one space after the > marker (MD027) and a blank line between two adjacent sibling blockquote nodes (MD028).
Package blockquotewhitespace implements MDS059, which flags two blockquote defects: more than one space after the > marker (MD027) and a blank line between two adjacent sibling blockquote nodes (MD028).
Package build implements MDS039, which validates <?build?> directive parameters and keeps the body in sync with the recipe's body-template.
Package build implements MDS039, which validates <?build?> directive parameters and keeps the body in sync with the recipe's body-template.
Package duplicatedcontent implements MDS037, which flags substantial paragraphs that also appear verbatim in another Markdown file in the project root after whitespace and case normalization.
Package duplicatedcontent implements MDS037, which flags substantial paragraphs that also appear verbatim in another Markdown file in the project root after whitespace and case normalization.
Package fencepos answers "where in the source does a fenced code block's opening and closing fence line sit, and what fence character did the author use?" The helpers here let any rule reason about the raw fence delimiters of a *ast.FencedCodeBlock without owning that scanning logic itself.
Package fencepos answers "where in the source does a fenced code block's opening and closing fence line sit, and what fence character did the author use?" The helpers here let any rule reason about the raw fence delimiters of a *ast.FencedCodeBlock without owning that scanning logic itself.
Package forbiddenparagraphstarts implements MDS055, which flags paragraphs whose plain text begins with any configured prefix.
Package forbiddenparagraphstarts implements MDS055, which flags paragraphs whose plain text begins with any configured prefix.
Package forbiddentext implements MDS056, which flags paragraphs whose plain text contains any configured substring.
Package forbiddentext implements MDS056, which flags paragraphs whose plain text contains any configured substring.
Package githooksync implements MDS048, the git-hook-sync rule.
Package githooksync implements MDS048, the git-hook-sync rule.
Package linkvalidity implements MDS062, which flags links that silently do not work: the reversed (text)[url] form (markdownlint MD011) and links or images whose destination is empty/`#` or whose visible text is empty (markdownlint MD042).
Package linkvalidity implements MDS062, which flags links that silently do not work: the reversed (text)[url] form (markdownlint MD011) and links or images whose destination is empty/`#` or whose visible text is empty (markdownlint MD042).
Package listmarkerspace implements MDS061, which enforces a consistent number of spaces between a list marker and item text, configurable per single-line vs multi-paragraph items and ordered vs unordered lists.
Package listmarkerspace implements MDS061, which enforces a consistent number of spaces between a list marker and item text, configurable per single-line vs multi-paragraph items and ordered vs unordered lists.
Package listmarkerstyle implements MDS045, which pins the bullet character for unordered lists.
Package listmarkerstyle implements MDS045, which pins the bullet character for unordered lists.
Package markdownflavor implements MDS034, which validates Markdown against a declared target flavor (commonmark, gfm, goldmark, pandoc, phpextra, multimarkdown, myst, or any) and flags syntax the target renderer will not understand.
Package markdownflavor implements MDS034, which validates Markdown against a declared target flavor (commonmark, gfm, goldmark, pandoc, phpextra, multimarkdown, myst, or any) and flags syntax the target renderer will not understand.
ext
Package ext implements detection-only goldmark extensions used by MDS034 (markdown-flavor) to flag syntax that varies across Markdown flavors.
Package ext implements detection-only goldmark extensions used by MDS034 (markdown-flavor) to flag syntax that varies across Markdown flavors.
Package noreferencestyle implements MDS043, which forbids reference-style links and footnotes.
Package noreferencestyle implements MDS043, which forbids reference-style links and footnotes.
Package nospaceincodespans implements MDS052, which flags inline code spans with leading or trailing whitespace inside the backticks.
Package nospaceincodespans implements MDS052, which flags inline code spans with leading or trailing whitespace inside the backticks.
Package noundefinedreferencelabels implements MDS054, which flags reference-style links and images whose label has no matching link reference definition in the file.
Package noundefinedreferencelabels implements MDS054, which flags reference-style links and images whose label has no matching link reference definition in the file.
Package nounusedlinkdefinitions implements MDS053, which flags link reference definitions that are never used by any reference-style link or image, and definitions that duplicate an existing label.
Package nounusedlinkdefinitions implements MDS053, which flags link reference definitions that are never used by any reference-style link or image, and definitions that duplicate an existing label.
Package orderedlistnumbering implements MDS046, which pins how ordered list items are numbered in the source: literal sequential (1.
Package orderedlistnumbering implements MDS046, which pins how ordered list items are numbered in the source: literal sequential (1.
Package propernames implements MDS050, which checks that proper names (e.g.
Package propernames implements MDS050, which checks that proper names (e.g.
Package recipesafety implements MDS040, which validates every command in build.recipes for shell-safety at lint time.
Package recipesafety implements MDS040, which validates every command in build.recipes for shell-safety at lint time.
Package requiredmentions implements MDS058, which flags heading-bounded sections whose body text does not contain every configured substring.
Package requiredmentions implements MDS058, which flags heading-bounded sections whose body text does not contain every configured substring.
Package requiredtextpatterns implements MDS057, which flags heading-bounded sections whose body text does not match a configured regex.
Package requiredtextpatterns implements MDS057, which flags heading-bounded sections whose body text does not match a configured regex.
Package settings provides shared helpers for coercing rule-configuration values decoded from YAML/CUE into Go types.
Package settings provides shared helpers for coercing rule-configuration values decoded from YAML/CUE into Go types.
Package tablefmt answers "what does the canonical aligned form of a pipe-table look like for these source lines?" Callers ask the package to format a string of markdown, to spot non-conforming tables in a parsed line list, or to rewrite the source bytes in place.
Package tablefmt answers "what does the canonical aligned form of a pipe-table look like for these source lines?" Callers ask the package to format a string of markdown, to spot non-conforming tables in a parsed line list, or to rewrite the source bytes in place.
Package toc implements MDS038, the <?toc?> generated-section directive that emits a nested heading list linked to GitHub-style anchors.
Package toc implements MDS038, the <?toc?> generated-section directive that emits a nested heading list linked to GitHub-style anchors.
Package tocdirective implements MDS035, which flags renderer-specific table-of-contents directives that render as literal text on CommonMark and goldmark.
Package tocdirective implements MDS035, which flags renderer-specific table-of-contents directives that render as literal text on CommonMark and goldmark.

Jump to

Keyboard shortcuts

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