mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>,
	Andy Whitcroft <apw@shadowen.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	gustavo@padovan.org, johan.hedberg@gmail.com,
	linville@tuxdriver.com, netdev@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] checkpatch: Add --strict test for strings split across multiple lines
Date: Thu, 01 Mar 2012 21:54:33 -0800	[thread overview]
Message-ID: <1330667673.1939.22.camel@joe2Laptop> (raw)
In-Reply-To: <1330666534.1939.19.camel@joe2Laptop>

Strings split across multiple lines are commonly used
as formats.  These uncoalesced formats are hard to grep
and are relatively error prone.

Suggest coalescing split strings when using --strict.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 581a14c..5d0b46c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1860,6 +1860,12 @@ sub process {
 			    "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev);
 		}
 
+		if ($prevline =~ /^\+.*"[ \t]*$/ &&
+		    $line =~ /^\+[ \t]*"/) {
+			CHK("COALESCE_STRING",
+			    "Coalesced strings are easier to grep and less error prone\n" . $hereprev);
+		}
+
 # check for spaces at the beginning of a line.
 # Exceptions:
 #  1) within comments
-- 
1.7.8.111.gad25c.dirty




  reply	other threads:[~2012-03-02  5:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120302025554.GA13493@joana>
     [not found] ` <20120301.221643.881299898523907213.davem@davemloft.net>
     [not found]   ` <20120301.222316.1877216960521396397.davem@davemloft.net>
     [not found]     ` <20120301.222604.1508242694024394849.davem@davemloft.net>
     [not found]       ` <1330661602.1939.13.camel@joe2Laptop>
2012-03-02  5:35         ` [PATCH] checkpatch: Add --strict tests for braces, comments and casts Joe Perches
2012-03-02  5:54           ` Joe Perches [this message]
2012-03-13  6:23             ` [PATCH] checkpatch: Suggest pr_<level> over printk(KERN_<LEVEL> Joe Perches
2012-03-13 12:05               ` Ted Ts'o
2012-03-13 21:55                 ` Andrew Morton
2012-03-13 22:01                   ` Ted Ts'o
2012-03-13 22:03                     ` Andrew Morton
2012-03-14  0:31                       ` Ted Ts'o
2012-03-14  0:47                         ` Joe Perches
2012-03-14  1:07                           ` Ted Ts'o
2012-03-14  1:17                             ` Joe Perches
2012-03-14  2:19                               ` Ted Ts'o
2012-03-14  2:31                                 ` Joe Perches
2012-03-14  2:41                                   ` Ted Ts'o
2012-03-14  3:01                                     ` Joe Perches
2012-03-14 12:34                                       ` Ted Ts'o
2012-03-14 13:05                                         ` Joe Perches
2012-03-14 13:45                                           ` Ted Ts'o
2012-03-14 14:06                                             ` 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=1330667673.1939.22.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --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

all inboxes | Powered by JetHome®