conventionalcommit

package
v0.70.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package conventionalcommit parses and inspects commit messages against the Conventional Commits 1.0.0 grammar. It validates structure only — it does not enforce a type allow-list (that policy decision lives in internal/app.VerifyCommit) and it does not replicate the broader commitlint-style rule catalog (casing, length limits, signed-off-by, etc.) — see ADR-0027's "Explicitly still out of scope" note.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFixupCommit

func IsFixupCommit(message string) bool

IsFixupCommit reports whether message is a git "fixup!"/"squash!" autosquash commit.

func IsMergeCommit

func IsMergeCommit(message string) bool

IsMergeCommit reports whether message is a git-generated merge commit ("Merge branch ...", "Merge pull request ...", "Merge remote-tracking branch ...").

Types

type Commit

type Commit struct {
	Type        string
	Scope       string
	Breaking    bool
	Description string
	Body        string
	Footers     []Footer
}

Commit is the structural result of parsing a conventional-commit message.

func Parse

func Parse(message string) (*Commit, error)

Parse validates message against the Conventional Commits grammar and returns its structural components. It enforces grammar only — callers needing a type allow-list apply that policy themselves (see internal/app.VerifyCommit).

func (*Commit) Format added in v0.44.0

func (c *Commit) Format() string

Format renders a Commit back to its canonical Conventional Commits message text. It round-trips with Parse: Parse(c.Format()) reproduces c's structural fields. Empty scope, body, and footer list are omitted; Breaking adds "!" to the header.

type Footer struct {
	Token string
	Value string
}

Footer is one trailer in a commit message's footer block, e.g. "Acked-by: Alice" or "BREAKING CHANGE: removes the old flag".

func ParseFooterLine added in v0.44.0

func ParseFooterLine(line string) (Footer, bool)

ParseFooterLine parses a single footer trailer line for message construction (the commit wizard). ok is false when line is not a valid footer. Unlike the internal footer-block parser used by Parse, it preserves the leading "#" of the "Token #value" form so the result round-trips through Format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL