提交 cdf84bf1 编写于 作者: J Ján Tomko

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.
上级 b953e163
......@@ -118,7 +118,9 @@ foreach my $file (@ARGV) {
}
# 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/) {
print "Whitespace after '(' or before ')':\n";
print "$file:$.: $line";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册