Documentation
¶
Index ¶
Constants ¶
const DefaultConfigFile = ".commit-msg-lint.yml"
DefaultConfigFile is the name of the configuration file.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
Config represents the complete configuration for commit message linting.
func LoadConfig ¶
LoadConfig loads and validates configuration from the specified directory.
type ParsedCommitMessage ¶
ParsedCommitMessage represents a commit message split into sections.
func ParseCommitMessage ¶
func ParseCommitMessage(message string) ParsedCommitMessage
ParseCommitMessage parses a commit message into title, body, and footer.
Parsing rules: - Sections are separated by empty lines (lines with only whitespace) - Title: First section (always present) - Footer: Last section (after final empty line), if 2+ sections exist - Body: All middle sections (between title and footer), if 3+ sections exist.
type Rule ¶
type Rule struct {
Name string `yaml:"name"`
Type RuleType `yaml:"type"`
Scope Scope `yaml:"scope"`
Pattern string `yaml:"pattern"`
Message string `yaml:"message,omitempty"`
// contains filtered or unexported fields
}
Rule represents a single linting rule.
type RuleViolation ¶
type RuleViolation struct {
Rule Rule
Matched bool // For deny rules: true means pattern matched (violation)
}
RuleViolation represents a failed rule check.
func EvaluateRules ¶
func EvaluateRules(rules []Rule, message ParsedCommitMessage) []RuleViolation
EvaluateRules evaluates all rules against a parsed commit message. Returns a slice of violations (empty if all rules pass).