From e4d99f21624b8c3e5db169ee1663709594c94b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 3 Jun 2020 15:45:28 +0200 Subject: [PATCH] Tweak condition for missing log message warning Commits adding CHANGES entries and/or release notes do not need a commit log message. Do not warn about a missing commit log message for such commits to make the warning more meaningful. (cherry picked from commit c13944ca465eaf209f9804e20285477d9deabd5a) --- dangerfile.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dangerfile.py b/dangerfile.py index b017c6aee9..9bbcc005b8 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -46,7 +46,9 @@ target_branch = danger.gitlab.mr.target_branch # # * The length of the subject line exceeds 72 characters. # -# * There is no log message present (i.e. commit only has a subject). +# * There is no log message present (i.e. commit only has a subject) and the +# subject line does not contain any of the following strings: "fixup! ", +# " CHANGES ", " release note". # # * Any line of the log message is longer than 72 characters. This rule is # not evaluated for lines starting with four spaces, which allows long @@ -67,7 +69,10 @@ for commit in danger.git.commits: ) if len(message_lines) > 1 and message_lines[1]: fail(f'No empty line after subject for commit {commit.sha}.') - if len(message_lines) < 3 and not subject.startswith('fixup! '): + if (len(message_lines) < 3 and + 'fixup! ' not in subject and + ' CHANGES ' not in subject and + ' release note' not in subject): warn(f'Please write a log message for commit {commit.sha}.') for line in message_lines[2:]: if len(line) > 72 and not line.startswith(' '):