conventional_commit

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 3 Imported by: 1

README

go-conventional-commit

golang parser for conventional-commit messages https://www.conventionalcommits.org/

Documentation

Index

Constants

This section is empty.

Variables

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

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

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

Functions

This section is empty.

Types

type ConventionalCommit

type ConventionalCommit struct {
	Category    string   `yaml:"category"`
	Scope       string   `yaml:"scope"`
	Description string   `yaml:"description"`
	Body        string   `yaml:"body"`
	Footer      []string `yaml:"footer"`
	Major       bool     `yaml:"major"`
	Minor       bool     `yaml:"minor"`
	Patch       bool     `yaml:"patch"`
}

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