From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io
Cc: Philippe Mathieu-Daude <philmd@redhat.com>,
Bob Feng <bob.c.feng@intel.com>,
Liming Gao <liming.gao@intel.com>
Subject: [PATCH 5/6] BaseTools/PatchCheck: Add printw() function to print warnings
Date: Thu, 5 Dec 2019 17:12:33 +0100 [thread overview]
Message-ID: <20191205161234.25071-6-philmd@redhat.com> (raw)
In-Reply-To: <20191205161234.25071-1-philmd@redhat.com>
Introduce printw() to print warnings.
For now there are no logical change, we only call print().
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
BaseTools/Scripts/PatchCheck.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index fc1b077f3c64..5692f6eaf8bd 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -28,6 +28,10 @@ def run_git(*args):
Result = p.communicate()
return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find(b"fatal") !=0 else None
+def printw(line):
+ """Print a warning to the console."""
+ print(line)
+
class Verbose:
SILENT, QUIET, ONELINE, NORMAL = range(4)
level = NORMAL
@@ -67,14 +71,14 @@ class CommitMessageCheck:
def error(self, *err):
if self.ok and Verbose.level >= Verbose.QUIET:
- print('The commit message format is not valid:')
+ printw('The commit message format is not valid:')
self.ok = False
if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]:
return
count = 0
for line in err:
prefix = (' *', ' ')[count > 0]
- print(prefix, line)
+ printw("{}{}".format(prefix, line))
count += 1
# Find 'contributed-under:' at the start of a line ignoring case and
@@ -415,14 +419,14 @@ class GitDiffCheck:
def error(self, *err):
if self.ok and Verbose.level >= Verbose.QUIET:
- print('Code format is not valid:')
+ printw('Code format is not valid:')
self.ok = False
if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]:
return
count = 0
for line in err:
prefix = (' *', ' ')[count > 0]
- print(prefix, line)
+ printw("{}{}".format(prefix, line))
count += 1
class CheckOnePatch:
--
2.21.0
next prev parent reply other threads:[~2019-12-05 16:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-05 16:12 [PATCH 0/6] BaseTools: Improve PatchCheck and add GitPostCommitHook Philippe Mathieu-Daudé
2019-12-05 16:12 ` [PATCH 1/6] BaseTools/PatchCheck: Stop parsing commit message after --- separator Philippe Mathieu-Daudé
2019-12-05 19:02 ` Laszlo Ersek
2019-12-05 16:12 ` [PATCH 2/6] BaseTools/PatchCheck: Add a --quiet option Philippe Mathieu-Daudé
2019-12-05 16:12 ` [PATCH 3/6] BaseTools/Scripts: Add GitPostCommitHook.py Philippe Mathieu-Daudé
2019-12-05 19:24 ` Laszlo Ersek
2019-12-05 16:12 ` [PATCH 4/6] BaseTools/PatchCheck: Extract the run_git() function Philippe Mathieu-Daudé
2019-12-05 16:12 ` Philippe Mathieu-Daudé [this message]
2019-12-05 16:12 ` [PATCH 6/6] BaseTools/PatchCheck: Allow to print colored warnings Philippe Mathieu-Daudé
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=20191205161234.25071-6-philmd@redhat.com \
--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