2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Flag trailing dots in commit subject lines

Make the Danger GitLab CI job fail when the subject line for any commit
belonging to a merge request contains a trailing dot.
This commit is contained in:
Michał Kępień
2021-01-18 14:57:47 +01:00
parent ff58ec8cef
commit 953c810f41

View File

@@ -43,6 +43,8 @@ target_branch = danger.gitlab.mr.target_branch
# #
# * The subject line starts with "fixup!" or "Apply suggestion". # * The subject line starts with "fixup!" or "Apply suggestion".
# #
# * The subject line contains a trailing dot.
#
# * There is no empty line between the subject line and the log message. # * There is no empty line between the subject line and the log message.
# #
# - WARN if any of the following is true for any commit on the MR branch: # - WARN if any of the following is true for any commit on the MR branch:
@@ -70,6 +72,8 @@ for commit in danger.git.commits:
f'Subject line for commit {commit.sha} is too long: ' f'Subject line for commit {commit.sha} is too long: '
f'```{subject}``` ({len(subject)} > 72 characters).' f'```{subject}``` ({len(subject)} > 72 characters).'
) )
if subject[-1] == '.':
fail(f'Trailing dot found in the subject of commit {commit.sha}.')
if len(message_lines) > 1 and message_lines[1]: if len(message_lines) > 1 and message_lines[1]:
fail(f'No empty line after subject for commit {commit.sha}.') fail(f'No empty line after subject for commit {commit.sha}.')
if (len(message_lines) < 3 and if (len(message_lines) < 3 and