Skip to main content

Crate conventional_commits

Crate conventional_commits 

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

CleanResult
Result of applying clean rules to a commit message body.
ConventionalCommit
Represents a parsed conventional commit
ValidationConfig
Configuration for commit validation
ValidationErrors
A list of commit validation errors, used when multiple issues are detected simultaneously.

Enums§

CommitType
Represents the type of a conventional commit
CommitValidationError
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