From: Andoni Duarte Pintado Date: Wed, 2 Apr 2025 12:14:36 +0000 (+0200) Subject: Update issue closing regex in dangerfile.py X-Git-Tag: v9.18.36~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9687ef68712eca045ae202aa19b1fd2031367997;p=thirdparty%2Fbind9.git Update issue closing regex in dangerfile.py Update the regular expression used for extracting references to GitLab issues closed by a given merge request so that it is identical to the one used by GitLab [1]. See also isc-projects/bind9-qa!41 [1] https://docs.gitlab.com/user/project/issues/managing_issues/#default-closing-pattern (cherry picked from commit 5298d0fcb8012ec805d632bef34302a168cc3c87) --- diff --git a/dangerfile.py b/dangerfile.py index 79aa9c04aaf..b6851be7a57 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -44,7 +44,12 @@ def lines_containing(lines, string): changes_issue_or_mr_id_regex = re.compile(rb"\[(GL [#!]|RT #)[0-9]+\]") rdata_regex = re.compile(r"lib/dns/rdata/") -mr_issue_link_regex = re.compile(r"^(Closes|Fixes):?\s*[^\n]*#[0-9]+", re.MULTILINE) + +# Source: https://docs.gitlab.com/user/project/issues/managing_issues/#default-closing-pattern +ISSUE_CLOSING_REGEX = r"\b((?:[Cc]los(?:e[sd]?|ing)|\b[Ff]ix(?:e[sd]|ing)?|\b[Rr]esolv(?:e[sd]?|ing)|\b[Ii]mplement(?:s|ed|ing)?)(:?) +(?:(?:issues? +)?%{issue_ref}(?:(?: *,? +and +| *,? *)?)|([A-Z][A-Z0-9_]+-\d+))+)" +ISSUE_REF = r"(?P(isc-projects/bind9)?#|https://gitlab\.isc\.org/isc-projects/bind9/-/issues/)(?P[0-9]+)" +full_regex = ISSUE_CLOSING_REGEX.replace("%{issue_ref}", ISSUE_REF) +mr_issue_link_regex = re.compile(full_regex, re.IGNORECASE | re.MULTILINE) modified_files = danger.git.modified_files affected_files = (