#git #commit #lints

mit-lint

Lints for commits parsed with mit-commit

24 releases (stable)

3.0.7 Mar 5, 2022
3.0.6 Feb 22, 2022
3.0.3 Nov 17, 2021
2.2.4 Oct 16, 2021
0.1.6 Sep 21, 2021

#935 in Development tools

Download history 2883/week @ 2022-01-24 65/week @ 2022-01-31 113/week @ 2022-02-07 289/week @ 2022-02-14 326/week @ 2022-02-21 429/week @ 2022-02-28 217/week @ 2022-03-07 120/week @ 2022-03-14 280/week @ 2022-03-21 120/week @ 2022-03-28 206/week @ 2022-04-04 128/week @ 2022-04-11 200/week @ 2022-04-18 310/week @ 2022-04-25 553/week @ 2022-05-02 593/week @ 2022-05-09

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

CC0 license

200KB
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"), 73, 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.5MB
~186K SLoC