From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.27470.1607905942449770899 for ; Sun, 13 Dec 2020 16:32:22 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: fengyunhua@byosoft.com.cn) Received: from localhost.localdomain ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Mon, 14 Dec 2020 08:32:20 +0800 X-WM-Sender: fengyunhua@byosoft.com.cn From: "fengyunhua" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen Subject: [PATCH] BaseTools/Scripts: Check for added newline at end of file Date: Mon, 14 Dec 2020 08:32:00 +0800 Message-Id: <20201214003200.1252-1-fengyunhua@byosoft.com.cn> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2685 Adding blank lines at end of file is bad enough practice that git complains about it when importing patches (with git am): .git/rebase-apply/patch:105: new blank line at EOF. + warning: 1 line adds whitespace errors. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Yunhua Feng --- BaseTools/Scripts/PatchCheck.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 68c984ed0e..1859cdc580 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -316,6 +316,8 @@ class GitDiffCheck: self.new_bin = [] while self.line_num < self.count and self.format_ok: line_num = self.line_num + if line_num == self.count - 1 and self.lines[line_num].strip() == '+': + self.format_error('New blank line at EOF.') self.run() assert(self.line_num > line_num) self.report_message_result() -- 2.27.0.windows.1