mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
check-spacing: rewrite regex for checking the closing parenthesis
Instead of matching multiple characters before the parenthesis, only check for a single whitespace, which is much less cpu-intensive. This only matches a few dozen of places where they are on an separate line, filter out those with a separate regex.
This commit is contained in:
parent
b953e163ad
commit
cdf84bf1a8
@ -118,7 +118,9 @@ foreach my $file (@ARGV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Forbid whitespace following ( or prior to )
|
# Forbid whitespace following ( or prior to )
|
||||||
if ($data =~ /\S\s+\)/ ||
|
# but allow whitespace before ) on a single line
|
||||||
|
# (optionally followed by a semicolon)
|
||||||
|
if (($data =~ /\s\)/ && not $data =~ /^\s+\);?$/) ||
|
||||||
$data =~ /\(\s+\S/) {
|
$data =~ /\(\s+\S/) {
|
||||||
print "Whitespace after '(' or before ')':\n";
|
print "Whitespace after '(' or before ')':\n";
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
|
Loading…
Reference in New Issue
Block a user