Branch Coverage

lib/Rex/Commands.pm
Criterion Covered Total %
branch 100 190 52.6


line true false branch
183 1 0 if (@_) { }
243 159 213 unless (@_)
244 159 0 if (my $t = Rex::get_current_connection())
252 1 212 if (wantarray)
264 2 210 if (ref $_ARGS[-1] eq "HASH")
265 1 1 if ($_ARGS[-1]{'class'})
269 1 1 if ($_ARGS[-1]{'file'})
273 1 1 if ($_ARGS[-1]{'tmp'})
281 0 0 unless ($task_name =~ /^[a-zA-Z_][a-zA-Z0-9_]*$/u or "Rex::Config"->get_disable_taskname_warning)
296 2 210 if (ref $_[-1] eq "HASH")
300 0 212 if ($Rex::Commands::global_no_ssh)
304 32 180 if ($class ne "main" and $class ne "Rex::CLI")
311 69 143 if ($Rex::Commands::current_desc) { }
322 188 24 if (not $class->can($task_name_save) and $task_name_save =~ /^[a-zA-Z_][a-zA-Z0-9_]+$/u)
332 4 8 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
0 8 elsif ($REGISTER_SUB_HASH_PARAMETER and scalar @_ % 2 == 0) { }
427 15 0 defined $params[1] ? :
0 0 defined $params[3] ? :
0 0 defined $params[5] ? :
0 16 if (scalar @params <= 7 and defined $params[1] ? grep({$params[1] eq $_;} 'ensure', 'system', 'gid') : 0 and defined $params[3] ? grep({$params[3] eq $_;} 'ensure', 'system', 'gid') : 1 and defined $params[5] ? grep({$params[5] eq $_;} 'ensure', 'system', 'gid') : 1) { }
469 0 1 if ($Rex::Commands::current_desc) { }
566 0 6 if (not ref $_[0] and $_[0] eq "fallback")
578 3 3 unless ($group)
580 0 3 if (ref $entity eq 'Regexp') { }
593 1 5 unless ($group)
600 3 2 if (ref $group eq "Rex::Group")
612 0 5 if (exists $data{'pass_auth'})
615 0 5 if (exists $data{'key_auth'})
618 0 5 if (exists $data{'krb5_auth'})
704 5 0 unless ("Rex::Config"->get_task_chaining_cmdline_args)
711 1 4 if (ref $task eq 'ARRAY') { }
713 1 0 unless "Rex::TaskList"->create->get_task($t)
718 1 3 unless "Rex::TaskList"->create->get_task($task)
767 0 0 unless ($task)
771 0 0 if (exists $option{'on'}) { }
772 0 0 if (exists $option{'params'}) { }
780 0 0 if (exists $option{'params'}) { }
845 0 3 if (wantarray)
862 0 1 if (wantarray)
878 0 0 if (wantarray)
958 0 0 if ($_[0] eq '-nolog' or $_[0] eq 'nolog') { }
959 0 0 unless $Rex::Logger::debug
966 0 0 if (exists $args->{'to_file'}) { }
0 0 elsif (exists $args->{'to_syslog'}) { }
1016 0 5 if (ref $self eq "ARRAY")
1021 0 5 if ($self eq "main")
1027 5 0 if ($self) { }
1034 1 1 unless (@args or @maybe_tasks_to_run)
1037 1 0 if $self =~ /^(Rex::CLI|main)$/u
1040 0 5 if (ref $args[0] eq "ARRAY")
1050 4 1 if ($self) { }
1062 4 1 if ($self)
1072 4 8 if (@args and grep /^\Q$task_name\E$/u, @args) { }
2 6 elsif (not @args) { }
1090 0 102 unless ($caller_pkg)
1094 56 46 if ($caller_pkg and $caller_pkg eq 'Rex::CLI' || $caller_pkg eq 'main')
1118 0 1 if ($@)
1173 0 225 if (@_) { }
1182 0 0 if ("Rex::Config"->get_environment eq $name)
1298 18 96 if (ref $key eq "Rex::Value")
1328 7 36 if ($task eq "ALL")
1359 6 6 if ($task eq "ALL")
1398 0 0 if ($task eq "ALL")
1427 6 10 if ($task eq "ALL")
1455 6 8 if ($task eq "ALL")
1512 0 0 unless ($type)
1527 2378 92 unless ($c_profiler)
1549 1 0 if ($str and $str eq '-on' || $str eq 'on') { }
0 0 elsif ($str and $str eq '-off' || $str eq 'off') { }
1617 2 6 if (exists $option->{$compare}) { }
1622 2 8 if ($compare =~ /$key/u)
1629 3 5 if (exists $option->{'default'} and not $to_return)
1633 3 5 if (ref $to_return eq "CODE")
1682 0 0 unless ($depth == 0 and exists $option->{'no_root'} and $option->{'no_root'})
1689 0 0 if (exists $option->{'prepend_key'})
1691 0 0 exists $option->{'key_value_sep'} ? :
1698 0 0 unless ($depth == 0 and exists $option->{'no_root'} and $option->{'no_root'})
1706 0 0 unless ($depth == 0 and exists $option->{'no_root'} and $option->{'no_root'})
1719 0 0 unless ($depth == 0 and exists $option->{'no_root'} and $option->{'no_root'})
1726 0 0 unless ($depth == 1 and exists $option->{'no_root'} and $option->{'no_root'})
1734 0 0 if (ref $var eq 'HASH') { }
0 0 elsif (ref $var eq 'ARRAY') { }
1741 0 0 if (defined $var) { }
1762 0 47 unless $str
1788 25 22 unless (defined $rule)
1793 5 17 if ($rule =~ /,/u) { }
16 1 elsif ($rule =~ /[.]{2}/msux) { }
1815 21 3 if (length $from == length $to)
1837 8 5 if ($value =~ m[\d+\.\.\d+(?:/\d+)?]u) { }
1853 0 0 if $main::rexfile
1860 0 0 if (exists $Rex::Commands::environments->{$env})
1902 0 0 unless defined $_[0]
1905 0 0 if (not defined $format or $format eq "default")
1910 0 0 if ($format eq "asis")
1931 0 0 Rex::get_current_connection() ? :