From 475c1aba68030bc21b8d0ed76a7028eb2e797f64 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 15 Oct 2020 15:30:55 +0200 Subject: checksrc: warn on empty line before open brace ... and fix a few occurances Closes #6088 --- lib/checksrc.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/checksrc.pl') diff --git a/lib/checksrc.pl b/lib/checksrc.pl index 78b9cef5b..126f3c77e 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -85,6 +85,7 @@ my %warnings = ( 'DOBRACE' => 'A single space between do and open brace', 'BRACEWHILE' => 'A single space between open brace and while', 'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression', + 'EMPTYLINEBRACE' => 'Empty line before the open brace', ); sub readskiplist { @@ -594,6 +595,11 @@ sub scanfile { checkwarn("PARENBRACE", $line, length($1)+1, $file, $l, "missing space after close paren"); } + # check for "^{" with an empty line before it + if(($l =~ /^\{/) && ($prevl =~ /^[ \t]*\z/)) { + checkwarn("EMPTYLINEBRACE", + $line, 0, $file, $l, "empty line before open brace"); + } # check for space before the semicolon last in a line if($l =~ /^(.*[^ ].*) ;$/) { -- cgit v1.2.1