mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
checksrc: add check for spaces around logical AND operators
Closes #15144
This commit is contained in:
parent
51724c43e3
commit
a58584a881
@ -895,7 +895,7 @@ cr_connect_common(struct Curl_cfilter *cf,
|
||||
}
|
||||
if(0 == what) {
|
||||
CURL_TRC_CF(data, cf, "Curl_socket_check: %s would block",
|
||||
wants_read&&wants_write ? "writing and reading" :
|
||||
wants_read && wants_write ? "writing and reading" :
|
||||
wants_write ? "writing" : "reading");
|
||||
if(wants_write)
|
||||
connssl->io_need |= CURL_SSL_IO_NEED_SEND;
|
||||
|
@ -80,6 +80,7 @@ my %warnings = (
|
||||
'LONGLINE' => "Line longer than $max_column",
|
||||
'SPACEBEFORELABEL' => 'labels not at the start of the line',
|
||||
'MULTISPACE' => 'multiple spaces used when not suitable',
|
||||
'NOSPACEAND' => 'missing space around Logical AND operator',
|
||||
'NOSPACEC' => 'missing space around ternary colon operator',
|
||||
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
||||
'NOSPACEQ' => 'missing space around ternary question mark operator',
|
||||
@ -626,6 +627,20 @@ sub scanfile {
|
||||
"space after open parenthesis");
|
||||
}
|
||||
|
||||
# check spaces before Logical AND operator
|
||||
if($nostr =~ /^(.*)\w&&/i) {
|
||||
checkwarn("NOSPACEAND",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"missing space before Logical AND");
|
||||
}
|
||||
|
||||
# check spaces after Logical AND operator
|
||||
if($nostr =~ /^(.*&&)\w/i) {
|
||||
checkwarn("NOSPACEAND",
|
||||
$line, length($1), $file, $l,
|
||||
"missing space after Logical AND");
|
||||
}
|
||||
|
||||
# check spaces before colon
|
||||
if($nostr =~ /^(.*[^']\?[^'].*)(\w|\)|\]|')\:/i) {
|
||||
my $m = $1;
|
||||
|
Loading…
Reference in New Issue
Block a user