Skip to content

Commit

Permalink
🐛 (tag): Start scopes with an uppercase
Browse files Browse the repository at this point in the history
semver: patch
  • Loading branch information
Somfic committed Jun 13, 2024
1 parent 3e274cf commit 993750a
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/helper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ pub fn calculate_new_tag_based_on_commits() -> anyhow::Result<Option<semver::Ver
.keys()
.filter(|s| !majors_delta.get(*s).unwrap().is_empty())
{
let scope = scope
.chars()
.enumerate()
.fold(String::new(), |mut acc, (i, c)| {
if i == 0 {
acc.push(c.to_uppercase().next().unwrap());
} else {
acc.push(c);
}
acc
});
changelog.push_str(&format!("\n### {}", scope));
for commit in majors_delta.get(scope).unwrap() {
for commit in majors_delta.get(&scope).unwrap() {
changelog.push_str(&format!(
"\n- {} {}",
commit.emoji.as_ref().unwrap_or(&"".to_string()),
Expand All @@ -46,8 +57,20 @@ pub fn calculate_new_tag_based_on_commits() -> anyhow::Result<Option<semver::Ver
.keys()
.filter(|s| !minors_delta.get(*s).unwrap().is_empty())
{
// Push scope, make it start with an uppercase letter
let scope = scope
.chars()
.enumerate()
.fold(String::new(), |mut acc, (i, c)| {
if i == 0 {
acc.push(c.to_uppercase().next().unwrap());
} else {
acc.push(c);
}
acc
});
changelog.push_str(&format!("\n### {}", scope));
for commit in minors_delta.get(scope).unwrap() {
for commit in minors_delta.get(&scope).unwrap() {
changelog.push_str(&format!(
"\n- {} {}",
commit.emoji.as_ref().unwrap_or(&"".to_string()),
Expand All @@ -64,8 +87,19 @@ pub fn calculate_new_tag_based_on_commits() -> anyhow::Result<Option<semver::Ver
.keys()
.filter(|s| !patches_delta.get(*s).unwrap().is_empty())
{
let scope = scope
.chars()
.enumerate()
.fold(String::new(), |mut acc, (i, c)| {
if i == 0 {
acc.push(c.to_uppercase().next().unwrap());
} else {
acc.push(c);
}
acc
});
changelog.push_str(&format!("\n### {}", scope));
for commit in patches_delta.get(scope).unwrap() {
for commit in patches_delta.get(&scope).unwrap() {
changelog.push_str(&format!(
"\n- {} {}",
commit.emoji.as_ref().unwrap_or(&"".to_string()),
Expand Down

0 comments on commit 993750a

Please sign in to comment.