public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jordan Justen <jordan.l.justen@intel.com>
To: Yonghong Zhu <yonghong.zhu@intel.com>,  edk2-devel@lists.01.org
Cc: "Liming Gao" <liming.gao@intel.com>
Subject: Re: [Patch 3/3 V2] BaseTools/PatchCheck.py: Update to report error for EFI_D_*
Date: Tue, 18 Oct 2016 11:31:33 -0700	[thread overview]
Message-ID: <147681549396.11463.15081649592826518087@jljusten-ivb> (raw)
In-Reply-To: <1476785813-13728-1-git-send-email-yonghong.zhu@intel.com>

On 2016-10-18 03:16:53, Yonghong Zhu wrote:
> In EDK2, DEBUG_* is recommended to be used instead of EFI_D_*. For new
> code, they should use DEBUG_* macro.
> 
> Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=143
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Scripts/PatchCheck.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
> index 05f8f6e..083438c 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -338,10 +338,16 @@ class GitDiffCheck:
>              lines.append('File: ' + self.hunk_filename)
>          lines.append('Line: ' + line)
>  
>          self.error(*lines)
>  
> +    old_debug_re = \
> +        re.compile(r'''
> +                       DEBUG \s* \( \s* \( .* EFI_D_ ([A-Z_]+)
                                              ^^

I recommend changing .* in the regex to \s*. EFI_D_* is the first
parameter. The only thing that might appear is a comment, but that
could also appear between the parentheses. This would be an unusual
place to put a comment.

Aside from that,

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

> +                   ''',
> +                   re.VERBOSE)
> +
>      def check_added_line(self, line):
>          eol = ''
>          for an_eol in self.line_endings:
>              if line.endswith(an_eol):
>                  eol = an_eol
> @@ -355,10 +361,16 @@ class GitDiffCheck:
>          if '    ' in line:
>              self.added_line_error('Tab character used', line)
>          if len(stripped) < len(line):
>              self.added_line_error('Trailing whitespace found', line)
>  
> +        mo = self.old_debug_re.search(line)
> +        if mo is not None:
> +            self.added_line_error('EFI_D_' + mo.group(1) + ' was used, '
> +                                  'but DEBUG_' + mo.group(1) +
> +                                  ' is now recommended', line)
> +
>      split_diff_re = re.compile(r'''
>                                     (?P<cmd>
>                                         ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
>                                     )
>                                     (?P<index>
> -- 
> 2.6.1.windows.1
> 


  reply	other threads:[~2016-10-18 18:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 10:16 [Patch 3/3 V2] BaseTools/PatchCheck.py: Update to report error for EFI_D_* Yonghong Zhu
2016-10-18 18:31 ` Jordan Justen [this message]
2016-10-19  4:40   ` Zhu, Yonghong
2016-10-19  5:29     ` Jordan Justen

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=147681549396.11463.15081649592826518087@jljusten-ivb \
    --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