descriptivelinktext

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: 6 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 {
	Banned []string
}

Rule flags links whose visible text is a non-descriptive phrase such as "click here", "here", "link", or "more".

The lookup form of Banned is memoised on the per-Check *lint.File via File.Memo (see cachedBannedSet) rather than on the rule instance. Rule instances are shared across concurrent LSP calls (cmd/mdsmith/lsp.go reuses rule.All(), and ConfigureRule does not clone when cfg.Settings is nil), so any mutable state on the rule itself would race; *lint.File is created fresh per Check and File.Memo is sync.Map + sync.Once protected.

func (*Rule) ApplySettings

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

ApplySettings implements rule.Configurable. banned replaces (not appends to) the default phrase list.

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. The per-link logic is pure and stateless, so it is expressed as CheckNode and the engine can fold this rule into one shared AST walk; a direct call still works via rule.WalkNodes.

func (*Rule) CheckNode added in v0.23.0

func (r *Rule) CheckNode(n ast.Node, entering bool, f *lint.File) []lint.Diagnostic

CheckNode implements rule.NodeChecker.

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. MDS063 is opt-in.

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