From 619039de36a78164c67a2c62a425a444340d4a06 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 4 Nov 2020 10:35:54 +0100 Subject: gcc-changelog/git_commit.py: Check for missing description Especially when using mklog.py, it is simply to forget to fill in the entries after the '\t* file.c (section):' or '\t(section):'. contrib/ChangeLog: * gcc-changelog/git_commit.py (item_parenthesis_empty_regex, item_parenthesis_regex): Add. (check_for_empty_description): Use them. * gcc-changelog/test_email.py (test_emptry_entry_desc, test_emptry_entry_desc_2): Add. * gcc-changelog/test_patches.txt: Add two testcases for it. --- contrib/gcc-changelog/git_commit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'contrib/gcc-changelog/git_commit.py') diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 1d0860c..0008865 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -155,6 +155,8 @@ pr_regex = re.compile(r'\tPR (?P[a-z+-]+\/)?([0-9]+)$') dr_regex = re.compile(r'\tDR ([0-9]+)$') star_prefix_regex = re.compile(r'\t\*(?P\ *)(?P.*)') end_of_location_regex = re.compile(r'[\[<(:]') +item_empty_regex = re.compile(r'\t(\* \S+ )?\(\S+\):\s*$') +item_parenthesis_regex = re.compile(r'\t(\*|\(\S+\):)') LINE_LIMIT = 100 TAB_WIDTH = 8 @@ -490,9 +492,10 @@ class GitCommit: def check_for_empty_description(self): for entry in self.changelog_entries: for i, line in enumerate(entry.lines): - if (star_prefix_regex.match(line) and line.endswith(':') and + if (item_empty_regex.match(line) and (i == len(entry.lines) - 1 - or star_prefix_regex.match(entry.lines[i + 1]))): + or not entry.lines[i+1].strip() + or item_parenthesis_regex.match(entry.lines[i+1]))): msg = 'missing description of a change' self.errors.append(Error(msg, line)) -- cgit v1.1