mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
check-spacing: simplify keyword spacing check
We do not need a separate check forbidding whitespace after the opening parenthesis after a keyword - we forbid it after all of them. The only allowed whitespace after an opening parenthesis is a newline, tune the regex to reflect that.
This commit is contained in:
parent
cdf84bf1a8
commit
a2762b93fd
@ -101,10 +101,8 @@ foreach my $file (@ARGV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Require whitespace immediately after keywords,
|
# Require whitespace immediately after keywords
|
||||||
# but none after the opening bracket
|
if ($data =~ /\b(if|for|while|switch|return)\(/) {
|
||||||
if ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
|
||||||
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
|
||||||
print "No whitespace after keyword:\n";
|
print "No whitespace after keyword:\n";
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
@ -121,7 +119,7 @@ foreach my $file (@ARGV) {
|
|||||||
# but allow whitespace before ) on a single line
|
# but allow whitespace before ) on a single line
|
||||||
# (optionally followed by a semicolon)
|
# (optionally followed by a semicolon)
|
||||||
if (($data =~ /\s\)/ && not $data =~ /^\s+\);?$/) ||
|
if (($data =~ /\s\)/ && not $data =~ /^\s+\);?$/) ||
|
||||||
$data =~ /\(\s+\S/) {
|
$data =~ /\((?!$)\s/) {
|
||||||
print "Whitespace after '(' or before ')':\n";
|
print "Whitespace after '(' or before ')':\n";
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user