parser

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PatchTypes is the list of categories used to determine if this commit is a patch bump or not.
	PatchTypes = []string{
		"fix",
		"refactor",
		"perf",
		"docs",
		"style",
		"bug",
		"test",
	}

	// MinorTypes is the list of categories used to determine if this commit is a minor bump or not.
	MinorTypes = []string{
		"feat",
		"feature",
		"story",
	}

	// MajorTypes is the list of categories used to determine if this commit is a major bump or not.
	MajorTypes = []string{
		"breaking",
	}
)

Functions

This section is empty.

Types

type ConventionalCommit

type ConventionalCommit struct {
	Raw     string   `yaml:"raw"`
	Type    string   `yaml:"category"`
	Scope   string   `yaml:"scope"`
	Subject string   `yaml:"subject"`
	Header  string   `yaml:"header"`
	Body    string   `yaml:"body"`
	Footer  []string `yaml:"footer"`
	Major   bool     `yaml:"major"`
	Minor   bool     `yaml:"minor"`
	Patch   bool     `yaml:"patch"`
	Fixup   bool     `yaml:"fixup"`
}

ConventionalCommit a parsed conventional commit message.

func ParseConventionalCommit

func ParseConventionalCommit(message string) (commit *ConventionalCommit)

ParseConventionalCommit takes a commits message and parses it into usable blocks.

func (*ConventionalCommit) Compare

func (v *ConventionalCommit) Compare(other *ConventionalCommit) int

Compare compares this version to another version. This returns -1, 0, or 1 if this version is smaller, equal, or larger than the other version, respectively.

If you want boolean results, use the LessThan, Equal, GreaterThan, GreaterThanOrEqual or LessThanOrEqual methods.

func (*ConventionalCommit) Equal

Equal tests if two versions are equal.

func (*ConventionalCommit) GreaterThan

func (v *ConventionalCommit) GreaterThan(o *ConventionalCommit) bool

GreaterThan tests if this version is greater than another version.

func (*ConventionalCommit) GreaterThanOrEqual

func (v *ConventionalCommit) GreaterThanOrEqual(o *ConventionalCommit) bool

GreaterThanOrEqual tests if this version is greater than or equal to another version.

func (*ConventionalCommit) LessThan

func (v *ConventionalCommit) LessThan(o *ConventionalCommit) bool

LessThan tests if this version is less than another version.

func (*ConventionalCommit) LessThanOrEqual

func (v *ConventionalCommit) LessThanOrEqual(o *ConventionalCommit) bool

LessThanOrEqual tests if this version is less than or equal to another version.

type ConventionalCommits

type ConventionalCommits []*ConventionalCommit

ConventionalCommits a slice of parsed conventional commit messages.

func ParseConventionalCommits

func ParseConventionalCommits(messages []string) (commits ConventionalCommits)

func (ConventionalCommits) Len

func (v ConventionalCommits) Len() int

Len return the number of messages in the slice required to implement sortable interface https://golang.org/pkg/sort/#Interface

func (ConventionalCommits) Less

func (v ConventionalCommits) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j. required to implement sortable interface https://golang.org/pkg/sort/#Interface

func (ConventionalCommits) Swap

func (v ConventionalCommits) Swap(i, j int)

Swap swaps the elements with indexes i and j. required to implement sortable interface https://golang.org/pkg/sort/#Interface

Jump to

Keyboard shortcuts

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