SERVER-92729 Ignore whitespace for commit message validation comparisons (#25191)
GitOrigin-RevId: 4b0e45da036e265971b82500736cdb0db4d8234a
This commit is contained in:
committed by
MongoDB Bot
parent
aa11c7f714
commit
bfa96e8503
@@ -70,10 +70,13 @@ def is_valid_commit(commit: Commit) -> bool:
|
||||
)
|
||||
return False
|
||||
|
||||
# Remove all whitespace from comparisons. GitHub line-wraps commit messages, which adds
|
||||
# newline characters that otherwise would not match verbatim such banned strings.
|
||||
stripped_message = "".join(commit.message.split())
|
||||
for banned_string in BANNED_STRINGS:
|
||||
if banned_string in commit.message:
|
||||
if "".join(banned_string.split()) in stripped_message:
|
||||
LOGGER.error(
|
||||
"Commit contains banned string",
|
||||
"Commit contains banned string (ignoring whitespace)",
|
||||
banned_string=banned_string,
|
||||
commit_hexsha=commit.hexsha,
|
||||
commit_message=commit.message,
|
||||
|
||||
Reference in New Issue
Block a user