TT#37221 fix perlcritic error Subroutines::ProhibitExplicitReturnUndef

this is to clean the Sipwise TAP tests for this repo

the critical places where undef is really the intended return value (because
a scalar should always be returned) the rule has been overridden

Change-Id: I66e217a03a00e0f366db9c0cbc5007dd15cd9f96
changes/79/21379/2
Gerhard Jungwirth 8 years ago
parent 02e3e040b5
commit 6e8dd1a2a1

@ -149,7 +149,7 @@ sub GET :Allow {
sub item_base {
my ($self,$c,$id) = @_;
$c->stash->{contract_id} = $id;
return undef;
return;
}
sub item_get {

@ -257,7 +257,7 @@ has_field 'topup_profiles.network_id' => (
sub _deflate_lock_level {
my ($self,$value) = @_;
if (defined $value and length($value) == 0) {
return undef;
return;
}
return $value;
}

@ -346,7 +346,7 @@ has_block 'actions' => (
sub _deflate_lock_level {
my ($self,$value) = @_;
if (defined $value and length($value) == 0) {
return undef;
return;
}
return $value;
}

@ -181,7 +181,7 @@ sub deflate_money {
sub _deflate_lock_level {
my ($self,$value) = @_;
if (defined $value and length($value) == 0) {
return undef;
return;
}
return $value;
}

@ -18,7 +18,7 @@ sub get_actual_billing_mapping {
if ($bm_actual) {
return $bm_actual->billing_mappings->first;
}
return undef;
return;
}
sub get_actual_billing_mapping_stmt {

@ -96,7 +96,7 @@ sub _set_ip_net_from_to {
$resource->{_ipv6_net_from} = $from;
$resource->{_ipv6_net_to} = $to;
}
return undef;
return;
}
#deflate column values for search parameters doesn't work, so we need this sub
@ -119,6 +119,8 @@ sub _prepare_query_param_value {
my ($q,$v) = @_;
my ($bytes,$version) = _ip_to_bytes($q);
if (defined $v) {
# really complex interaction
## no critic (ProhibitExplicitReturnUndef)
return undef if (!defined $bytes || $v != $version);
return $bytes;
} else {

@ -89,7 +89,7 @@ sub _set_ip_net_from_to {
$resource->{_ipv6_net_from} = $from;
$resource->{_ipv6_net_to} = $to;
}
return undef;
return;
}
#deflate column values for search parameters doesn't work, so we need this sub
@ -112,6 +112,8 @@ sub _prepare_query_param_value {
my ($q,$v) = @_;
my ($bytes,$version) = _ip_to_bytes($q);
if (defined $v) {
# really complex interaction
## no critic (ProhibitExplicitReturnUndef)
return undef if (!defined $bytes || $v != $version);
return $bytes;
} else {

@ -712,7 +712,7 @@ sub get_relation_value {
return $relation_data->val;
}
}
return undef;
return;
}
sub get_tag_value {
@ -728,7 +728,7 @@ sub get_tag_value {
return $tag_data->val;
}
}
return undef;
return;
}
1;

@ -82,7 +82,7 @@ sub validate_entities {
my $schema = $c->model('DB');
if ('CODE' ne ref $err_code) {
$err_code = sub { return undef; };
$err_code = sub { return; };
}
my $validate_field = sub {

@ -220,7 +220,7 @@ sub get_api_journal_query_params {
sub handle_api_item_base_journal {
my ($controller,$c,$id) = @_;
$c->stash->{item_id_journal} = $id;
return undef;
return;
}
sub handle_api_journals_get {
@ -500,6 +500,7 @@ sub get_journal_relation_link {
)
}
}
## no critic (ProhibitExplicitReturnUndef)
return undef;
}
@ -582,7 +583,7 @@ sub _serialize_content { #run this in eval only, deflate somehow inflicts a segf
return Sereal::Encoder::encode_sereal($data);
}
}
return undef;
return;
}
sub _deserialize_content {
@ -600,7 +601,7 @@ sub _deserialize_content {
return Sereal::Decoder::decode_sereal($serialized);
}
}
return undef;
return;
}
sub _create_journal {
@ -649,7 +650,7 @@ sub _create_journal {
last;
};
}
return undef;
return;
}
1;

@ -131,7 +131,7 @@ sub lookup {
order_by => { -desc => qw/callee_prefix/ },
});
return undef unless $rs->first;
return unless $rs->first;
my %peer_data;
my @peer_groups;

@ -1207,7 +1207,7 @@ sub get_provisoning_voip_subscriber_first_int_attr_value {
my $prov_subscriber= $params{prov_subscriber};
my $attribute = $params{attribute};
return undef unless $prov_subscriber;
return unless $prov_subscriber;
my $rs = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c,

@ -859,7 +859,7 @@ sub _get_resized_interval_end {
return NGCP::Panel::Utils::DateTime::infinite_future;
}
}
return undef;
return;
}
sub _get_interval_start {
@ -905,7 +905,7 @@ sub _add_interval {
}
return $to;
}
return undef;
return;
}
sub _add_second {
@ -992,7 +992,7 @@ sub get_timely_range {
$timely_end = _add_interval(NGCP::Panel::Utils::DateTime::set_local_tz($balance->start),$package->balance_interval_unit,$package->balance_interval_value,
_START_MODE_PRESERVE_EOM->{$package->balance_interval_start_mode} ? NGCP::Panel::Utils::DateTime::set_local_tz($contract->create_timestamp // $contract->modify_timestamp) : undef)->subtract(seconds => 1);
}
$timely_start = _add_second(_add_interval($timely_end,$timely_duration_unit,-1 * $timely_duration_value),1);
$timely_start = _add_second(scalar(_add_interval($timely_end,$timely_duration_unit,-1 * $timely_duration_value)),1);
$timely_start = NGCP::Panel::Utils::DateTime::set_local_tz($balance->start) if $timely_start < NGCP::Panel::Utils::DateTime::set_local_tz($balance->start);
$is_timely = ($now >= $timely_start && $now <= $timely_end ? 1 : 0);

@ -178,7 +178,7 @@ sub lock_provisoning_voip_subscriber {
sub get_provisoning_voip_subscriber_lock_level {
my %params = @_;
NGCP::Panel::Utils::Preferences::get_provisoning_voip_subscriber_first_int_attr_value(%params,
return NGCP::Panel::Utils::Preferences::get_provisoning_voip_subscriber_first_int_attr_value(%params,
attribute => 'lock'
);
}

@ -361,7 +361,7 @@ sub _delete_customer_contact {
$req = HTTP::Request->new('GET', $url);
$res = $ua->request($req);
is($res->code, 200, "test customer contact is still found");
return undef;
return;
}
}
@ -452,7 +452,7 @@ sub _delete_subscriber {
$req = HTTP::Request->new('GET', $url);
$res = $ua->request($req);
is($res->code, 200, "test subscriber is still found");
return undef;
return;
}
}

@ -860,7 +860,7 @@ sub test_ccmapentries {
_test_journal_collection('ccmapentries',$subscriber->{id},$journals);
return undef;
return;
}
@ -925,7 +925,7 @@ sub test_callforwards {
_test_journal_collection('callforwards',$subscriber->{id},$journals);
return undef;
return;
}
@ -2477,7 +2477,7 @@ sub _get_preference_value {
}
}
}
return undef;
return;
}
sub _to_json {

@ -202,7 +202,7 @@ sub _create_lnp_number {
return $number;
} else {
is($res->code, $expected_code, "create test lnp number returns $expected_code");
return undef;
return;
}
}
@ -234,7 +234,7 @@ sub _update_lnp_number {
is($res->code, 200, "fetch test lnp number");
my $got_number = JSON::from_json($res->decoded_content);
is_deeply($got_number,$number,"lnp number unchanged");
return undef;
return;
}
}
@ -259,7 +259,7 @@ sub _delete_lnp_number {
$req->header('X-Fake-Clienttime' => _get_fake_clienttime_now());
$res = $ua->request($req);
is($res->code, 200, "test lnp number is still found");
return undef;
return;
}
}
@ -313,7 +313,7 @@ sub _create_lnp_provider {
return $carrier;
} else {
is($res->code, $expected_code, "create test lnp carrier returns $expected_code");
return undef;
return;
}
}
@ -336,7 +336,7 @@ sub _delete_lnp_provider {
$req = HTTP::Request->new('GET', $url);
$res = $ua->request($req);
is($res->code, 200, "test lnp carrier is still found");
return undef;
return;
}
}

@ -307,7 +307,7 @@ sub _delete_system_contact {
$req = HTTP::Request->new('GET', $url);
$res = $ua->request($req);
is($res->code, 200, "test system contact is still found");
return undef;
return;
}
}

Loading…
Cancel
Save