diff options
author | Lydia Stepanek <lydia.stepanek@mongodb.com> | 2020-06-25 14:19:50 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-29 18:31:40 +0000 |
commit | 021430190cbe937fa76c81e53d2d8868fef63817 (patch) | |
tree | bc78eeeae07498e8fa96553bc33e909725e0a53f /buildscripts/validate_commit_message.py | |
parent | 5394c832f05414fabd069c54066746e127f5d2e0 (diff) | |
download | mongo-021430190cbe937fa76c81e53d2d8868fef63817.tar.gz |
SERVER-48714 Send commit queue validation messages to stderr
Diffstat (limited to 'buildscripts/validate_commit_message.py')
-rwxr-xr-x | buildscripts/validate_commit_message.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/buildscripts/validate_commit_message.py b/buildscripts/validate_commit_message.py index e9e186dd25c..51ac1e26b15 100755 --- a/buildscripts/validate_commit_message.py +++ b/buildscripts/validate_commit_message.py @@ -32,6 +32,9 @@ import os import re import subprocess import sys +import logging + +LOGGER = logging.getLogger(__name__) COMMON_PUBLIC_PATTERN = r''' ((?P<revert>Revert)\s+[\"\']?)? # Revert (optional) @@ -118,13 +121,6 @@ def main(argv=None): usage="Validate the commit message. " "It validates the latest message when no arguments are provided.") parser.add_argument( - "-i", - action="store_true", - dest="ignore_warnings", - help="Ignore all warnings.", - default=False, - ) - parser.add_argument( "message", metavar="commit message", nargs="*", @@ -140,15 +136,14 @@ def main(argv=None): message = " ".join(args.message) if any(valid_pattern.match(message) for valid_pattern in VALID_PATTERNS): - status = STATUS_OK - elif any(private_pattern.match(message) for private_pattern in PRIVATE_PATTERNS): - print("ERROR: found a reference to a private project\n{message}".format(message=message)) - status = STATUS_ERROR + return STATUS_OK else: - print("{message_type}: found a commit without a ticket\n{message}".format( - message_type="WARNING" if args.ignore_warnings else "ERROR", message=message)) - status = STATUS_OK if args.ignore_warnings else STATUS_ERROR - return status + if any(private_pattern.match(message) for private_pattern in PRIVATE_PATTERNS): + error_type = "Found a reference to a private project" + else: + error_type = "Found a commit without a ticket" + LOGGER.error(f"{error_type}\n{message}") # pylint: disable=logging-fstring-interpolation + return STATUS_ERROR if __name__ == "__main__": |