linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>, linux-kernel@vger.kernel.org
Subject: [patch] checkpatch: warn on missing spaces in broken up quoted strings
Date: Fri, 13 Jun 2014 09:53:46 +0300	[thread overview]
Message-ID: <20140613065346.GA28134@mwanda> (raw)

Checkpatch already complains when people break up quoted strings but
it's still pretty common.  One mistake that people often make is they
leave out the space character between the two strings.

This check adds 453 new warnings.  There very few false positives, here
is what they look like:

1) Most of the false positives are in crypto/testmgr.h where they just
   want a 10x10 block of sample text and don't care about the content.
2) There one commented place like this:
  "das08-aoh"
  "das08-aol"
3) There is one place which breaks the alphabet at the lower and upper
   case boundary.
4) There is one person who broke quoted strings at the 80 character mark
   without considering the content (that's not really a false positive,
   now that I think about it).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 010b18e..c50eee2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4009,6 +4009,12 @@ sub process {
 			}
 		}
 
+# check for missing a space in a string concatination
+        if ($prevrawline =~ /[^\\][a-zA-Z]"$/ && $rawline =~ /^\+[\t ]+"[a-zA-Z]/) {
+            WARN('MISSING_SPACE',
+                 "break quoted strings at a space character\n" . $hereprev);
+        }
+
 # check for bad placement of section $InitAttribute (e.g.: __initdata)
 		if ($line =~ /(\b$InitAttribute\b)/) {
 			my $attr = $1;

             reply	other threads:[~2014-06-13  6:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  6:53 Dan Carpenter [this message]
2014-06-13  9:30 ` [patch] checkpatch: warn on missing spaces in broken up quoted strings Joe Perches
2014-06-13  9:46   ` Dan Carpenter
2014-06-13 19:52     ` Joe Perches
2014-06-16  6:40       ` Dan Carpenter
2014-06-16 18:27         ` Joe Perches
2014-07-23 11:56           ` Dan Carpenter
2014-07-23 12:11           ` [patch v2] checkpatch: warn on missing spaces in broken up quoted Dan Carpenter

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=20140613065346.GA28134@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@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).