https://github.com/purplebooth/mit-lint
Lint commit messages
https://github.com/purplebooth/mit-lint
git hacktoberfest lints
Last synced: 6 months ago
JSON representation
Lint commit messages
- Host: GitHub
- URL: https://github.com/purplebooth/mit-lint
- Owner: PurpleBooth
- License: cc0-1.0
- Created: 2021-09-19T15:52:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-08T07:37:50.000Z (about 1 year ago)
- Last Synced: 2024-04-23T22:37:55.527Z (about 1 year ago)
- Topics: git, hacktoberfest, lints
- Language: Rust
- Homepage:
- Size: 215 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mit-lint
Lint commit messages
## Example
``` rust
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](https://docs.rs/mit-lint/)