From 50479dc5dccba6bae424313616784daa5a643623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaspar=20L=C3=B6chte?= Date: Mon, 1 Nov 2021 12:22:17 +0100 Subject: [PATCH] Fix: Using the regex like this [:-|] is incorrect, because of the special purpose of - in a set. Use [:|-] instead --- pontos/changelog/conventional_commits.py | 2 +- tests/changelog/test_conventional_commits.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pontos/changelog/conventional_commits.py b/pontos/changelog/conventional_commits.py index daf5c07ba..ba3756988 100644 --- a/pontos/changelog/conventional_commits.py +++ b/pontos/changelog/conventional_commits.py @@ -86,7 +86,7 @@ def sort_commits(self, commits: List[str]): commit = commit.split(' ', maxsplit=1) for commit_type in commit_types: reg = re.compile( - f'{commit_type["message"]} ?[:-|]', flags=re.I + fr'{commit_type["message"]}\s?[:|-]', flags=re.I ) match = reg.match(commit[1]) if match: diff --git a/tests/changelog/test_conventional_commits.py b/tests/changelog/test_conventional_commits.py index a2c845d14..6c36a9fc9 100644 --- a/tests/changelog/test_conventional_commits.py +++ b/tests/changelog/test_conventional_commits.py @@ -48,6 +48,8 @@ def test_changelog_builder(self): git_log = ( '1234567 Add: foo bar\n' '8abcdef Add: bar baz\n' + '8abcd3f Add bar baz\n' + '8abcd3d Adding bar baz\n' '1337abc Change: bar to baz\n' '42a42a4 Remove: foo bar again\n' 'fedcba8 Test: bar baz testing\n'