From 431da739a0a45882f2b4e703ba2bca5583914646 Mon Sep 17 00:00:00 2001 From: Gary Beihl Date: Wed, 28 May 2025 12:25:37 -0400 Subject: [PATCH] BaseTools: Add line number to PatchCheck error messages PatchCheck error messages can be improved by adding the line number. The line itself may consist of only whitespace for some errors. Adding the line number can help better locate the error source. Signed-off-by: Gary Beihl --- BaseTools/Scripts/PatchCheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 83d6795188..d178a6081b 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -485,7 +485,7 @@ class GitDiffCheck: lines = [ msg ] if self.filename is not None: lines.append('File: ' + self.filename) - lines.append('Line: ' + line) + lines.append('Line ' + str(self.line_num) + ': ' + line) self.error(*lines) @@ -539,7 +539,7 @@ class GitDiffCheck: def format_error(self, err): self.format_ok = False err = 'Patch format error: ' + err - err2 = 'Line: ' + self.lines[self.line_num].rstrip() + err2 = 'Line ' + str(self.line_num) + ': ' + self.lines[self.line_num].rstrip() self.error(err, err2) def error(self, *err):