Skip to main content

Crate standard_commit

Crate standard_commit 

Source
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

§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§

ConventionalCommit
A parsed conventional commit message.
Footer
A commit message footer (trailer).
LintConfig
Configuration for linting conventional commit messages.
LintError
A lint error found in a commit message.

Enums§

ParseError
Errors that can occur when parsing a conventional commit message.

Functions§

format
Format a ConventionalCommit back 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.