blib/lib/Perl/Critic/Policy/Perlsecret.pm

filter: Statementstmt 100% 110 / 110 Branchbran 88.0% 81 / 92 Conditioncond 75.0% 45 / 60 MC/DCmcdc 48.4% 16 / 33 Subroutinesub 100% 32 / 32 Podpod 66.6% 4 / 6 totaltotal 86.4% 288 / 333 CC 87 SCAR 16.8
CC
87
Cov
90%
_abbott_and_costello
8.1
_key_of_truth
7.8
_inchworm_on_a_stick
7.1
CRAP 5.4
↑ Summary
1 package Perl::Critic::Policy::Perlsecret;
2 # ABSTRACT: Prevent perlsecrets entering your codebase
3  
4 4 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Perl::Critic::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 our $VERSION = '0.0.11';
15  
16 4 Readonly::Scalar my $DESCRIPTION => 'Perlsecret risk.';
17 4 Readonly::Scalar my $EXPLANATION => 'Perlsecret detected.';
18  
19 # Eskimo Greeting skipped as only used in one liners
20 4 Readonly::Hash my %default_violations => (
21 'Venus' => \&_venus,
22 'Baby Cart' => \&_baby_cart,
23 'Bang Bang' => \&_bang_bang,
24 'Inchworm' => \&_inchworm,
25 'Inchworm on a Stick' => \&_inchworm_on_a_stick,
26 'Space Station' => \&_space_station,
27 'Goatse' => \&_goatse,
28 'Flaming X-Wing' => \&_flaming_x_wing,
29 'Kite' => \&_kite,
30 'Ornate Double Edged Sword' => \&_ornate_double_edged_sword,
31 'Flathead' => \&_flathead,
32 'Phillips' => \&_phillips,
33 'Torx' => \&_torx,
34 'Pozidriv' => \&_pozidriv,
35 'Winking Fat Comma' => \&_winking_fat_comma,
36 'Enterprise' => \&_enterprise,
37 'Key of Truth' => \&_key_of_truth,
38 'Abbott and Costello' => \&_abbott_and_costello,
39 );
40  
41 38 ▶sub default_severity {
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
42 38 return $Perl::Critic::Utils::SEVERITY_HIGHEST;
43 }
44  
45 1 ▶sub default_themes {
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
46 1 return qw( perlsecret );
47 }
48  
49 23 ▶sub applies_to {
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
50 23 return qw(
51 PPI::Statement
52 );
53 }
54  
55 25 ▶sub supported_parameters {
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
56 return (
57 25 { name => 'allow_secrets',
58 description => q<A list of perlsecrets to allow.>,
59 default_string => '',
60 },
61  
62 { name => 'disallow_secrets',
63 description =>
64 q<A list of perlsecrets to disallow (default: all perlsecrets).>,
65 default_string =>
66 'Venus, Baby Cart, Bang Bang, Inchworm, Inchworm on a Stick, '
67 . 'Space Station, Goatse, Flaming X-Wing, Kite, '
68 . 'Ornate Double Edged Sword, Flathead, Phillips, Torx, '
69 . 'Pozidriv, Winking Fat Comma, Enterprise, Key of Truth, '
70 . 'Abbott and Costello',
71 },
72 );
73 }
74  
75 4 my $SPLIT_RE = qr/\s*,\s*/;
76  
77 186 ▶sub read_config_list {
Subroutine read_config_list: called CC=1 SCAR=0.0
Pod undocumented
78 186 my ( $self, $str ) = @_;
79  
80 my @values = map {
81 186 ( my $new = $_ ) =~ s/^\s+|\s+$//;
82 1552 $new;
83 } split $SPLIT_RE, $str;
84  
85 186 return @values;
86 }
87  
88 93 ▶sub violates {
Subroutine violates: called CC=7 SCAR=19.5
Pod documented
89 93 my ( $self, $element, $doc ) = @_;
90  
91 93 my @disallowed = $self->read_config_list( $self->{'_disallow_secrets'} );
92  
93 @disallowed
94 93 ▶ or @disallowed = keys %default_violations;
Branch: 1 branch
BranchTrueFalseTotal
@disallowed or @disallowed = keys %default_violations 93 0 93
95  
96 93 my @allowed = $self->read_config_list( $self->{'_allow_secrets'} );
97  
98 93 my %violations;
99 93 foreach my $secret (@disallowed) {
100 1545 ▶ if ( !exists $default_violations{$secret} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $default_violations{$secret}) 1 1544 1545
101 1 croak("$secret is not a known secret");
102 }
103  
104 14 ▶ first { $secret eq $_ } @allowed
Subroutine __ANON__: called CC=1 SCAR=0.0
105 1544 ▶ and next;
Branch: 1 branch
BranchTrueFalseTotal
&first(sub { $secret eq $_; } , @allowed) and next 7 1537 1544
106  
107 1537 $violations{$secret} = $default_violations{$secret};
108 }
109  
110 92 for my $policy ( keys %violations ) {
111 1184 ▶ if ( $violations{$policy}->($element) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($violations{$policy}->($element)) 38 1146 1184
112 38 return $self->violation( $DESCRIPTION . " $policy ",
113 $EXPLANATION, $element );
114 }
115 }
116  
117 54 return; # No matches return i.e. no violations
118 }
119  
120 63 ▶sub _venus {
Subroutine _venus: called CC=6 SCAR=17.9
121 63 for my $child ( $_[0]->children ) {
122 293 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 238 55 293
123  
124 55 ▶ next unless $child eq '+';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "+" 52 3 55
125  
126 3 ▶ return 1 if $child->previous_sibling eq '0';
Branch: 1 branch
BranchTrueFalseTotal
if $child->previous_sibling eq 0 2 1 3
127 1 ▶ return 1 if $child->next_sibling eq '0';
Branch: 1 branch
BranchTrueFalseTotal
if $child->next_sibling eq 0 1 0 1
128 }
129 }
130  
131 72 ▶sub _baby_cart {
Subroutine _baby_cart: called CC=6 SCAR=17.9
132 72 for my $child ( $_[0]->children ) {
133 333 ▶ if ( ref($child) eq 'PPI::Token::Cast' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $child eq "PPI::Token::Cast") 3 330 333
134 3 ▶ return 1 if $child->snext_sibling =~ m/\{\s*?\[/;
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling =~ /\{\s*?\[/ 3 0 3
135 }
136 330 ▶ if ( ref($child) eq 'PPI::Token::Quote::Double' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $child eq "PPI::Token::Quote::Double") 4 326 330
137 4 ▶ return 1 if $child =~ m/@\{\s*?\[/;
Branch: 1 branch
BranchTrueFalseTotal
if $child =~ /\@\{\s*?\[/ 2 2 4
138 }
139  
140 }
141 }
142  
143 66 ▶sub _bang_bang {
Subroutine _bang_bang: called CC=5 SCAR=16.1
144 66 for my $child ( $_[0]->children ) {
145 305 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 248 57 305
146 57 ▶ return 1 if $child eq '!' && $child->snext_sibling eq '!';
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "!" and $child->snext_sibling eq "!" 5 52 57
Condition100%3/3
$child eq "!" and $child->snext_sibling eq "!"
!ll&&!rl&&r
4935
MC/DC100%2/2
$child eq "!" and $child->snext_sibling eq "!"
$child eq "!" $child->snext_sibling eq "!"
Truth table100%3/3
A and B
A= $child eq "!"B= $child->snext_sibling eq "!"
ABresult
0X0
100
111
147 }
148 }
149  
150 66 ▶sub _inchworm {
Subroutine _inchworm: called CC=6 SCAR=17.9
151 66 for my $child ( $_[0]->children ) {
152 328 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 263 65 328
153 65 ▶ return 1 if $child eq '~~';
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "~~" 2 63 65
154 63 ▶ return 1 if $child eq '~' && $child->snext_sibling eq '~';
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "~" and $child->snext_sibling eq "~" 1 62 63
Condition100%3/3
$child eq "~" and $child->snext_sibling eq "~"
!ll&&!rl&&r
6111
MC/DC100%2/2
$child eq "~" and $child->snext_sibling eq "~"
$child eq "~" $child->snext_sibling eq "~"
Truth table100%3/3
A and B
A= $child eq "~"B= $child->snext_sibling eq "~"
ABresult
0X0
100
111
155 }
156 }
157  
158 66 ▶sub _inchworm_on_a_stick {
Subroutine _inchworm_on_a_stick: called CC=7 SCAR=19.6
159 66 for my $child ( $_[0]->children ) {
160 302 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 245 57 302
161  
162 57 ▶ return 1 if $child eq '~' && $child->snext_sibling eq '-';
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "~" and $child->snext_sibling eq "-" 1 56 57
Condition66%2/3
$child eq "~" and $child->snext_sibling eq "-"
!ll&&!rl&&r
5601
MC/DC50%1/2
$child eq "~" and $child->snext_sibling eq "-"
$child eq "~" $child->snext_sibling eq "-"
Truth table66%2/3
A and B
A= $child eq "~"B= $child->snext_sibling eq "-"
ABresult
0X0
100
111
163 56 ▶ return 1 if $child eq '-' && $child->snext_sibling eq '~';
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "-" and $child->snext_sibling eq "~" 2 54 56
Condition66%2/3
$child eq "-" and $child->snext_sibling eq "~"
!ll&&!rl&&r
5402
MC/DC50%1/2
$child eq "-" and $child->snext_sibling eq "~"
$child eq "-" $child->snext_sibling eq "~"
Truth table66%2/3
A and B
A= $child eq "-"B= $child->snext_sibling eq "~"
ABresult
0X0
100
111
164 }
165 }
166  
167 62 ▶sub _space_station {
Subroutine _space_station: called CC=6 SCAR=17.9
168 62 for my $child ( $_[0]->children ) {
169 281 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 228 53 281
170  
171 53 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "-" and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "-" 2 51 53
Condition83%5/6
$child eq "-" and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "-"
!ll&&!rl&&r
5102
$child eq "-" and $child->snext_sibling eq "+"
!ll&&!rl&&r
4922
MC/DC66%2/3
$child eq "-" and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "-"
$child eq "-" $child->snext_sibling eq "+" $child->snext_sibling->snext_sibling eq "-"
Truth table75%3/4
A and B and C
A= $child eq "-"B= $child->snext_sibling eq "+"C= $child->snext_sibling->snext_sibling eq "-"
ABCresult
0XX0
10X0
1100
1111
172 if $child eq '-'
173 && $child->snext_sibling eq '+'
174 && $child->snext_sibling->snext_sibling eq '-';
175 }
176 }
177  
178 65 ▶sub _goatse {
Subroutine _goatse: called CC=5 SCAR=16.1
179 65 for my $child ( $_[0]->children ) {
180 315 ▶ next unless ref($child) eq 'PPI::Structure::List';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Structure::List" 298 17 315
181 17 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child->sprevious_sibling eq "=" and $child->snext_sibling eq "=" 3 14 17
Condition100%3/3
$child->sprevious_sibling eq "=" and $child->snext_sibling eq "="
!ll&&!rl&&r
863
MC/DC100%2/2
$child->sprevious_sibling eq "=" and $child->snext_sibling eq "="
$child->sprevious_sibling eq "=" $child->snext_sibling eq "="
Truth table100%3/3
A and B
A= $child->sprevious_sibling eq "="B= $child->snext_sibling eq "="
ABresult
0X0
100
111
182 if $child->sprevious_sibling eq '='
183 && $child->snext_sibling eq '=';
184 }
185 }
186  
187 66 ▶sub _flaming_x_wing {
Subroutine _flaming_x_wing: called CC=5 SCAR=17.4
188 66 for my $child ( $_[0]->children ) {
189  
190 341 ▶ next unless ref($child) eq 'PPI::Token::QuoteLike::Readline';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::QuoteLike::Readline" 339 2 341
191 2 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child->sprevious_sibling eq "=" and $child->snext_sibling eq "=~" 2 0 2
Condition33%1/3
$child->sprevious_sibling eq "=" and $child->snext_sibling eq "=~"
!ll&&!rl&&r
002
MC/DC0%0/2
$child->sprevious_sibling eq "=" and $child->snext_sibling eq "=~"
$child->sprevious_sibling eq "=" $child->snext_sibling eq "=~"
Truth table33%1/3
A and B
A= $child->sprevious_sibling eq "="B= $child->snext_sibling eq "=~"
ABresult
0X0
100
111
192 if $child->sprevious_sibling eq '='
193 && $child->snext_sibling eq '=~';
194 }
195 }
196  
197 63 ▶sub _kite {
Subroutine _kite: called CC=5 SCAR=16.5
198 63 for my $child ( $_[0]->children ) {
199 297 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 244 53 297
200 53 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "~~" and $child->snext_sibling eq "<>" 0 53 53
Condition66%2/3
$child eq "~~" and $child->snext_sibling eq "<>"
!ll&&!rl&&r
5210
MC/DC0%0/2
$child eq "~~" and $child->snext_sibling eq "<>"
$child eq "~~" $child->snext_sibling eq "<>"
Truth table66%2/3
A and B
A= $child eq "~~"B= $child->snext_sibling eq "<>"
ABresult
0X0
100
111
201 if $child eq '~~'
202 && $child->snext_sibling eq '<>';
203 }
204 }
205  
206 65 ▶sub _ornate_double_edged_sword {
Subroutine _ornate_double_edged_sword: called CC=5 SCAR=17.4
207 65 for my $child ( $_[0]->children ) {
208 334 ▶ next unless $child eq '<<m';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "<<m" 333 1 334
209 1 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "=~" and $child->snext_sibling->snext_sibling eq "m>>" 1 0 1
Condition33%1/3
$child->snext_sibling eq "=~" and $child->snext_sibling->snext_sibling eq "m>>"
!ll&&!rl&&r
001
MC/DC0%0/2
$child->snext_sibling eq "=~" and $child->snext_sibling->snext_sibling eq "m>>"
$child->snext_sibling eq "=~" $child->snext_sibling->snext_sibling eq "m>>"
Truth table33%1/3
A and B
A= $child->snext_sibling eq "=~"B= $child->snext_sibling->snext_sibling eq "m>>"
ABresult
0X0
100
111
210 if $child->snext_sibling eq '=~'
211 && $child->snext_sibling->snext_sibling eq 'm>>';
212 }
213 }
214  
215 65 ▶sub _flathead {
Subroutine _flathead: called CC=4 SCAR=14.0
216 65 for my $child ( $_[0]->children ) {
217 330 ▶ next unless $child eq '-=';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "-=" 328 2 330
218 2 ▶ return 1 if $child->snext_sibling eq '!';
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "!" 2 0 2
219 }
220 }
221  
222 69 ▶sub _phillips {
Subroutine _phillips: called CC=4 SCAR=14.0
223 69 for my $child ( $_[0]->children ) {
224 347 ▶ next unless $child eq '+=';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "+=" 345 2 347
225 2 ▶ return 1 if $child->snext_sibling eq '!';
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "!" 2 0 2
226 }
227 }
228  
229 64 ▶sub _torx {
Subroutine _torx: called CC=4 SCAR=14.0
230 64 for my $child ( $_[0]->children ) {
231 325 ▶ next unless $child eq '*=';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "*=" 324 1 325
232 1 ▶ return 1 if $child->snext_sibling eq '!';
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "!" 1 0 1
233 }
234 }
235  
236 68 ▶sub _pozidriv {
Subroutine _pozidriv: called CC=4 SCAR=14.0
237 68 for my $child ( $_[0]->children ) {
238 343 ▶ next unless $child eq 'x=';
Branch: 1 branch
BranchTrueFalseTotal
unless $child eq "x=" 341 2 343
239 2 ▶ return 1 if $child->snext_sibling eq '!';
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "!" 2 0 2
240 }
241 }
242  
243 64 ▶sub _winking_fat_comma {
Subroutine _winking_fat_comma: called CC=5 SCAR=16.1
244 64 for my $child ( $_[0]->children ) {
245 next
246 294 ▶ unless ref($child) eq 'PPI::Token::Operator'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" and $child eq "," 289 5 294
Condition100%3/3
ref $child eq "PPI::Token::Operator" and $child eq ","
!ll&&!rl&&r
241485
MC/DC100%2/2
ref $child eq "PPI::Token::Operator" and $child eq ","
ref $child eq "PPI::Token::Operator" $child eq ","
Truth table100%3/3
A and B
A= ref $child eq "PPI::Token::Operator"B= $child eq ","
ABresult
0X0
100
111
247 && $child eq ',';
248 5 ▶ return 1 if $child->snext_sibling eq '=>';
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "=>" 1 4 5
249 }
250 }
251  
252 67 ▶sub _enterprise {
Subroutine _enterprise: called CC=6 SCAR=18.1
253 67 for my $child ( $_[0]->children ) {
254 342 ▶ next unless $child->class eq 'PPI::Structure::List';
Branch: 1 branch
BranchTrueFalseTotal
unless $child->class eq "PPI::Structure::List" 326 16 342
255 16 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child->snext_sibling eq "x" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!" 1 15 16
Condition66%4/6
$child->snext_sibling eq "x" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!"
!ll&&!rl&&r
1501
$child->snext_sibling eq "x" and $child->snext_sibling->snext_sibling eq "!"
!ll&&!rl&&r
1501
MC/DC33%1/3
$child->snext_sibling eq "x" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!"
$child->snext_sibling eq "x" $child->snext_sibling->snext_sibling eq "!" $child->snext_sibling->snext_sibling->snext_sibling eq "!"
Truth table50%2/4
A and B and C
A= $child->snext_sibling eq "x"B= $child->snext_sibling->snext_sibling eq "!"C= $child->snext_sibling->snext_sibling->snext_sibling eq "!"
ABCresult
0XX0
10X0
1100
1111
256 if $child->snext_sibling eq 'x'
257 && $child->snext_sibling->snext_sibling eq '!'
258 && $child->snext_sibling->snext_sibling->snext_sibling eq '!';
259 }
260 }
261  
262 66 ▶sub _key_of_truth {
Subroutine _key_of_truth: called CC=7 SCAR=20.5
263 66 for my $child ( $_[0]->children ) {
264 318 ▶ next unless $child->class eq 'PPI::Token::Number';
Branch: 1 branch
BranchTrueFalseTotal
unless $child->class eq "PPI::Token::Number" 311 7 318
265 7 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child eq 0 and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!" 0 7 7
Condition66%6/9
$child eq 0 and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!"
!ll&&!rl&&r
700
$child eq 0 and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "!"
!ll&&!rl&&r
610
$child eq 0 and $child->snext_sibling eq "+"
!ll&&!rl&&r
511
MC/DC0%0/4
$child eq 0 and $child->snext_sibling eq "+" and $child->snext_sibling->snext_sibling eq "!" and $child->snext_sibling->snext_sibling->snext_sibling eq "!"
$child eq 0 $child->snext_sibling eq "+" $child->snext_sibling->snext_sibling eq "!" $child->snext_sibling->snext_sibling->snext_sibling eq "!"
Truth table60%3/5
A and B and C and D
A= $child eq 0B= $child->snext_sibling eq "+"C= $child->snext_sibling->snext_sibling eq "!"D= $child->snext_sibling->snext_sibling->snext_sibling eq "!"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
266 if $child eq '0'
267 && $child->snext_sibling eq '+'
268 && $child->snext_sibling->snext_sibling eq '!'
269 && $child->snext_sibling->snext_sibling->snext_sibling eq '!';
270 }
271 }
272  
273 67 ▶sub _abbott_and_costello {
Subroutine _abbott_and_costello: called CC=8 SCAR=20.9
274 67 for my $child ( $_[0]->children ) {
275 339 ▶ next unless ref($child) eq 'PPI::Token::Operator';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "PPI::Token::Operator" 274 65 339
276  
277 65 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $child eq "||" || $child eq "//" and $child->snext_sibling->class eq "PPI::Structure::List" and $child->snext_sibling->content eq "()" || $child->snext_sibling->content eq "( )" 2 63 65
Condition83%10/12
$child eq "||" || $child eq "//" and $child->snext_sibling->class eq "PPI::Structure::List" and $child->snext_sibling->content eq "()" || $child->snext_sibling->content eq "( )"
!ll&&!rl&&r
6212
$child eq "||" || $child eq "//" and $child->snext_sibling->class eq "PPI::Structure::List"
!ll&&!rl&&r
6203
$child eq "||" or $child eq "//"
l!l&&r!l&&!r
2162
$child->snext_sibling->content eq "()" or $child->snext_sibling->content eq "( )"
l!l&&r!l&&!r
201
MC/DC60%3/5
$child eq "||" || $child eq "//" and $child->snext_sibling->class eq "PPI::Structure::List" and $child->snext_sibling->content eq "()" || $child->snext_sibling->content eq "( )"
$child eq "||" $child eq "//" $child->snext_sibling->class eq "PPI::Structure::List" $child->snext_sibling->content eq "()" $child->snext_sibling->content eq "( )"
Truth table44%4/9
A or B and C and D or E
A= $child eq "||"B= $child eq "//"C= $child->snext_sibling->class eq "PPI::Structure::List"D= $child->snext_sibling->content eq "()"E= $child->snext_sibling->content eq "( )"
ABCDEresult
00XXX0
1X0XX0
010XX0
1X1000
011000
1X11X1
1X1011
0111X1
011011
278 if ( $child eq '||' || $child eq '//' )
279 && $child->snext_sibling->class eq 'PPI::Structure::List'
280 && ( $child->snext_sibling->content eq '()'
281 || $child->snext_sibling->content eq '( )' );
282  
283 }
284 }
285  
286 4 1;
287  
288 __END__
↑ Summary