qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Anand J <anand.indukala@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, thuth@redhat.com
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] script/clean-includes: added duplicate #include check
Date: Thu, 20 Oct 2016 08:57:50 -0500	[thread overview]
Message-ID: <a315edac-70ee-6aba-f65d-adc5a521d48b@redhat.com> (raw)
In-Reply-To: <1476957133-24382-1-git-send-email-anand.indukala@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2142 bytes --]

On 10/20/2016 04:52 AM, Anand J wrote:
> Added script to check duplicate #include entries. This check will scan
> and print the files in which duplicate #include entries are present.

Subject line typo: s,script/,scripts/,

> 
> Script might output false positive entries as well. Such entries should
> not be removed. So if it finds any duplicate entries script will
> terminate with an exit status 1. Then each and every file should be
> checked manually and corrected if necessary.
> 
> In order to enable the check use --check-duphead option with
> script/clean-includes.

Bike-shedding, but if you are going to put a dash between words, put it
between ALL words, as in --check-dup-head.  Or spell it out:
--check-duplicate-headers.  If that feels to long, and you want to
abbreviate, then abbreviate further, as in --duphead.

> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Anand J <anand.indukala@gmail.com>
> ---

>  #
> +# If --check-duphead option is used, then check for duplicate
> +# header files will be enabled.

Grammar; I suggest:

If --check-duphead is specified, additionally check for duplicate header
includes.

> +while true
> +do
> +    case $1 in
> +    "--git")
> +         if [ $# -eq 1 ]; then
> +             echo "--git option requires an argument"
> +             exit 1
> +         fi
> +         GITSUBJ="$2"
> +         GIT=yes
> +         shift
> +         shift
> +         ;;
> +    "--check-duphead")
> +        DUPHEAD=yes
> +        shift
> +        ;;
> +    *)

Your option-parsing loop is missing a special case for --; for
consistency with POSIX recommendations, you should have:

--)
  shift
  break
  ;;
*)

as a way to end option parsing early (and force the next argument to be
treated as a filename, even if it starts with -).

>  
> +if [ "$DUPHEAD" = "yes" ]; then
> +    grep "^#include" $@ | sort | uniq -c | awk '{if ($1 > 1) print $0}'

Missing quotes around $@.

Looking forward to v3.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      parent reply	other threads:[~2016-10-20 13:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20  9:52 [Qemu-trivial] [Qemu-devel] [PATCH 1/2] script/clean-includes: added duplicate #include check Anand J
2016-10-20  9:52 ` [Qemu-trivial] [Qemu-devel] [PATCH 2/2] clean-up: removed duplicate #includes Anand J
2016-10-20 13:48 ` [Qemu-trivial] [Qemu-devel] [PATCH 1/2] script/clean-includes: added duplicate #include check Eric Blake
2016-10-20 13:57 ` Eric Blake [this message]

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=a315edac-70ee-6aba-f65d-adc5a521d48b@redhat.com \
    --to=eblake@redhat.com \
    --cc=anand.indukala@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).