[PATCH] checkpatch: Add --strict test for strings split acrossmultiple lines

From: Joe Perches
Date: Fri Mar 02 2012 - 00:54:33 EST


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@xxxxxxxxxxx>
---
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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/