perlcritic fixes

This commit is contained in:
Joe Cooper
2026-05-11 20:37:30 -05:00
parent 04ae776e6a
commit a9aae79fcd
3 changed files with 7 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
require 'nftables-lib.pl';
require './nftables-lib.pl'; ## no critic (Modules::RequireBarewordIncludes)
our (%in, %text);
# acl_security_form(&options)
@@ -86,5 +86,6 @@ if (!$err) {
);
}
}
return sort { $a->[1] cmp $b->[1] } @opts;
my @sorted = sort { $a->[1] cmp $b->[1] } @opts;
return @sorted;
}

View File

@@ -11,7 +11,7 @@ $no_acl_check++;
if ($0 =~ /^(.*\/)[^\/]+$/) {
chdir($1);
}
require './nftables-lib.pl';
require './nftables-lib.pl'; ## no critic (Modules::RequireBarewordIncludes)
if ($module_name ne 'nftables') {
print STDERR "Command must be run with full path\n";
exit(5);

View File

@@ -153,9 +153,9 @@ return has_command($cmd);
sub nft_version_text
{
my $cmd = get_nft_command();
return undef if (!$cmd);
return if (!$cmd);
my $out = backquote_command(quotemeta($cmd)." --version 2>&1");
return undef if ($? || !$out);
return if ($? || !$out);
$out =~ s/\r?\n.*$//s;
$out =~ s/^\s+|\s+$//g;
if ($out =~ /^nftables\s+v?(\S+)(?:\s+(.*))?$/i) {
@@ -170,7 +170,7 @@ return $out;
# Returns an error message if nftables is not installed, undef if all is OK
sub check_nftables
{
return undef if (get_nft_command());
return if (get_nft_command());
return text('index_ecommand', "<tt>nft</tt>");
}