Skip to content

A crate to parse and validate commit message against the conventional commits specification

License

Notifications You must be signed in to change notification settings

cocogitto/conventional_commits_parser_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conventional commit parser

Latest Version Conventional Commits License

A rust implementation of the conventional commit specification.

Example

use conventional_commit_parser::parse;
use conventional_commit_parser::commit::*;
let message = r#"fix: correct minor typos in code

see the issue for details

on typos fixed.

Reviewed-by: Z
Refs #133"#;

let conventional_commit = parse(message)?;

assert_eq!(conventional_commit.commit_type, CommitType::BugFix);
assert_eq!(conventional_commit.summary, "correct minor typos in code".to_string());
assert_eq!(conventional_commit.body, Some(r#"see the issue for details

on typos fixed."#.to_string()));

assert_eq!(conventional_commit.footers, vec![
    Footer {token: "Reviewed-by".to_string(), content: "Z".to_string()},
    Footer {token: "Refs".to_string(), content: "133".to_string(),}
]);

Licence

All the code in this repository is released under the MIT License, for more information take a look at the LICENSE file.

About

A crate to parse and validate commit message against the conventional commits specification

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages