Skip to main content

classify_commit

Function classify_commit 

Source
pub fn classify_commit(msg: &str) -> Option<ConventionalLevel>
Expand description

Classify one commit message (subject + body) against the Conventional-Commits release rules.

Returns None for non-release-worthy commits: chore: / docs: / style: / refactor: / test: / build: / ci: typed subjects and unstructured messages.

Rules:

  • BREAKING CHANGE / BREAKING-CHANGE anywhere in the message → major. Matched as a bare substring (no trailing colon required) so a footer like BREAKING CHANGE removed the old endpoint still majors.
  • <type>!: / <type>(scope)!: breaking shorthand → major, for ANY type (refactor!: is still a breaking change).
  • feat: / feat(scope): → minor.
  • fix: / perf: / revert: (and scoped variants) → patch.