Messages in this thread Patch in this message | | | Subject | [PATCH] checkpatch: Add --strict test for strings split across multiple lines | From | Joe Perches <> | Date | Thu, 01 Mar 2012 21:54:33 -0800 |
| |
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
| |