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, is_process_commit};

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());

// Process commit detection
assert!(is_process_commit("Merge pull request #42 from owner/branch"));
assert!(!is_process_commit("feat: add login"));

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.
is_process_commit
Returns true if the commit message looks like an automatically generated process commit — merge, revert, fixup, squash, or initial commit.
lint
Lint a commit message against the given configuration.
parse
Parse a commit message string into a ConventionalCommit.