Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ece9659f authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds
Browse files

checkpatch: warn on missing spaces in broken up quoted



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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 308cc8d8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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",