lkml.org 
[lkml]   [2012]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] checkpatch: Add --strict test for strings split across multiple lines
From
Date
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




\
 
 \ /
  Last update: 2012-03-02 06:57    [W:0.068 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site