Branch Coverage

blib/lib/Perl/Critic/Policy/Subroutines/RequireFinalReturn.pm
Criterion Covered Total %
branch 52 68 76.4


line true false branch
52 4 55 if $elem->isa("PPI::Statement::Scheduled")
55 0 55 if (@blocks > 1) { }
1 54 elsif (@blocks == 0) { }
67 33 21 if ($self->_block_is_empty($block) or $self->_block_has_return($block))
73 21 0 if (my $name = $elem->name) { }
96 1 83 unless $final
107 21 62 if $self->_is_conditional_stmnt($final)
117 20 15 unless ($final->isa("PPI::Statement::Compound"))
122 0 15 unless $begin
123 1 14 unless ($begin->isa("PPI::Token::Word") and $begin->content eq 'if' || $begin->content eq 'unless')
131 0 14 if (scalar grep({not $_->isa("PPI::Structure::Block");} @blocks))
137 6 19 unless ($self->_block_has_return($block))
150 33 4 unless ($final->isa("PPI::Statement::Given"))
155 0 4 unless $begin
156 0 4 unless ($begin->isa("PPI::Token::Word") and $begin->content eq "given")
164 0 4 if (scalar grep({not $_->isa("PPI::Structure::Block");} @blocks))
168 0 4 if (@blocks > 1)
172 0 4 unless @blocks
178 6 1 if ($stmnt->isa('PPI::Statement::When')) { }
182 3 3 if $first_token = $stmnt->schild(0) and "default" eq $first_token->content
186 1 5 unless $self->_is_when_stmnt_with_return($stmnt)
191 0 1 unless $self->_is_suffix_when_with_return($stmnt)
205 29 34 unless $stmnt->isa("PPI::Statement::Break")
216 0 31 unless $stmnt->isa("PPI::Statement")
219 12 19 if exists $self->{'_terminal_funcs'}{$first_token}
222 12 6 unless $second_token->isa("PPI::Token::Operator") and $second_token eq "->"
232 0 83 unless $stmnt->isa("PPI::Statement")
235 21 67 if $elem->isa("PPI::Token::Word") and exists $CONDITIONALS{$elem}
248 0 6 if (scalar grep({not $_->isa("PPI::Structure::Block");} @inner))
251 0 6 if @inner > 1
253 0 6 unless @inner
256 1 5 unless ($self->_block_has_return($block))
268 0 1 unless $stmnt->isa("PPI::Statement")
270 1 2 if $elem->isa("PPI::Token::Word") and "when" eq $elem->content