public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "fengyunhua" <fengyunhua@byosoft.com.cn>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>
Subject: [PATCH] BaseTools/Scripts: Check for added newline at end of file
Date: Mon, 14 Dec 2020 08:32:00 +0800	[thread overview]
Message-ID: <20201214003200.1252-1-fengyunhua@byosoft.com.cn> (raw)

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 <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn>
---
 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



             reply	other threads:[~2020-12-14  0:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  0:32 fengyunhua [this message]
2020-12-15  4:31 ` [PATCH] BaseTools/Scripts: Check for added newline at end of file Bob Feng
2020-12-15  7:08   ` 回复: " fengyunhua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201214003200.1252-1-fengyunhua@byosoft.com.cn \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox