Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllChecks = map[string]check{}
AllChecks holds all of our individual checks. The keys are in the form "styleName.checkName".
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Check string // the name of the check
Description string // why `Message` is meaningful
Line int // the source line
Link string // reference material
Message string // the output message
Severity string // 'suggestion', 'warning', or 'error'
Span []int // the [begin, end] location within a line
}
An Alert represents a potential error in prose.
type Block ¶
type Block struct {
Context string // parent content (if any) - e.g., paragraph -> sentence
Text string // text content
Scope Selector // section selector
}
A Block represents a section of text.
type ByPosition ¶
type ByPosition []Alert
ByPosition sorts Alerts by line and column.
func (ByPosition) Len ¶
func (a ByPosition) Len() int
func (ByPosition) Less ¶
func (a ByPosition) Less(i, j int) bool
func (ByPosition) Swap ¶
func (a ByPosition) Swap(i, j int)
type Conditional ¶ added in v0.3.0
type Conditional struct {
Definition `mapstructure:",squash"`
Ignorecase bool
First string
Second string
Exceptions []string
}
Conditional ensures that the present of First ensures the present of Second.
type Consistency ¶ added in v0.3.0
type Consistency struct {
Definition `mapstructure:",squash"`
Nonword bool
Ignorecase bool
Either map[string]string
}
Consistency ensures that the keys and values of Either don't both exist.
type Definition ¶ added in v0.3.0
type Definition struct {
Description string
Extends string
Level string
Link string
Message string
Name string
Scope string
}
Definition holds the common attributes of rule definitions.
type Existence ¶ added in v0.3.0
type Existence struct {
Definition `mapstructure:",squash"`
Ignorecase bool
Nonword bool
Raw []string
Tokens []string
}
Existence checks for the present of Tokens.
type File ¶
type File struct {
Alerts []Alert // all alerts associated with this file
BaseStyles []string // base style assigned in .vale
Checks map[string]bool // syntax-specific checks assigned in .txtint
Counts map[string]int // word counts
Format string // 'code', 'markup' or 'prose'
NormedExt string // the normalized extension (see util/format.go)
Path string // the full path
RealExt string // actual file extension
Scanner *bufio.Scanner // used by lintXXX functions
Sequences []string // tracks various info (e.g., defined abbreviations)
}
A File represents a linted text file.
func (*File) SortedAlerts ¶
SortedAlerts returns all of f's alerts sorted by line and column.
type Occurrence ¶ added in v0.3.0
type Occurrence struct {
Definition `mapstructure:",squash"`
Max int
Token string
}
Occurrence counts the number of times Token appears.
type Repetition ¶ added in v0.3.0
type Repetition struct {
Definition `mapstructure:",squash"`
Max int
Ignorecase bool
Tokens []string
}
Repetition looks for repeated uses of Tokens.
type Script ¶ added in v0.3.0
type Script struct {
Definition `mapstructure:",squash"`
Exe string
Runtime string
}
Script runs Exe with Runtime.
type Selector ¶
type Selector struct {
Value string // e.g., text.comment.line.py
}
A Selector represents a named section of text.
type Substitution ¶ added in v0.3.0
type Substitution struct {
Definition `mapstructure:",squash"`
Ignorecase bool
Nonword bool
Swap map[string]string
}
Substitution switches the values of Swap for its keys.