lint

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 31 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 Comment

type Comment struct {
	Text   string
	Line   int
	Offset int
	Scope  string
}

Comment represents an in-code comment (line or block).

type ExtendedHTMLWriter

type ExtendedHTMLWriter struct {
	*org.HTMLWriter
}

func (*ExtendedHTMLWriter) WriteComment

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

type Linter

type Linter struct {
	Manager *check.Manager

	HasDir bool
	// 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.

type Solution

type Solution struct {
	Suggestions []string `json:"suggestions"`
	Error       string   `json:"error"`
}

Solution is a potential solution to an alert.

func ParseAlert

func ParseAlert(s string, cfg *core.Config) (Solution, error)

ParseAlert returns a slice of suggestions for the given Vale alert.

Jump to

Keyboard shortcuts

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