From: Joe Perches <joe@perches.com>
To: Kim Phillips <kim.phillips@freescale.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Andy Whitcroft <apw@canonical.com>
Subject: Re: [PATCH] checkpatch: Make --strict a default for files in drivers/net and net/
Date: Fri, 09 May 2014 13:56:15 -0700 [thread overview]
Message-ID: <1399668975.2912.14.camel@joe-AO725> (raw)
In-Reply-To: <20140509153748.e2467ab487404f07e818719e@freescale.com>
On Fri, 2014-05-09 at 15:37 -0500, Kim Phillips wrote:
> On Wed, 7 May 2014 11:13:26 -0700
> Joe Perches <joe@perches.com> wrote:
>
> > Networking files are generally more strictly conformant to
> > linux-kernel style
>
> checkpatch disagrees :) :
>
> {drivers/}net/ : ~10.8 CHECKs per .[hc] file
> everything else: ~10 CHECKs per .[hc] file
> no net, no drivers/staging: ~8.6 CHECKs per .[hc] file
>
> (see [1] below for details).
>
> > + if ($found_file) {
> > + if ($realfile =~ m@^(drivers/net/|net/)@) {
>
> this isn't easily extensible/scalable to other subsystems, or
> say something like "all Freescale drivers." Having it configurable
> in .checkpatch.conf might be a better solution, but I don't believe
> networking should be the only subsystem that can take advantage of
> the extra checkpatch CHECKs.
staging probably could too.
> Can we enable --strict universally in the Linux kernel, maybe like
> so:?
I don't think that's appropriate (yet?).
Anyone that wants --strict checking can either add
it on the command line or create a .checkpatch.conf
file with --strict in it.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -228,6 +228,7 @@ if ($tree) {
> print "Must be run from the top-level dir. of a kernel tree\n";
> exit(2);
> }
> + $check = 1;
> }
>
> my $emitted_corrupt = 0;
>
> fwiw, --strict has been set unconditionally in u-boot's
> .checkpatch.conf for over a year now, and has significantly reduced
> patch revision churn for simple mistakes like parenthesis alignment,
> spaces after a cast and/or before a semicolon...
Good to know.
> [1] the following were run on kernel v3.15-rc4-260-g38583f0:
>
> for i in `git ls-files | grep -v '^net/' | grep -v '^drivers/net/' | grep \\\.[ch]$`; do scripts/checkpatch.pl --strict -f $i; done | grep ^CHECK: | wc -l
> 328329
> git ls-files | grep -v '^net/' | grep -v '^drivers/net/' | grep \\\.[ch]$ | wc -l
> 32754
> => 32754 / 328329 ~= 10 CHECKs per file.[ch] for everything outside of {drivers/}net/.
>
> for i in `git ls-files net/ drivers/net/ | grep \\\.[ch]$`; do scripts/checkpatch.pl --strict -f $i; done | grep ^CHECK: | wc -l
> 40431
> git ls-files net/ drivers/net/ | grep \\\.[ch]$ | wc -l
> 3742
> => {drivers/}net/: 40431 / 3742 = 10.8 CHECKs per file.[hc]
>
> for i in `git ls-files | grep -v '^net/' | grep -v '^drivers/net/' | grep -v '^drivers/staging/' | grep \\\.[ch]$`; do scripts/checkpatch.pl --strict -f $i; done | grep ^CHECK: | wc -l
> 262005
> git ls-files | grep -v '^net/' | grep -v '^drivers/net/' | grep -v '^drivers/staging/' | grep \\\.[ch]$ | wc -l
> 30479
> => no net, no staging: 262005 / 30479 = 8.6 CHECKs per file.[hc]
Try that with a per-file "wc -l" for checks per LOC
next prev parent reply other threads:[~2014-05-09 20:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 18:13 [PATCH] checkpatch: Make --strict a default for files in drivers/net and net/ Joe Perches
2014-05-09 20:37 ` Kim Phillips
2014-05-09 20:56 ` Joe Perches [this message]
2014-05-09 21:29 ` Kim Phillips
2014-05-09 21:44 ` Joe Perches
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=1399668975.2912.14.camel@joe-AO725 \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=kim.phillips@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).