« Perl/Lint/Policy/Modules/ProhibitAutomaticExportation.pm
↑ Summary
Perl/Lint/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm »
| 1 | package Perl::Lint::Policy::InputOutput::ProhibitExplicitStdin; | ||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use Perl::Lint::Constants::Type; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use parent "Perl::Lint::Policy"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | use constant { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | DESC => 'Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>"', | |||||||||||||||||||
| 9 | EXPL => [216, 220, 221], | ||||||||||||||||||||
| 10 | 2 | }; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 0 | ▶ | sub evaluate { | ||||||||||||||||||
|
Subroutine
evaluate: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||
| 13 | 0 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 0 | my @violations; | |||||||||||||||||||
| 16 | 0 | my $is_in_context_of_close = 0; | |||||||||||||||||||
| 17 | 0 | ▶ | for (my $i = 0; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 18 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||
| 19 | 0 | my $token_data = $token->{data}; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | ▶ | if ($token_type == TYPE_STDIN) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 22 | 0 | ▶ | next if $is_in_context_of_close; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | push @violations, { | ||||||||||||||||||||
| 24 | filename => $file, | ||||||||||||||||||||
| 25 | line => $token->{line}, | ||||||||||||||||||||
| 26 | 0 | description => DESC, | |||||||||||||||||||
| 27 | explanation => EXPL, | ||||||||||||||||||||
| 28 | policy => __PACKAGE__, | ||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | ▶ | elsif ($token_type == BUILTIN_FUNC && $token_data eq 'close') { | |||||||||||||||||||
|
Condition0%0/3
$token_type == 70 and $token_data eq "close"
MC/DC0%0/2
$token_type == 70 and $token_data eq "close"
$token_type == 70
$token_data eq "close"
Truth table0%0/3
A and B
A= $token_type == 70B= $token_data eq "close"
| |||||||||||||||||||||
| 32 | 0 | $is_in_context_of_close = 1; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | elsif ($token_type == SEMI_COLON) { | ||||||||||||||||||||
| 35 | 0 | $is_in_context_of_close = 0; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | return \@violations; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 2 | 1; | |||||||||||||||||||
| 43 | |||||||||||||||||||||