Help us shape the future of Go! Take the 2026 Go Developer Survey

lint

package
v3.25.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Overview

Package lint implements Vale's syntax-aware linting functionality.

The package is split into core linting logic (this file), source code (code.go), and markup (markup.go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentErrors added in v3.25.0

type DocumentErrors []error

DocumentErrors are the documents a run couldn't lint, each with its own error. Every other document was linted.

func (DocumentErrors) Error added in v3.25.0

func (e DocumentErrors) Error() string

type ExtendedHTMLWriter

type ExtendedHTMLWriter struct {
	*org.HTMLWriter
}

func (*ExtendedHTMLWriter) WriteComment

func (w *ExtendedHTMLWriter) WriteComment(n org.Comment)

func (*ExtendedHTMLWriter) WriteFootnoteDefinition added in v3.23.0

func (w *ExtendedHTMLWriter) WriteFootnoteDefinition(f org.FootnoteDefinition)

WriteFootnoteDefinition writes a footnote's body where the source has it. go-org collects the definitions and writes them at the end of the document, and an alert in one was then reported wherever the text next happened to match.

func (w *ExtendedHTMLWriter) WriteFootnoteLink(l org.FootnoteLink)

WriteFootnoteLink writes an inline footnote's text and nothing for a reference: the number go-org writes is not in the source.

func (*ExtendedHTMLWriter) WriteKeyword added in v3.23.0

func (w *ExtendedHTMLWriter) WriteKeyword(k org.Keyword)

WriteKeyword writes a prose keyword where it is: the title as a heading, the author or description as a paragraph. go-org writes the title at the top of the document instead, which is not where the source has it, so that is switched off in lintOrg.

type Linter

type Linter struct {
	Manager *check.Manager

	// BlockHook, when set, receives every block before its rules run.
	BlockHook func(nlp.Block)

	// RuleHook, when set, receives each rule's name and what its Run cost.
	// A hooked run takes the serial path, which is the one that can time a rule.
	RuleHook func(name string, took time.Duration)
	// contains filtered or unexported fields
}

A Linter lints a File.

func NewLinter

func NewLinter(cfg *core.Config) (*Linter, error)

NewLinter initializes a Linter.

func (*Linter) Lint

func (l *Linter) Lint(input []string, pat string) ([]*core.File, error)

Lint src according to its format.

func (*Linter) LintString

func (l *Linter) LintString(src string) ([]*core.File, error)

LintString src according to its format.

func (*Linter) Transform

func (l *Linter) Transform(f *core.File) (string, error)

Transform applies the configured transformations to text and returns the result.

This is used by the `vale` command to apply transformations to text before linting it.

Transformations include block and token ignores, as well as some built-in replacements.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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