TT#29620 Clean TAP test warning: ProhibitMixedBooleanOperators

"Mixed high and low-precedence booleans"

The operations have different precedence and must not be mixed together.

Change-Id: If38e25d6e94f599dc9462d9ee37ce165fa303b35
changes/70/21270/8
Alexander Lutay 8 years ago committed by Gerhard Jungwirth
parent db0adbde4e
commit 2bb814d326

@ -1621,8 +1621,7 @@ sub pbx_device_create :Chained('base') :PathPart('pbx/device/create') :Args(0) {
$err = NGCP::Panel::Utils::DeviceBootstrap::dispatch(
$c, 'register', $fdev);
unless($err) {
my $err_lines = $c->forward('pbx_device_lines_update', [$schema, $fdev, [$form->field('line')->fields]]);
!$err and ( $err = $err_lines );
$err = $c->forward('pbx_device_lines_update', [$schema, $fdev, [$form->field('line')->fields]]);
}
});
@ -1744,8 +1743,7 @@ sub pbx_device_edit :Chained('pbx_device_base') :PathPart('edit') :Args(0) {
unless($err) {
$fdev->autoprov_field_device_lines->delete_all;
my $err_lines = $c->forward('pbx_device_lines_update', [$schema, $fdev, [$form->field('line')->fields]]);
!$err and ( $err = $err_lines );
$err = $c->forward('pbx_device_lines_update', [$schema, $fdev, [$form->field('line')->fields]]);
}
});

@ -71,10 +71,10 @@ sub render {
sub validate {
my ( $self ) = @_;
return $self->add_error($self->label . " is invalid")
if($self->required and (
!defined $self->value or !length($self->value)
));
if($self->required &&
( !defined($self->value) || !length($self->value) ) ) {
return $self->add_error($self->label . " is invalid");
}
return 1;
}

@ -49,10 +49,10 @@ sub render {
sub validate {
my ( $self ) = @_;
return $self->add_error("Invalid date, must be in format YYYY-MM-DD")
if($self->required and (
!defined $self->value or !length($self->value) or $self->value !~ /^\d{4}-\d{2}-\d{2}$/
));
if($self->required &&
( !defined $self->value || !length($self->value) || $self->value !~ /^\d{4}-\d{2}-\d{2}$/ ) ) {
return $self->add_error("Invalid date, must be in format YYYY-MM-DD");
}
return 1;
}

@ -49,10 +49,10 @@ sub render {
sub validate {
my ( $self ) = @_;
return $self->add_error($self->label . " is invalid")
if($self->required and (
!defined $self->value or !length($self->value)
));
if($self->required &&
( !defined $self->value || !length($self->value) ) ) {
return $self->add_error($self->label . " is invalid");
}
return 1;
}

@ -767,7 +767,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed($pe) && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity,$op);
$entity = $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
}
@ -780,7 +780,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{path});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed $pe && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
$entity = $coderef->('JSON::Pointer', $entity, $op->{path});
}
@ -793,7 +793,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{from}, $op->{path});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed $pe && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
$entity = $coderef->('JSON::Pointer', $entity, $op->{from}, $op->{path});
}
@ -807,7 +807,7 @@ sub apply_patch {
unless $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed $pe && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
die "test failed - path: $op->{path} value: $op->{value}\n"
unless $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});

@ -221,7 +221,7 @@ sub new_local {
my %params;
@params{qw/year month day hour minute second nanosecond/} = @_;
foreach(keys %params){
!defined $params{$_} and delete $params{$_};
defined($params{$_}) or delete($params{$_});
}
return DateTime->new(
time_zone => $LOCAL_TZ,

@ -322,7 +322,7 @@ EOF
use Data::Dumper;
$c->log->info("received from dispatcher: " . Dumper $ret);
if(!$ret or $ret->[1] != 1 or $ret->[2] =~ m#<name>faultString</name>#) {
if(!$ret || $ret->[1] != 1 || $ret->[2] =~ m#<name>faultString</name>#) {
die "failed to trigger dial-out";
}
return 1;

@ -47,7 +47,7 @@ sub dispatch {
my $buf;
my $n = $s->read_entity_body($buf, 1024);
if (!defined($n) || $n == -1) {
$!{EINTR} || $!{EAGAIN} and next;
next if ($!{EINTR} || $!{EAGAIN});
die;
}
$n == 0 and last;

@ -74,7 +74,7 @@ sub init {
fatal('No mode argument specified, one of [' . join(', ',(MODE_STRINGS)). "] required") unless $mode;
$output_dir .= '/' if $output_dir && '/' ne substr($output_dir,-1);
makedir($output_dir) if $output_dir && not -e $output_dir;
makedir($output_dir) if $output_dir && ! -e $output_dir;
$output_filename = "api_dump_" . $mode . "_results_" . datetime_to_string(current_local()) . $output_file_suffix unless $output_filename;
$output_filename = $output_dir . $output_filename;

@ -21,7 +21,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed($pe) && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity,$op);
$entity = $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
}
@ -34,7 +34,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{path});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed($pe) && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
$entity = $coderef->('JSON::Pointer', $entity, $op->{path});
}
@ -47,7 +47,7 @@ sub apply_patch {
$entity = $coderef->('JSON::Pointer', $entity, $op->{from}, $op->{path});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed($pe) && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
$entity = $coderef->('JSON::Pointer', $entity, $op->{from}, $op->{path});
}
@ -61,7 +61,7 @@ sub apply_patch {
unless $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});
} catch($pe) {
if (defined $optional_field_code_ref && ref $optional_field_code_ref eq 'CODE') {
if (blessed $pe and $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
if (blessed($pe) && $pe->isa('JSON::Pointer::Exception') && $pe->code == JSON::Pointer::Exception->ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE) {
&$optional_field_code_ref(substr($op->{path},1),$entity);
die "test failed - path: $op->{path} value: $op->{value}\n"
unless $coderef->('JSON::Pointer', $entity, $op->{path}, $op->{value});

Loading…
Cancel
Save