Expand description
Conventional commit parsing, validation, and formatting.
Implements the Conventional Commits specification as a pure library — no I/O, no git operations, no terminal output.
§Main entry points
parse— parse a commit message into aConventionalCommitlint— validate a message against aLintConfig- [
format] — render aConventionalCommitback to a well-formed string
§Example
use standard_commit::{parse, format, lint, LintConfig};
let commit = parse("feat(auth): add OAuth2 PKCE flow").unwrap();
assert_eq!(commit.r#type, "feat");
assert_eq!(commit.scope.as_deref(), Some("auth"));
// Round-trip: format back to string
assert_eq!(format(&commit), "feat(auth): add OAuth2 PKCE flow");
// Lint with default rules
let errors = lint("feat: add login", &LintConfig::default());
assert!(errors.is_empty());Structs§
- Conventional
Commit - A parsed conventional commit message.
- Footer
- A commit message footer (trailer).
- Lint
Config - Configuration for linting conventional commit messages.
- Lint
Error - A lint error found in a commit message.
Enums§
- Parse
Error - Errors that can occur when parsing a conventional commit message.
Functions§
- format
- Format a
ConventionalCommitback into a well-formed conventional commit message string. - lint
- Lint a commit message against the given configuration.
- parse
- Parse a commit message string into a
ConventionalCommit.