Documentation
¶
Overview ¶
Package style shapes and checks commit messages.
The rules are the ones people actually argue about in review: banned punctuation, subject length, whether a subject ends in a period. preen applies them to the messages it generates and verifies the result, so a configured style is enforced rather than merely requested.
Index ¶
Constants ¶
const DefaultMaxSubject = 72
DefaultMaxSubject is the subject cap when a style does not set one. It is the width git's own tooling assumes.
Variables ¶
var ErrStyle = errors.New("message does not match the configured style")
ErrStyle reports a commit message that breaks the configured convention.
Functions ¶
This section is empty.
Types ¶
type Punctuation ¶
type Punctuation string
Punctuation controls terminal punctuation on a subject.
const ( // PunctAuto leaves terminal punctuation as written. PunctAuto Punctuation = "auto" // PunctAlways ends the subject with a period. PunctAlways Punctuation = "always" // PunctNever strips terminal punctuation from the subject. PunctNever Punctuation = "never" )
The punctuation modes.
type Style ¶
type Style struct {
// NoEmDash forbids em and en dashes anywhere in a message.
NoEmDash bool
// NoSemicolon forbids semicolons.
NoSemicolon bool
// NoHyphen forbids hyphens, for repositories that spell compounds out.
NoHyphen bool
// MaxSubject caps the subject length. Zero means the default of 72.
MaxSubject int
// Punctuation controls the terminal punctuation on a subject.
Punctuation Punctuation
// LowerSubject lowercases the first letter of the subject.
LowerSubject bool
// Conventional shapes subjects as Conventional Commits, "type: subject".
Conventional bool
// Prefix is prepended to every subject, such as a ticket identifier.
Prefix string
// Body controls whether a message keeps a body.
Body BodyMode
// SignOff adds a Signed-off-by trailer built from Signer.
SignOff bool
// Signer is the identity used for the sign-off trailer.
Signer string
}
Style is a commit message convention.