30 stable releases (3 major)

3.2.9 Aug 26, 2024
3.2.8 Jul 26, 2024
3.2.7 Sep 27, 2023
3.2.3 Jan 30, 2023
0.2.0 Sep 25, 2021

#1593 in Development tools

Download history 545/week @ 2024-07-22 694/week @ 2024-07-29 452/week @ 2024-08-05 514/week @ 2024-08-12 493/week @ 2024-08-19 519/week @ 2024-08-26 47/week @ 2024-09-02 54/week @ 2024-09-09 70/week @ 2024-09-16 67/week @ 2024-09-23 59/week @ 2024-09-30 16/week @ 2024-10-07 59/week @ 2024-10-14 293/week @ 2024-10-21 516/week @ 2024-10-28 258/week @ 2024-11-04

1,127 downloads per month
Used in 8 crates (3 directly)

CC0 license

205KB
5.5K SLoC

mit-lint

Lint commit messages

Example

use mit_commit::CommitMessage;
use mit_lint::{Code, lint, Problem, Lints, Lint};

let message:String = "x".repeat(73).into();
let expected = vec![Problem::new(
    "Your subject is longer than 72 characters".into(),
    "It's important to keep the subject of the commit less than 72 characters because when you look at the git log, that's where it truncates the message. This means that people won't get the entirety of the information in your commit.\n\nPlease keep the subject line 72 characters or under"
        .into(),
    Code::SubjectLongerThan72Characters,&message.clone().into(),Some(vec![(String::from("Too long"), 72, 1)]),
    Some("https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines".parse().unwrap()),
)];
let actual = lint(&CommitMessage::from(message), Lints::new(vec![Lint::SubjectLongerThan72Characters].into_iter().collect()));
assert_eq!(
    actual, expected,
    "Expected {:?}, found {:?}",
    expected, actual
);

Docs

Read more at Docs.rs

Dependencies

~8–16MB
~215K SLoC