diff options
author | Leif Lindholm <leif.lindholm@oss.qualcomm.com> | 2025-06-30 16:43:11 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-07-02 20:14:21 +0000 |
commit | 2bcad870049ae495eb8884b6ece893548fee770c (patch) | |
tree | 16edd5c963740648e67194bc347d2d8a79b78659 | |
parent | 27d44c1abd676a8db2cb92f231e2bc4cc89370da (diff) | |
download | edk2-2bcad870049ae495eb8884b6ece893548fee770c.zip edk2-2bcad870049ae495eb8884b6ece893548fee770c.tar.gz edk2-2bcad870049ae495eb8884b6ece893548fee770c.tar.bz2 |
BaseTools/PatchCheck.py: clean up subject line length handling
Use a temporary variable for max subject line length and log
result of test in one location.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
-rwxr-xr-x | BaseTools/Scripts/PatchCheck.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 2b76707..03a775a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -268,21 +268,19 @@ class CommitMessageCheck: # If CVE-xxxx-xxxxx is present in subject line, then limit length of
# subject line to 92 characters
#
- if len(lines[0].rstrip()) >= 93:
- self.error(
- 'First line of commit message (subject line) is too long (%d >= 93).' %
- (len(lines[0].rstrip()))
- )
+ maxlength = 92
else:
#
# If CVE-xxxx-xxxxx is not present in subject line, then limit
# length of subject line to 75 characters
#
- if len(lines[0].rstrip()) >= 76:
- self.error(
- 'First line of commit message (subject line) is too long (%d >= 76).' %
- (len(lines[0].rstrip()))
- )
+ maxlength = 75
+
+ if len(lines[0].rstrip()) > maxlength:
+ self.error(
+ 'First line of commit message (subject line) is too long (%d > %d).' %
+ (len(lines[0].rstrip()), maxlength)
+ )
if count >= 1 and len(lines[0].strip()) == 0:
self.error('First line of commit message (subject line) ' +
|