mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Require spaces around equality comparisons
Commit a1cbe4b5 added a check for spaces around assignments and this
patch extends it to checks for spaces around '=='. One exception is
virAssertCmpInt where comma after '==' is acceptable (since it is a
macro and '==' is its argument).
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
@@ -145,9 +145,12 @@ foreach my $file (@ARGV) {
|
||||
last;
|
||||
}
|
||||
|
||||
# Require spaces around assignment '=' and compounds
|
||||
while ($data =~ /[^!<>&|\-+*\/%\^'= ]=[^=]/ ||
|
||||
$data =~ /[^!<>&|\-+*\/%\^'=]=[^= \\\n]/) {
|
||||
# Require spaces around assignment '=', compounds and '=='
|
||||
# with the exception of virAssertCmpInt()
|
||||
while ($data =~ /[^!<>&|\-+*\/%\^'= ]=\+[^=]/ ||
|
||||
$data =~ /[^!<>&|\-+*\/%\^'=]=[^= \\\n]/ ||
|
||||
$data =~ /[\S]==/ ||
|
||||
($data =~ /==[^\s,]/ && $data !~ /[\s]virAssertCmpInt\(/)) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
|
||||
Reference in New Issue
Block a user