mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Skip length check for lines containing references
The Danger GitLab CI job currently flags excessively long lines in commit log messages. Exclude lines containing references (i.e. starting with "[1]", "[2]", etc.) from this check. This allows e.g. long URLs to be included in commit log messages without triggering Danger warnings.
This commit is contained in:
parent
801d13f62f
commit
09964e8085
@ -51,15 +51,21 @@ target_branch = danger.gitlab.mr.target_branch
|
|||||||
#
|
#
|
||||||
# * The length of the subject line exceeds 72 characters.
|
# * The length of the subject line exceeds 72 characters.
|
||||||
#
|
#
|
||||||
# * There is no log message present (i.e. commit only has a subject) and the
|
# * There is no log message present (i.e. commit only has a subject) and
|
||||||
# subject line does not contain any of the following strings: "fixup! ",
|
# the subject line does not contain any of the following strings:
|
||||||
# " CHANGES ", " release note".
|
# "fixup!", " CHANGES ", " release note".
|
||||||
#
|
#
|
||||||
# * Any line of the log message is longer than 72 characters. This rule is
|
# * 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
|
# not evaluated for:
|
||||||
# lines to be included in the commit log message by prefixing them with
|
#
|
||||||
# four spaces (useful for pasting compiler warnings, static analyzer
|
# - lines starting with four spaces, which allows long lines to be
|
||||||
# messages, log lines, etc.)
|
# included in the commit log message by prefixing them with four
|
||||||
|
# spaces (useful for pasting compiler warnings, static analyzer
|
||||||
|
# messages, log lines, etc.),
|
||||||
|
#
|
||||||
|
# - lines which contain references (i.e. those starting with "[1]",
|
||||||
|
# "[2]", etc.) which allows e.g. long URLs to be included in the
|
||||||
|
# commit log message.
|
||||||
|
|
||||||
fixup_error_logged = False
|
fixup_error_logged = False
|
||||||
for commit in danger.git.commits:
|
for commit in danger.git.commits:
|
||||||
@ -86,7 +92,9 @@ for commit in danger.git.commits:
|
|||||||
' release note' not in subject):
|
' release note' not in subject):
|
||||||
warn(f'Please write a log message for commit {commit.sha}.')
|
warn(f'Please write a log message for commit {commit.sha}.')
|
||||||
for line in message_lines[2:]:
|
for line in message_lines[2:]:
|
||||||
if len(line) > 72 and not line.startswith(' '):
|
if (len(line) > 72 and
|
||||||
|
not line.startswith(' ') and
|
||||||
|
not re.match(r'\[[0-9]+\]', line)):
|
||||||
warn(
|
warn(
|
||||||
f'Line too long in log message for commit {commit.sha}: '
|
f'Line too long in log message for commit {commit.sha}: '
|
||||||
f'```{line}``` ({len(line)} > 72 characters).'
|
f'```{line}``` ({len(line)} > 72 characters).'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user