All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] patman: Fix up checkpatch parsing to deal with 'CHECK' lines
Date: Thu, 21 Mar 2013 09:35:40 -0700	[thread overview]
Message-ID: <CAD=FV=Uqumqyo=8XH8yrfGEnWh8wNpQxgikhiX4yz2yVX-1JPA@mail.gmail.com> (raw)
In-Reply-To: <1363833781-14557-2-git-send-email-sjg@chromium.org>

Simon,

On Wed, Mar 20, 2013 at 7:42 PM, Simon Glass <sjg@chromium.org> wrote:
> checkpatch has a new type of warning, a 'CHECK'. At present patman fails
> with these, which makes it less than useful.
>
> Add support for checks, making it backwards compatible with the old
> checkpatch.

There are also a few other minor fixups in this:
* Cleanup formatting of the CheckPatches() output.
* Fix erroneous "internal error" if multiple patches have warnings.
* Be more robust to new types of problems.


> @@ -64,10 +64,14 @@ def CheckPatch(fname, verbose=False):
>                  'msg': text message
>                  'file' : filename
>                  'line': line number
> +            error_count: Number of errors
> +            warning_count: Number of warnings
> +            check_count: Number of checks
>              lines: Number of lines
> +            stdout: Full output of checkpatch

nit: Right above this it says you're returning a 4-tuple.  That's no
longer true.  Could just remove the "4-".

optional: I've found that returning big tuples like this is
problematic.  Whenever you change the number of things returned you've
got to modify any callers that call like:

a, b, c, d = CheckPatch(...)

to now be:

a, b, c, d, e = CheckPatch(...)

...or never use the above syntax and use:

result = CheckPatch(...)
blah = result[0]

Maybe use a namedtuple so that callers can use the result more cleanly?


>          if match:
>              error_count = int(match.group(1))
>              warning_count = int(match.group(2))
> -            lines = int(match.group(3))
> +            match_count = int(match.group(3))
> +            if len(match.groups()) == 4:
> +               check_count = match_count
> +               lines = int(match.group(4))

I'm confused about match_count here.  What is it supposed to contain?
I can't tell from the name of it.  It looks like a temporary variable
holding either check_count or lines.  ...but you forget to assign
"lines = match_count" in an "else" case so things are broken with old
versions of checkpatch, right?


-Doug

  reply	other threads:[~2013-03-21 16:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21  2:42 [U-Boot] [PATCH 0/8] Various patman fixes Simon Glass
2013-03-21  2:42 ` [U-Boot] [PATCH 1/8] patman: Fix up checkpatch parsing to deal with 'CHECK' lines Simon Glass
2013-03-21 16:35   ` Doug Anderson [this message]
2013-03-26 22:12     ` Simon Glass
2013-03-21  2:42 ` [U-Boot] [PATCH 2/8] patman: Don't look for tags inside quotes Simon Glass
2013-03-21 16:50   ` Doug Anderson
2013-03-26 22:14     ` Simon Glass
2013-03-21  2:42 ` [U-Boot] [PATCH 3/8] patman: Minor help message/README fixes Simon Glass
2013-03-21 16:52   ` Doug Anderson
2013-03-21  2:42 ` [U-Boot] [PATCH 4/8] patman: Fix the comment in CheckTags to mention multiple tags Simon Glass
2013-03-21 16:53   ` Doug Anderson
2013-03-21  2:42 ` [U-Boot] [PATCH 5/8] patman: Provide option to ignore bad aliases Simon Glass
2013-03-21 17:09   ` Doug Anderson
2013-03-26 22:46     ` Simon Glass
2013-03-21  2:42 ` [U-Boot] [PATCH 6/8] patman: Add -a option to refrain from test-applying the patches Simon Glass
2013-03-21 17:12   ` Doug Anderson
2013-03-21  2:43 ` [U-Boot] [PATCH 7/8] patman: Add Cover-letter-cc tag to Cc cover letter to people Simon Glass
2013-03-21  3:46   ` Doug Anderson
2013-03-21  2:43 ` [U-Boot] [PATCH 8/8] patman: Add Series-process-log tag to sort/uniq change logs Simon Glass
2013-03-21 17:51   ` Doug Anderson
2013-03-26 22:15     ` Simon Glass

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-all 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='CAD=FV=Uqumqyo=8XH8yrfGEnWh8wNpQxgikhiX4yz2yVX-1JPA@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.