Documentation
¶
Index ¶
Constants ¶
const MaxLeadingEmojis = 3
MaxLeadingEmojis is the most leading :shortcode: emoji a commit message may carry. The parser consumes every leading emoji token, however many there are; the commit rules (see internal/analyzer/commit) reject a message whose Emojis exceeds this count.
Variables ¶
var AllowedTypes = []string{
"feat", "fix", "refactor", "chore", "docs",
"test", "perf", "build", "ci", "style", "revert",
}
AllowedTypes are the Conventional Commit types recognized by the linter.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// Emojis are the leading :shortcode: tokens (1-3 allowed).
Emojis []string
// Type is the Conventional Commit type (feat, fix, etc.).
Type string
// Scope is the optional parenthesized scope, without parens.
Scope string
// Breaking is true when the subject carries the ! marker.
Breaking bool
// Description is the subject text after "type(scope)!: ".
Description string
// Body is the optional text after the subject, separated by a blank line.
Body string
Footers []Footer
// IsMerge is true for ":volcano: Merge ..." messages (no type required).
IsMerge bool
// IsInitial is true for ":ghost: Initial Commit" messages (no type required).
IsInitial bool
// IsWIP is true when the description starts with [wip] or [WIP].
IsWIP bool
// Raw is the original input message.
Raw string
}
Message is the structured representation of a parsed commit message. The parser fills these fields by consuming the raw message rune by rune.
func Parse ¶
Parse parses a raw commit message into a Message. It is lenient: parse errors are recorded but the message is still returned with whatever fields could be extracted. The caller validates via the rules package.
func (Message) ToolTrailer ¶
ToolTrailer returns the first tool-attribution signal found in the message (a forbidden trailer key or an attribution marker anywhere in the raw text), or "" when the message carries none.