propernames

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

Documentation

Overview

Package propernames implements MDS050, which checks that proper names (e.g. JavaScript, GitHub) appear with their configured casing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	// Names is the list of proper names with their canonical casing.
	// The names list appends across config layers so kind layers extend
	// rather than replace the inherited vocabulary (same convention as
	// placeholders:).
	Names []string
	// CheckCode enables checking inside code spans and code blocks.
	CheckCode bool
	// CheckHTML enables checking inside raw HTML and HTML blocks.
	CheckHTML bool
}

Rule reports occurrences of configured proper names that do not match their canonical casing (e.g. "Javascript" when "JavaScript" is configured).

func (*Rule) ApplySettings

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

ApplySettings implements rule.Configurable. The names list appends across config layers (same as placeholders:) so kind layers can extend the inherited vocabulary rather than replace it.

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) Fix

func (r *Rule) Fix(f *lint.File) []byte

Fix implements rule.FixableRule. It replaces each wrong-cased match with the canonical spelling. Only the left boundary is enforced — the byte before the match must be a non-word character (or start of file), but no right-boundary check is applied. The matched prefix is replaced and any trailing word characters (e.g. the 's' in "JavaScripts") are left as-is.

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

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

SettingMergeMode implements rule.ListMerger. The names list appends across config layers so kind layers extend the inherited vocabulary without replacing it.

Jump to

Keyboard shortcuts

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