Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeadingPattern ¶
HeadingPattern is a regex pattern matched against heading text with an associated maximum section length.
type Rule ¶
type Rule struct {
// Max is the default per-section line limit. Zero means no global limit.
Max int
// PerLevel overrides Max for a specific heading level (1-6).
PerLevel map[int]int
// PerHeading overrides Max and PerLevel when the heading text matches.
// The first pattern that matches wins.
PerHeading []HeadingPattern
// MaxWords caps the word count of a section's prose. Zero disables.
MaxWords int
// MinWords sets a lower bound on a section's word count. Zero disables.
MinWords int
// MaxParagraphs caps the number of paragraphs in a section. Zero disables.
MaxParagraphs int
}
Rule enforces per-section line, word, and paragraph counts.
Section span is the lines from the heading line up to (but not including) the next heading line of any level, or the end of file. Nested subsections are measured separately from their parent. Word counts come from the plain text of paragraph nodes inside the section; paragraph counts include only paragraphs in that range (sub-section paragraphs belong to the sub-section).
func (*Rule) ApplySettings ¶
ApplySettings implements rule.Configurable.
func (*Rule) Check ¶
func (r *Rule) Check(f *lint.File) []lint.Diagnostic
Check implements rule.Rule.
func (*Rule) DefaultSettings ¶
DefaultSettings implements rule.Configurable. All keys are returned so re-applying defaults (e.g., test cleanup) fully clears PerLevel and PerHeading, not just Max.
func (*Rule) EnabledByDefault ¶
EnabledByDefault implements rule.Defaultable.