Branch Coverage

blib/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireConstantVersion.pm
Criterion Covered Total %
branch 59 78 75.6


line true false branch
66 170 219 if $VERSION_VARIABLE ne $elem->content
74 0 219 unless $operator = get_next_element_in_same_simple_statement($elem)
79 1 218 if $self->_validate_operator_bind_regex($operator, $elem)
84 8 210 unless $operator = _check_for_assignment_operator($operator)
89 0 210 unless $value = $operator->snext_sibling
94 2 208 if $value->isa("PPI::Token::Symbol") and $value->content eq $VERSION_VARIABLE
100 0 208 if $value->isa("Perl::Critic::Exception")
103 99 109 unless is_ppi_constant_element($value)
109 0 109 unless $structure = get_next_element_in_same_simple_statement($value)
112 87 22 if $Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion::SCOLON eq $structure->content
125 1 217 unless $operator->isa("PPI::Token::Operator")
126 210 7 if is_assignment_operator($operator->content)
140 213 6 if $BIND_REGEX ne $operator->content
142 0 6 unless $operand = $operator->snext_sibling
143 0 6 unless $operand->isa("PPI::Token::Regexp::Substitute")
149 1 5 if $elem->snext_sibling
153 0 5 unless $containing_list = $elem->parent and $containing_list->isa("PPI::Statement") and $containing_list = $containing_list->parent and $containing_list->isa("PPI::Structure::List")
161 0 5 unless my $prior = $elem->sprevious_sibling
165 2 3 if $prior->isa("PPI::Token::Operator") and $OPERATOR_WHICH_MAKES_NEW_VALUE{$prior->content}
174 6 5 unless $prior->isa("PPI::Token::Word")
175 3 2 unless is_function_call($prior)
179 2 0 unless $current->isa("PPI::Structure::List")
186 0 1 unless $prior = $containing_list->sprevious_sibling
188 1 0 if ($prior->isa("PPI::Token::Word"))
189 0 1 if is_method_call($prior)
190 1 0 if is_function_call($prior)
208 75 133 if ($value->isa("PPI::Token::Word"))
215 0 75 if ($content =~ / \A v \d+ \z /msx) { }
10 65 elsif ($QV eq $content) { }
8 57 elsif ($VERSION_MODULE eq $content) { }
250 0 0 unless $next = $value->snext_sibling and $next->isa("PPI::Token::Number")
270 9 1 unless ($self->{'_allow_version_without_use_on_same_line'})
272 2 7 unless $module = get_previous_module_used_on_same_line($value)
275 0 7 if $VERSION_MODULE ne $module->content
281 1 7 unless $next = $value->snext_sibling and $next->isa("PPI::Structure::List") and $next = $next->schild(0) and $next->isa("PPI::Statement::Expression") and $next = $next->schild(0)
306 6 2 unless ($self->{'_allow_version_without_use_on_same_line'})
308 4 2 unless $module = get_previous_module_used_on_same_line($value)
311 0 2 if $VERSION_MODULE ne $module->content
317 4 0 if $next = $value->snext_sibling and $next->isa("PPI::Token::Operator") and "->" eq $next->content and $next = $next->snext_sibling and $next->isa("PPI::Token::Word") and "new" eq $next->content and $next = $next->snext_sibling and $next->isa("PPI::Structure::List") and $next = $next->schild(0) and $next->isa("PPI::Statement::Expression") and $next = $next->schild(0)