gitru 0.2.11

a lightweight, configurable Git commit message validation tool
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum FooterError {
    /// Footer configuration is required but missing
    #[error("footer configuration is required but missing")]
    MissingFooterConfig,

    /// Footer is required but missing
    #[error("footer is required but missing")]
    MissingFooter,

    /// Insufficient blank lines before footer
    #[error(
        "insufficient blank lines before footer, expected {min_line}, but found {current_line}"
    )]
    BlankLinesBeforeFooterNotEnough {
        min_line: usize,
        current_line: usize,
    },

    /// Invalid footer start keyword
    #[error("invalid footer start keyword, expected one of {allowed:?}, but found {actual}")]
    FooterStartKeywordInvalid {
        allowed: Vec<String>,
        actual: String,
    },

    /// Invalid footer line length
    #[error(
        "invalid length for footer line {line_number}, expected {min} ≤ length ≤ {max}, but found {actual}"
    )]
    FooterLineLengthInvalid {
        line_number: usize,
        min: usize,
        max: usize,
        actual: usize,
    },

    /// Trailing whitespace in footer line
    #[error("footer line {line_number} contains trailing whitespace")]
    FooterTrailingWhitespace { line_number: usize },

    /// Footer keyword appears misspelled
    #[error(
        "footer keyword appears misspelled:\n  \"{wrong}\"\"{correct}\"\n  similarity = {similarity:.2} (threshold = {threshold:.2})"
    )]
    FooterKeywordTypoError {
        wrong: String,
        correct: String,
        similarity: f64,
        threshold: f64,
    },
}