Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyPolicy(commits []*Commit, cfg *config.Config) error
- func ErrBlankLine(id string) error
- func ErrDescriptionLength(id string, min int, max int) error
- func ErrEmpty(id string) error
- func ErrPolicy(id string, msg string) error
- func ErrRequiredFooters(id string, tokens util.CaseInsensitiveSet) error
- func ErrRequiredScope(id string) error
- func ErrSummary(id string) error
- func ErrSyntax(id string, msg string) error
- func ErrUnrecognizedFooter(id string, token string) error
- func ErrUnrecognizedScope(id string) error
- func ErrUnrecognizedType(id string) error
- func IterRange(repoPath string, rangeSpec string, cfg *config.Config, ...) error
- func StripComments(msg string) string
- type Commit
- type Footer
- type ParseError
Constants ¶
const ( Breaking = iota Minor Patch Uncategorized )
Variables ¶
Functions ¶
func ErrBlankLine ¶
func ErrRequiredFooters ¶
func ErrRequiredFooters(id string, tokens util.CaseInsensitiveSet) error
func ErrRequiredScope ¶
func ErrSummary ¶
func ErrUnrecognizedFooter ¶
func ErrUnrecognizedScope ¶
func ErrUnrecognizedType ¶
func IterRange ¶
func IterRange(repoPath string, rangeSpec string, cfg *config.Config, f func(*Commit, error) bool) error
IterRange parses all of the commit messages in the range. For each commit, it invokes the callback function with the parsed Commit object, or an error if the commit did not obey the Conventional Commits standard. The callback function can abort the iteration by returning false.
func StripComments ¶ added in v0.2.0
StripComments removes all lines that start with "#" from the input, and returns the resulting string.
Types ¶
type Commit ¶
type Commit struct { Id string ShortId string Type string Scope string IsExclaimed bool Description string Body string IsBreaking bool }
Commit represents a single conventional commit.
func ParseMessage ¶ added in v0.2.0
ParseMessage parses a single commit message and returns a slice of the resulting Commit objects. (It may return an empty slice if the commit message was excluded.)
func ParseRange ¶
ParseRange parses all of the commit messages in the range and returns a slice of the resulting Commit objects. If an error occurs, the slice may contain a partial set of all the commits that were successfully processed so far.
func (*Commit) ApplyPolicy ¶
ApplyPolicy checks if the commit is semantically valid according to the supplied policy object.
type Footer ¶
type Footer struct { // "BREAKING CHANGE" token. Token string // footers, but saving it allows us to reconstruct the original commit // message from this object. Separator string // and newlines. Value string }
Footer is a "token: value" or "token #value" pair.
func (*Footer) IsBreakingChange ¶
IsBreakingChange checks whether this footer designates a breaking change. It returns an error if the breaking change footer is not formatted correctly according to the standard.
type ParseError ¶
type ParseError struct {
Errors []string
}
func NewParseError ¶
func NewParseError() *ParseError
func (*ParseError) Append ¶
func (e *ParseError) Append(err error)
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) HasErrors ¶
func (e *ParseError) HasErrors() bool