summaryrefslogtreecommitdiff
path: root/lib/checksrc.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-12 09:28:37 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-12 09:50:24 +0200
commit59813726d1638880494e3675ae8230b6bdd21ee5 (patch)
tree0e705a78d21a6205fd20c1a435d5f6141ffbed84 /lib/checksrc.pl
parent20acb58a38a605cab1b17c0b3379e43cf09b40a6 (diff)
downloadcurl-59813726d1638880494e3675ae8230b6bdd21ee5.tar.gz
checksrc: detect and warn for multiple spaces
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-xlib/checksrc.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 535e3d9f5..c1f74bebf 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -62,6 +62,7 @@ my %warnings = (
'EQUALSNOSPACE' => 'equals sign without following space',
'NOSPACEEQUALS' => 'equals sign without preceeding space',
'SEMINOSPACE' => 'semicolon without following space',
+ 'MULTISPACE' => 'multiple spaces used when not suitable',
);
sub readwhitelist {
@@ -563,6 +564,18 @@ sub scanfile {
"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++;
$prevl = $ol;
}