mirror of
https://github.com/curl/curl.git
synced 2026-08-05 08:26:14 +03:00
checksrc: check for spaces before the colon of switch labels
Closes #11047
This commit is contained in:
parent
5cdff4f5a9
commit
7f712399d5
4 changed files with 11 additions and 4 deletions
|
|
@ -90,6 +90,7 @@ my %warnings = (
|
|||
'SPACEBEFORECOMMA' => 'space before a comma',
|
||||
'SPACEBEFOREPAREN' => 'space before an open parenthesis',
|
||||
'SPACESEMICOLON' => 'space before semicolon',
|
||||
'SPACESWITCHCOLON' => 'space before colon of switch label',
|
||||
'TABS' => 'TAB characters not allowed',
|
||||
'TRAILINGSPACE' => 'Trailing whitespace on the line',
|
||||
'TYPEDEFSTRUCT' => 'typedefed struct',
|
||||
|
|
@ -690,6 +691,12 @@ sub scanfile {
|
|||
$line, length($1), $file, $ol, "no space before semicolon");
|
||||
}
|
||||
|
||||
# check for space before the colon in a switch label
|
||||
if($l =~ /^( *(case .+|default)) :/) {
|
||||
checkwarn("SPACESWITCHCOLON",
|
||||
$line, length($1), $file, $ol, "no space before colon of switch label");
|
||||
}
|
||||
|
||||
# scan for use of banned functions
|
||||
if($l =~ /^(.*\W)
|
||||
(gmtime|localtime|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue