Skip to content

Commit

Permalink
checkpatch: warn on missing spaces in broken up quoted
Browse files Browse the repository at this point in the history
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 around 450 new warnings and has a low rate of false
positives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dan Carpenter authored and Linus Torvalds committed Aug 7, 2014
1 parent 308cc8d commit ece9659
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,12 @@ sub process {
"quoted string split across lines\n" . $hereprev);
}

# check for missing a space in a string concatination
if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) {
WARN('MISSING_SPACE',
"break quoted strings at a space character\n" . $hereprev);
}

# check for spaces before a quoted newline
if ($rawline =~ /^.*\".*\s\\n/) {
if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",
Expand Down

0 comments on commit ece9659

Please sign in to comment.