From b2e7285431fd668e5c6ea529b6ac941241672b97 Mon Sep 17 00:00:00 2001 From: Daniel Fütterer <df89@me.com> Date: Fri, 28 May 2021 11:13:02 +0200 Subject: [PATCH] feat: new sorting of types and no-scope commits --- oop_changelog_scope.py | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/oop_changelog_scope.py b/oop_changelog_scope.py index bd28462..69677c3 100644 --- a/oop_changelog_scope.py +++ b/oop_changelog_scope.py @@ -167,7 +167,7 @@ # Grouping by Type - commitsByType = {"Other":[], "Features":[], "Fixes":[]} + commitsByType = {"Other":[], "Fixes":[], "Features":[]} nonconformCommits = [] for commit in tag[1:]: if commit.body.commitType == CommitBody.commitTypes[5]: # fix @@ -183,15 +183,13 @@ while len(commitsByType) > 0: commitsByScope = {} commitType, commits = commitsByType.popitem() + noScope = [] if len(commits) == 0: continue for commit in commits: if commit.body.scope == None: - if "no scope" not in commitsByScope: - commitsByScope["no scope"] = [commit] - else: - commitsByScope["no scope"].append(commit) + noScope.append(commit) elif commit.body.scope in commitsByScope: commitsByScope[commit.body.scope].append(commit) else: @@ -206,6 +204,10 @@ fileTemplate.append(" - (" + commit.body.commitType + ") " + commit.body.subject + commit.appendShortHash()) else: fileTemplate.append(" - " + commit.body.subject + commit.appendShortHash()) + if len(noScope) > 0: + fileTemplate.append("- *no scope*") + for commit in noScope: + fileTemplate.append(" - " + commit.body.subject + commit.appendShortHash()) # nonconform commits if len(nonconformCommits) > 0: -- Gitblit v1.9.1