Expand description
§Conventional Commits Validator
A lightweight library for validating Git commit messages according to the Conventional Commits specification.
§Usage
use conventional_commits::{validate_commit, CommitType};
let message = "feat: add new user authentication";
match validate_commit(message) {
Ok(commit) => {
println!("Valid commit: {:?}", commit.commit_type);
}
Err(e) => {
eprintln!("Invalid commit: {}", e);
}
}Structs§
- Clean
Result - Result of applying clean rules to a commit message body.
- Conventional
Commit - Represents a parsed conventional commit
- Validation
Config - Configuration for commit validation
- Validation
Errors - A list of commit validation errors, used when multiple issues are detected simultaneously.
Enums§
- Commit
Type - Represents the type of a conventional commit
- Commit
Validation Error - Errors that can occur when validating commit messages
Functions§
- clean_
commit_ body - Cleans a commit message body by removing lines that match any of the provided rules.
- fix_
commit_ message - Attempts to fix common mistakes in a commit message header.
- validate_
commit - Validates a commit message according to Conventional Commits specification
- validate_
commit_ with_ config - Validates a commit message with custom configuration