Skip to main content

determine_bump

Function determine_bump 

Source
pub fn determine_bump(commits: &[ConventionalCommit]) -> BumpType
Expand description

Determines the SemVer BumpType from a list of conventional commits.

Hierarchy:

  1. If any commit is breaking -> BumpType::Major
  2. Else if any commit has type “feat” -> BumpType::Minor
  3. Otherwise -> BumpType::Patch

§Arguments

  • commits - Slice of parsed conventional commits.

§Example

use git_claw::core::conventional::{determine_bump, ConventionalCommit};
use git_claw::core::semver::BumpType;

let commits = vec![
    ConventionalCommit {
        commit_type: "fix".to_string(),
        scope: None,
        is_breaking: false,
        description: "fix bug".to_string(),
    },
];
assert_eq!(determine_bump(&commits), BumpType::Patch);