From: Michał Kępień Date: Mon, 18 Jan 2021 13:57:47 +0000 (+0100) Subject: Only warn about fixup commits once per run X-Git-Tag: v9.17.10~33^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=801d13f62fe60436db16f525231172145f8ccde5;p=thirdparty%2Fbind9.git Only warn about fixup commits once per run The Danger GitLab CI job currently generates a separate error message about fixup commits being present in a merge request for every such commit found. Prevent that by making it only log that error message once per run. --- diff --git a/dangerfile.py b/dangerfile.py index ad40478f773..68daa7876c3 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -61,12 +61,16 @@ target_branch = danger.gitlab.mr.target_branch # four spaces (useful for pasting compiler warnings, static analyzer # messages, log lines, etc.) +fixup_error_logged = False for commit in danger.git.commits: message_lines = commit.message.splitlines() subject = message_lines[0] - if subject.startswith('fixup!') or subject.startswith('Apply suggestion'): + if (not fixup_error_logged and + (subject.startswith('fixup!') or + subject.startswith('Apply suggestion'))): fail('Fixup commits are still present in this merge request. ' 'Please squash them before merging.') + fixup_error_logged = True if len(subject) > 72: warn( f'Subject line for commit {commit.sha} is too long: '