]> granicus.if.org Git - curl/commitdiff
checksrc: detect and warn for lack of spaces next to plus signs
authorDaniel Stenberg <daniel@haxx.se>
Sat, 9 Sep 2017 21:54:47 +0000 (23:54 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 11 Sep 2017 07:29:50 +0000 (09:29 +0200)
lib/checksrc.pl

index f4ffa1ef38cbfacad061af947ca3a66d40f24931..3d3e516416731b0b21121fea50736b6e56b7499e 100755 (executable)
@@ -542,6 +542,19 @@ sub scanfile {
                       "no space before equals sign");
         }
 
+        # check for plus signs without spaces next to it
+        if($nostr =~ /(.*)[^+]\+[a-z0-9]/i) {
+            checkwarn("PLUSNOSPACE",
+                      $line, length($1)+1, $file, $ol,
+                      "no space after plus sign");
+        }
+        # check for plus sign without spaces before it
+        elsif($nostr =~ /(.*)[a-z0-9]\+[^+]/i) {
+            checkwarn("NOSPACEPLUS",
+                      $line, length($1)+1, $file, $ol,
+                      "no space before plus sign");
+        }
+
         $line++;
         $prevl = $ol;
     }