1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

checksrc: detect and warn for multiple spaces

This commit is contained in:
Daniel Stenberg 2017-09-12 09:28:37 +02:00
parent 20acb58a38
commit 59813726d1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -62,6 +62,7 @@ my %warnings = (
'EQUALSNOSPACE' => 'equals sign without following space', 'EQUALSNOSPACE' => 'equals sign without following space',
'NOSPACEEQUALS' => 'equals sign without preceeding space', 'NOSPACEEQUALS' => 'equals sign without preceeding space',
'SEMINOSPACE' => 'semicolon without following space', 'SEMINOSPACE' => 'semicolon without following space',
'MULTISPACE' => 'multiple spaces used when not suitable',
); );
sub readwhitelist { sub readwhitelist {
@ -563,6 +564,18 @@ sub scanfile {
"no space after semilcolon"); "no space after semilcolon");
} }
# check for more than one consecutive space before open brace or
# question mark. Skip lines containing strings since they make it hard
# due to artificially getting multiple spaces
if(($l eq $nostr) &&
$nostr =~ /^(.*(\S)) + [{?]/i) {
checkwarn("MULTISPACE",
$line, length($1)+1, $file, $ol,
"multiple space");
print STDERR "L: $l\n";
print STDERR "nostr: $nostr\n";
}
$line++; $line++;
$prevl = $ol; $prevl = $ol;
} }