Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidFormat = errors.New("invalid commit message format") ErrMissingType = errors.New("missing commit type") ErrInvalidType = errors.New("invalid commit type") ErrTooLong = errors.New("commit message too long") )
Define static errors for commit message validation.
View Source
var CommitRules = map[string]CommitRule{ "feat": { Type: "feat", Description: "A new feature", Examples: []string{"feat(core): add user authentication service", "feat(ui): implement dark mode toggle"}, }, "fix": { Type: "fix", Description: "A bug fix", Examples: []string{"fix(api): resolve null pointer in validation", "fix(ui): correct button alignment"}, }, "docs": { Type: "docs", Description: "Documentation only changes", Examples: []string{"docs(readme): update installation instructions", "docs(api): add endpoint documentation"}, }, "style": { Type: "style", Description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", Examples: []string{"style(utils): format code with prettier", "style(ui): fix indentation"}, }, "refactor": { Type: "refactor", Description: "A code change that neither fixes a bug nor adds a feature", Examples: []string{"refactor(utils): extract validation logic", "refactor(api): simplify request handling"}, }, "test": { Type: "test", Description: "Adding missing tests or correcting existing tests", Examples: []string{"test(core): add unit tests for user service", "test(api): fix integration tests"}, }, "chore": { Type: "chore", Description: "Other changes that don't modify src or test files", Examples: []string{"chore(deps): update dependencies", "chore(build): update build configuration"}, }, }
CommitRules holds all available commit types and their rules.
Functions ¶
func CleanCommitMessage ¶
CleanCommitMessage cleans and formats the generated commit message.
func GetCommitTypes ¶
func GetCommitTypes() []string
GetCommitTypes returns all available commit types.
func ValidateCommitMessage ¶
ValidateCommitMessage validates if a commit message follows the conventional format.
Types ¶
type CommitRule ¶
CommitRule defines the structure for commit message rules.
Click to show internal directories.
Click to hide internal directories.