Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExtenionPoints ¶ added in v0.7.1
func GetExtenionPoints() []string
GetExtenionPoints returns a slice of extension points.
func GetTemplate ¶ added in v0.3.4
GetTemplate makes a template for the given extension point.
Types ¶
type Capitalization ¶ added in v0.6.0
type Capitalization struct {
Definition `mapstructure:",squash"`
// `match` (`string`): $title, $sentence, $lower, $upper, or a pattern.
Match string
Check func(string, []string) bool
// `style` (`string`): AP or Chicago; only applies when match is set to $title.
Style string
// `exceptions` (`array`): An array of strings to be ignored.
Exceptions []string
}
Capitalization checks the case of a string.
type Conditional ¶
type Conditional struct {
Definition `mapstructure:",squash"`
// `ignorecase` (`bool`): Makes all matches case-insensitive.
Ignorecase bool
// `first` (`string`): The antecedent of the statement.
First string
// `second` (`string`): The consequent of the statement.
Second string
// `exceptions` (`array`): An array of strings to be ignored.
Exceptions []string
}
Conditional ensures that the present of First ensures the present of Second.
type Consistency ¶
type Consistency struct {
Definition `mapstructure:",squash"`
// `nonword` (`bool`): Removes the default word boundaries (`\b`).
Nonword bool
// `ignorecase` (`bool`): Makes all matches case-insensitive.
Ignorecase bool
// `either` (`map`): A map of `option 1: option 2` pairs, of which only one may appear.
Either map[string]string
}
Consistency ensures that the keys and values of Either don't both exist.
type Definition ¶
type Definition struct {
Code bool
Description string
Extends string
Level string
Link string
Message string
Name string
Scope string
}
Definition holds the common attributes of rule definitions.
type Existence ¶
type Existence struct {
Definition `mapstructure:",squash"`
// `append` (`bool`): Adds `raw` to the end of `tokens`, assuming both are defined.
Append bool
// `ignorecase` (`bool`): Makes all matches case-insensitive.
Ignorecase bool
// `nonword` (`bool`): Removes the default word boundaries (`\b`).
Nonword bool
// `raw` (`array`): A list of tokens to be concatenated into a pattern.
Raw []string
// `tokens` (`array`): A list of tokens to be transformed into a non-capturing group.
Tokens []string
}
Existence checks for the present of Tokens.
type Manager ¶ added in v0.7.1
Manager controls the loading and validating of the check extension points.
func NewManager ¶ added in v0.7.1
NewManager creates a new Manager and loads the rule definitions (that is, extended checks) specified by config.
type Occurrence ¶
type Occurrence struct {
Definition `mapstructure:",squash"`
// `max` (`int`): The maximum amount of times `token` may appear in a given scope.
Max int
// `token` (`string`): The token of interest.
Token string
}
Occurrence counts the number of times Token appears.
type Readability ¶ added in v0.11.0
type Readability struct {
Definition `mapstructure:",squash"`
// `metrics` (`array`): One or more of Gunning Fog, Coleman-Liau, Flesch-Kincaid, SMOG, and Automated Readability.
Metrics []string
// `grade` (`float`): The highest acceptable score.
Grade float64
}
Readability checks the reading grade level of text.
type Repetition ¶
type Repetition struct {
Definition `mapstructure:",squash"`
Max int
// `ignorecase` (`bool`): Makes all matches case-insensitive.
Ignorecase bool
// `alpha` (`bool`): Limits all matches to alphanumeric tokens.
Alpha bool
// `tokens` (`array`): A list of tokens to be transformed into a non-capturing group.
Tokens []string
}
Repetition looks for repeated uses of Tokens.
type Spelling ¶ added in v0.4.1
type Spelling struct {
Definition `mapstructure:",squash"`
// `aff` (`string`): The fully-qualified path to a Hunspell-compatible `.aff` file.
Aff string
// `custom` (`bool`): Turn off the default filters for acronyms, abbreviations, and numbers.
Custom bool
// `dic` (`string`): The fully-qualified path to a Hunspell-compatible `.dic` file.
Dic string
// `filters` (`array`): An array of patterns to ignore during spell checking.
Filters []*regexp.Regexp
// `ignore` (`array`): An array of relative paths (from `StylesPath`) to files consisting of one word per line to ignore.
Ignore []string
Threshold int
}
Spelling checks text against a Hunspell dictionary.
type Substitution ¶
type Substitution struct {
Definition `mapstructure:",squash"`
// `ignorecase` (`bool`): Makes all matches case-insensitive.
Ignorecase bool
// `nonword` (`bool`): Removes the default word boundaries (`\b`).
Nonword bool
// `swap` (`map`): A sequence of `observed: expected` pairs.
Swap map[string]string
// `pos` (`string`): A regular expression matching tokens to parts of speech.
POS string
}
Substitution switches the values of Swap for its keys.