From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Wang Shilong <wangshilong1991@gmail.com>,
kumargauravgupta3@gmail.com, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: Extend CamelCase types and ignore existing CamelCase uses in a patch
Date: Wed, 4 Sep 2013 08:58:31 -0700 [thread overview]
Message-ID: <20130904155831.GB6061@xanatos> (raw)
In-Reply-To: <1378229121.7347.12.camel@joe-AO722>
On Tue, Sep 03, 2013 at 10:25:21AM -0700, Joe Perches wrote:
> Extend the CamelCase words found to include structure members.
>
> In https://lkml.org/lkml/2013/9/3/318 Sarah Sharp (mostly) wrote:
>
> "In general, if checkpatch.pl complains about a variable a patch
> introduces that's CamelCase, you should pay attention to it.
> Otherwise, [] ignore it."
>
> So, if checking a patch, scan the original patched file if it's
> available and add any preexisting CamelCase types so reuses do
> not generate CamelCase messages.
>
> That also means Andrew's not so cruelly spurned anymore.
> https://lkml.org/lkml/2013/2/22/426
>
> Signed-off-by: Joe Perches <joe@perches.com>
> Suggested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Thanks! Will this mean checkpatch.pl still complains on CamelCase names
if it's run against a file? I think that's still valuable.
Sarah Sharp
> ---
> scripts/checkpatch.pl | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 9ba4fc4..b98a996 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -424,7 +424,7 @@ sub seed_camelcase_file {
> if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
> $camelcase{$1} = 1;
> }
> - elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*\(/) {
> + elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
> $camelcase{$1} = 1;
> }
> }
> @@ -1593,6 +1593,8 @@ sub process {
> my @setup_docs = ();
> my $setup_docs = 0;
>
> + my $camelcase_file_seeded = 0;
> +
> sanitise_line_reset();
> my $line;
> foreach my $rawline (@rawlines) {
> @@ -3377,7 +3379,13 @@ sub process {
> while ($var =~ m{($Ident)}g) {
> my $word = $1;
> next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
> - seed_camelcase_includes() if ($check);
> + if ($check) {
> + seed_camelcase_includes();
> + if (!$file && !$camelcase_file_seeded) {
> + seed_camelcase_file($realfile);
> + $camelcase_file_seeded = 1;
> + }
> + }
> if (!defined $camelcase{$word}) {
> $camelcase{$word} = 1;
> CHK("CAMELCASE",
>
>
next prev parent reply other threads:[~2013-09-04 15:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5223383f.hCMXrpqEq1AlVw9b%wangshilong1991@gmail.com>
2013-09-03 15:58 ` [v4:No,Change] xHCI:Fixing xhci_readl definition and function call Sarah Sharp
2013-09-03 17:25 ` [PATCH] checkpatch: Extend CamelCase types and ignore existing CamelCase uses in a patch Joe Perches
2013-09-04 15:58 ` Sarah Sharp [this message]
2013-09-04 23:08 ` Joe Perches
2013-09-05 17:45 ` Sarah Sharp
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=20130904155831.GB6061@xanatos \
--to=sarah.a.sharp@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kumargauravgupta3@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wangshilong1991@gmail.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
all inboxes | Powered by JetHome®