Branch Coverage

File:blib/lib/App/Test/Generator/SchemaExtractor.pm
Coverage:76.2%

line%coveragebranch
135750TFunless exists $params->{'input_file'}
1373100TFunless (-f $self->{'input_file'})
146450TFunless my $document = "PPI::Document"->new($self->{'input_file'})
1486100TFunless $params->{'no_write'}
1517100TFunless (defined $document)
1521100TFif (@$pkgs == 0)
152350TF$package_stmt ? :
152550TFif @$pkgs > 1
157550TFunless defined $name
1576100TFif $name =~ /^(BEGIN|END|DESTROY|AUTOLOAD|CHECK|INIT|UNITCHECK)$/
157750TFif $name =~ /::/
1580100TFif ($name =~ /^_/ and not $name =~ /^_(new|init|build)/)
1581100TFunless $self->{'include_private'}
1598100TFif ($content =~ /\bclass\b/)
16120TFif ($content =~ /^\s*(before|after|around)\s+['"]?(\w+)['"]?\b/)
16220TFif ($next_sib and $next_sib->isa("PPI::Statement::Sub"))
1642100TFif ($seen{$n}++) { }
169650TFunless defined $extracted
171050TFif ($method_name =~ /^_/ and not $method_name =~ /^_(new|init|build)/)
17110TFunless $self->{'include_private'}
1776100TFif ($current->isa('PPI::Token::Pod')) { }
100TFelsif ($current->isa('PPI::Token::Comment')) { }
100TFelsif ($current->isa('PPI::Token::Whitespace') or $current->isa('PPI::Token::Separator')) { }
100TFelsif ($current->isa('PPI::Statement::Include')) { }
178250TFif ($comment =~ /#\s*(?:param|arg|input)\s+\$(\w+)\s*:\s*(.+)/i)
184850TFif ($method->{'fields'} and keys %{$$method{"fields"};})
1871100TFif ($self->{'strict_pod'} and $pod)
1882100TFif (@validation_errors)
1890100TFif ($self->{'strict_pod'} == $STRICT_POD_FATAL) { }
1903100TFif ($validator_params) { }
19140TFunless $pod_params->{$name}{'_from_input_spec'}
19170TFif defined $pod_p->{'optional'}
19180TFif defined $pod_p->{'memberof'}
19190TFif defined $pod_p->{'matches'}
19200TFif defined $pod_p->{'type'}
19210TFif defined $pod_p->{'min'}
19220TFif defined $pod_p->{'max'}
1926100TFif (keys %$fields)
1954100TFif ($method->{'name'} ne "new" and $needs_object)
196150TFunless (ref $input_confidence)
198250TFif ($input_confidence->{'per_parameter'})
2001100TF$level_rank{$input_level} < $level_rank{$output_level} ? :
2007100TFif ($relationships and @{$relationships;})
2013100TFif keys %$attributes
2014100TFif keys %$postfix_derefs
2015100TFif keys %$fields
2018100TFif ($method->{'class'})
202850TFdefined $_ ? :
2036100TFif ($self->_method_has_numeric_intent($schema))
20420TFdefined $_ ? :
2046100TFdefined $v ? :
204750TFunless $seen{$key}++
205350TFif (keys %$hints)
2057100TFunless exists $schema->{'_yamltest_hints'}{$k}
2061100TFif ($level_rank{$overall} < $level_rank{$LEVEL_MEDIUM} and $level_rank{$overall} < $self->{'confidence_threshold'} * 4)
207950TFif ($schema->{'output'})
2148100TFif $schema->{'output'} and $schema->{'output'}{'type'} and $schema->{'output'}{'type'} =~ /^(number|integer)$/
2151100TFunless $schema->{'input'}
2152100TFif $p->{'optional'}
2153100TFif $p->{'type'} and $p->{'type'} =~ /^(number|integer)$/
2224100TFif (keys %fields_seen > 1)
223250TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*shift\s*;/ and $code =~ /return\s+\$self\s*->\s*\{\s*['"]?\Q$1\E['"]?\s*\}\s*;/ and $code =~ /if\s*\(\s*\@_/) { }
100TFelsif ($code =~ /if\s*\(\s*(?:\@_|[\$]\w+)/ and $code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*(?:shift|\@_|\$_\[\d+\]|\$\w+)\b/x and $code =~ /return\b/) { }
100TFelsif ($code =~ /return\s+\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*;/) { }
100TFelsif ($code =~ /return\s+\$self\b/ and $code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*\$(\w+)\s*;/) { }
22400TFunless (defined $property)
22410TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*shift\s*;/)
22610TFif (my $pod = $method->{'pod'})
22620TFif ($pod =~ /\b(LWP::UserAgent(?:::\w+)*)\b/)
228950TFunless (defined $property)
229050TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=/)
2294100TFif ($code =~ /validate_strict/) { }
230050TFif ($code =~ /blessed\s*\(\s*\$(\w+)\s*\)/) { }
2329100TFif (my $pod = $method->{'pod'})
233050TFif ($pod =~ /\b(LWP::UserAgent(?:::\w+)*)\b/)
235450TFif (ref $schema->{'input'} eq "HASH")
235650TFif (scalar @input_keys > 1) { }
50TFelsif (@input_keys == 1) { }
2377100TFunless ($code =~ /\$self\s*->\s*\{\s*['"]?\Q$property\E['"]?\s*\}\s*=\s*(?:shift|\$\w+\s*=\s*shift|\@_|\$_\[\d+\])/)
2381100TFif (scalar @returns == scalar @self_returns)
2423100TFif ($schema->{'output'}{'_returns_self'}) { }
50TFelsif (scalar keys %{$$schema{'output'};} != 0) { }
242450TFif ($schema->{'output'}{'type'} ne "object")
242750TFif ($schema->{'output'}{'isa'} ne $self->{'_package_name'})
2438100TFif (exists $schema->{'accessor'})
243950TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'type'} =~ /setter|getset/ and $schema->{'input'})
2443100TFif ($in->{'type'} and $in->{'type'} eq "object")
244650TF$in->{'isa'} ? :
2457100TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'property'} and $schema->{'accessor'}{'type'} =~ /getter|getset/ and !defined($schema->{'output'}{'type'}) || $schema->{'output'}{'type'} eq 'string')
2459100TFif (my $pod = $method->{'pod'})
2461100TFif ($pod =~ /\bUser[- ]?Agent\b.*\bobject\b/i)
253650TFunless $res->{'input'}
50TFif $res and ref $res eq "HASH" and keys %{{} unless $res->{'input'};}
257050TFif ($child->isa("PPI::Statement") or $child->isa("PPI::Statement::Expression"))
25790TFif ($tokens[$i]->isa('PPI::Token::Word') || $tokens[$i]->isa('PPI::Token::Quote') and $tokens[$i + 1]->isa("PPI::Structure::Constructor"))
25880TFunless $key and $val
25920TFunless $inner->isa("PPI::Statement") or $inner->isa("PPI::Statement::Expression")
25990TFunless $k and $v
26020TF$v->can('content') ? :
26030TFif defined $value
26050TFif ($keyname eq 'type') { }
0TFelsif ($keyname eq 'optional') { }
0TFelsif ($keyname =~ /^(min|max)$/ and &looks_like_number($value)) { }
0TFelsif ($keyname eq 'matches') { }
26080TF$value ? :
2658100TFif ref $code and $code->can("find")
2684100TFunless $code =~ /\bvalidate_strict\s*\(/
268650TFunless my $doc = $self->_ppi($code)
2689100TFif $_[1]->isa("PPI::Token::Word")
269050TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validate_strict" or $_[1]->content eq "Params::Validate::Strict::validate_strict" if $_[1]->isa("PPI::Token::Word"); } )
269750TFunless (defined $list)
269950TFunless defined $next
2700100TFif ($next->content =~ /schema\s*=>\s*(\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})/s)
270250TFif $schema_text =~ /$UNSAFE_KEYWORD_RE/
270850TFif (scalar keys %{$schema;})
271750TFunless $list
27210TFunless $schema_block
27240TFif $schema
2749100TFunless $code =~ /\bvalidate\s*\(/
275150TFunless my $doc = $self->_ppi($code)
2754100TFif $_[1]->isa("PPI::Token::Word")
275550TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validate" or $_[1]->content eq "Params::Validate::validate" if $_[1]->isa("PPI::Token::Word"); } )
276250TFunless (defined $list)
276650TFif ($schema_text and not $schema_text =~ /$UNSAFE_KEYWORD_RE/)
2773100TFif (scalar keys %{$schema;})
277650TFif (my $type = $field->{'type'})
2777100TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
279450TFunless $list
27980TFunless $schema_block
28010TFif $schema
2842100TFif (substr($rest, 0, 1) eq "{")
284650TFunless defined $extracted
2850100TFif (substr($rest, 0, 1) eq ",")
2858100TFunless $found_comma
2891100TFunless $code =~ /\bvalidated_hash\s*\(/
289350TFunless my $doc = $self->_ppi($code)
2896100TFif $_[1]->isa("PPI::Token::Word")
289750TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validated_hash" if $_[1]->isa("PPI::Token::Word"); } )
290450TFunless (defined $list)
290850TFif ($schema_text and not $schema_text =~ /$UNSAFE_KEYWORD_RE/)
291650TFif (scalar keys %{$schema;})
291950TFif (my $isa = delete $field->{'isa'})
2922100TFif (exists $field->{'required'}) { }
2924100TF$required ? :
2928100TFif (ref $field->{'default'} eq "CODE")
293550TFif (my $type = $field->{'type'})
293650TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
29530TFunless $list
29570TFunless $schema_block
29600TFif $schema
298950TFunless $block and $block->can("children")
29930TFunless $result and ref $result eq "HASH" and $result->{'input'}
3030100TFexists $spec->{'optional'} ? :
3065100TFunless my $function = $self->_extract_function_name($code)
3067100TFunless my $doc = $self->{'_document'}
3068100TFunless my $stmt = $self->_find_signature_statement($doc, $function)
307050TFunless my $signature_expr = $self->_extract_signature_expression($stmt, $function)
3072100TFunless my $meta = $self->_compile_signature_isolated($function, $signature_expr)
3094100TFif $code =~ /^\s*sub\s+([a-zA-Z0-9_]+)/
3118100TFif $_[1]->isa("PPI::Statement")
3120100TFunless my $statements = $doc->find(sub {         $_[1]->content =~ /^\s*signature_for\b/ if $_[1]->isa("PPI::Statement"); } )
312450TFif ($content =~ /^\s*signature_for\s+\Q$function\E\b/)
3154100TFif ($content =~ /^\s*signature_for\s+\Q$function\E\s*=>\s*(.+?);?\s*$/s)
3221100TFunless ($self->{'allow_signature_exec'})
322550TFif $self->{'verbose'}
323950TFif ($signature_expr =~ /$UNSAFE_KEYWORD_RE/ or $signature_expr =~ /$UNSAFE_CHAR_RE/)
3347100TFif ($stderr and length $stderr)
334850TFif $self->{'verbose'}
3355100TFunless (defined $stdout and length $stdout)
335650TFif $self->{'verbose'}
336150TFif ($@)
336250TFif $self->{'verbose'}
341050TFunless $meta->{'parameters'}
3413100TFunless (exists $type_map{$p->{'type'}})
3421100TF$p->{'optional'} ? :
3429100TFif (my $ret = $meta->{'returns'})
343250TFunless (exists $type_map{$ret->{'type'}})
3489100TFunless $pod
3496100TFif ($pod =~ /=head2\s+\w+\s*\(([^)]+)\)/s)
350250TFif @sig_params and $sig_params[0] =~ /^(self|class)$/i
3517100TFif ($pod =~ /(?:Parameters?|Arguments?|Inputs?):?\s*\n((?:\s*\$.*\n)+)/is) { }
100TFelsif ($pod =~ /^=head\d+\s+(?:Parameters?|Arguments?|Inputs?)\b.*?\n(.*?)(?=^=head|\Z)/ism) { }
3522100TFif ($param_section)
352850TFif ($line =~ /C<\$(\w+)>\s*\((Required|Mandatory)\)/i)
3536100TFif ($line =~ /^\s*\$(\w+)\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i or $line =~ /^\s*C<\$(\w+)>\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i)
3541100TFif $desc
3544100TFif $name =~ /^(self|class|return|returns?)$/i
3549100TFunless (exists $params{$name}{'position'})
355550TFif $type eq "int"
355650TFif $type eq "num" or $type eq "float"
355750TFif $type eq "bool"
355850TFif $type eq "array"
355950TFif $type eq "hash"
3564100TFif ($constraint)
3571100TFif ($full_text =~ /\boptional\b/i) { }
100TFelsif ($full_text =~ /required|mandatory/i) { }
3580100TFif ($desc =~ /\b(email|url|uri|path|filename)\b/i)
3587100TFif ($desc and $desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
3591100TF$constraint ? :
100TF$desc ? :
3603100TFif exists $params{$name}
360650TFif $desc
3609100TFif $name =~ /^(self|class|return|returns?)$/i
361450TFif $type eq "int"
361550TFif $type eq "num" or $type eq "float"
361650TFif $type eq "bool"
361750TFif $type eq "array"
361850TFif $type eq "hash"
362350TFif ($constraint)
362950TFif ($desc)
363050TFif ($desc =~ /\boptional\b/i) { }
50TFelsif ($desc =~ /required|mandatory/i) { }
363750TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
364250TF$constraint ? :
365250TFunless defined $name and length $name
365750TFif $name =~ /^(self|class|return|returns?)$/i
3663100TFif ($desc =~ /^\s*(string|integer|int|number|num|float|boolean|bool|array|arrayref|hash|hashref|any)\b(?:\s*\(([^)]+)\))?/i) { }
366850TFif $type eq "int"
366950TFif $type eq "num" or $type eq "float"
367050TFif $type eq "bool"
367150TFif $type eq "array"
367250TFif $type eq "hash"
3676100TFif ($constraint)
368350TFif ($desc =~ /\bstring\b/i) { }
50TFelsif ($desc =~ /\b(int|integer)\b/i) { }
50TFelsif ($desc =~ /\b(num|number|float)\b/i) { }
50TFelsif ($desc =~ /\b(bool|boolean)\b/i) { }
3696100TFif ($desc =~ /\boptional\b/i) { }
100TFelsif ($desc =~ /required|mandatory/i) { }
370350TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
371350TFif (exists $params{$param})
3715100TFunless defined $params{$param}{'optional'}
3718100TFdefined $pod_defaults->{$param} ? :
372550TFif $name =~ /^(self|class)$/i
3739100TFif ($pod =~ /=head[34]\s+Input\b(.*?)(?==head|\z)/is)
3743100TFif ($block =~ /\A\[/) { }
100TFelsif ($block =~ /\A\{/) { }
3750100TFif (defined $name)
375250TFif (my $t = $self->_map_formal_input_type($spec))
375650TFif ($spec =~ /\boptional\s*=>\s*(0|1)/i)
3766100TFif $name =~ /^(self|class)$/i
376950TFif (my $t = $self->_map_formal_input_type($spec))
3773100TFif ($spec =~ /\boptional\s*=>\s*(0|1)/i)
377650TFif ($spec =~ /\bmemberof\s*=>\s*\[([^\]]*)\]/i)
37820TFif @vals
3784100TFif ($spec =~ /\bmin\s*=>\s*(\d+)/i)
3787100TFif ($spec =~ /\bmax\s*=>\s*(\d+)/i)
379050TFif ($spec =~ /\bisa\s*=>\s*['"]([^'"]+)['"]/i)
3825100TFunless $spec =~ /\btype\s*=>\s*(?:['"]([^'"]+)['"]|([A-Z_]+))/i
3826100TFdefined $1 ? :
3852100TFif exists $map{$t}
3896100TFif keys %output
3899100TFkeys %output ? :
3930100TFif ($pod)
3936100TFif ($pod =~ /=head4\s+Output\b(.*?)(?==head|\z)/is)
3939100TFif ($block =~ /^\(/) { }
50TFelsif ($block =~ /^\[/) { }
100TFelsif ($block =~ /^\{/) { }
39430TFunless ($block =~ /^\[\s*\]/)
394850TFif ($block =~ /type\s*=>\s*['"]?(\w[\w:]*?)['"]?\s*[,}]/i) { }
0TFelsif ($block =~ /\bisa\s*=>/) { }
395050TFif $type eq "hash"
395150TFif $type eq "array"
3952100TFif ($VALID_OUTPUT_TYPES{$type}) { }
50TFelsif ($block =~ /\bisa\s*=>/) { }
3968100TFif ($pod =~ /Returns?:\s+([^\n]+(?:\n[^\n]+){0,2})/is)
3975100TFif (not $output->{'type'} and $returns_desc =~ /\b(string|text)\b/i) { }
100TFelsif (not $output->{'type'} and $returns_desc =~ /\b(integer|int|count)\b/i) { }
50TFelsif (not $output->{'type'} and $returns_desc =~ /\b(float|decimal|number)\b/i) { }
100TFelsif (not $output->{'type'} and $returns_desc =~ /\b(boolean|true|false)\b/i) { }
50TFelsif (not $output->{'type'} and $returns_desc =~ /\b(array|list)\b/i) { }
50TFelsif (not $output->{'type'} and $returns_desc =~ /\b(hash|hashref|dictionary)\b/i) { }
100TFelsif (not $output->{'type'} and $returns_desc =~ /\b(object|instance)\b/i) { }
50TFelsif (not $output->{'type'} and $returns_desc =~ /\bundef\b/i) { }
3994100TFif ($returns_desc =~ /\b1\s+(?:on\s+success|if\s+successful)\b/i) { }
50TFelsif ($returns_desc =~ /\b0\s+(?:on\s+failure|if\s+fail)\b/i) { }
50TFelsif ($returns_desc =~ /dies\s+on\s+(?:error|failure)/i) { }
399650TFif (defined $output->{'type'} and $output->{'type'} eq 'scalar') { }
4008100TFif ($returns_desc =~ /\b(true|false)\b/i)
401150TFif ($returns_desc =~ /\bundef\b/i)
4017100TFif (not $output->{'type'} and $pod =~ /returns?\s+(?:an?\s+)?(\w+)/i)
4020100TFif $type =~ /^(true|false|bool)$/
402250TFif $type eq "int"
402350TFif $type =~ /^(num|float)$/
402450TFif $type eq "array"
402550TFif $type eq "hash"
4027100TFif ($type =~ /^\d+$/)
402850TFif ($type eq '1' or $type eq '0') { }
403050TFif ($pod =~ /1 on success.+0 (on|if) /i) { }
50TFelsif ($pod =~ /return 0 .+ 1 on success/) { }
404250TFif not $type and $pod =~ /returns?\s+.+\slist\b/i
4044100TFif ($VALID_OUTPUT_TYPES{$type}) { }
4082100TFunless $pod
409550TFif @param_matches
409750TFif ($param)
409950TFif ($default_text =~ /(\w+)\s*=\s*(.+)$/) { }
411950TFif (@param_matches)
415750TFif ($code)
4160100TFif (@all_returns)
4167100TFif $ret =~ /^(?:0|1)(?:\s|$)/
4171100TFif ($boolean_count >= 2 and $boolean_count >= $total_count * "0.8")
417250TFunless ($output->{'type'})
4181100TFif ($code =~ /return\s+bless\s*\{[^}]*\}\s*,\s*['"]?(\w+)['"]?/s) { }
100TFelsif ($code =~ /return\s+bless/s) { }
100TFelsif ($code =~ /return\s*\(\s*[^)]+\s*,\s*[^)]+\s*\)\s*;/) { }
50TFelsif ($code =~ /return\s+bless[^,]+,\s*__PACKAGE__/) { }
100TFelsif ($code =~ /return\s*\(([^)]+)\)/) { }
100TFelsif ($code =~ /return\s+\$self\s*;/ and $code =~ /\$self\s*->\s*\{[^}]+\}\s*=/) { }
418450TFif ($method_name eq 'new') { }
41860TFif ($self->{'_document'} and my $package_stmt = $self->{'_document'}->find_first("PPI::Statement::Package"))
4196100TFif ($method_name eq 'new') { }
42100TFif ($self->{'_document'})
42120TF$pkg ? :
421850TFif ($content =~ /,/)
422450TFif ($self->{'_document'})
422650TF$pkg ? :
4238100TFif (@return_statements) { }
4244100TFif ($output->{'type'})
4252100TFif ($ret eq '1' or $ret eq '0') { }
100TFelsif ($ret =~ /^['"]/) { }
100TFelsif ($ret =~ /^-?\d+$/) { }
50TFelsif ($ret =~ /^-?\d+\.\d+$/) { }
100TFelsif ($ret eq 'undef') { }
50TFelsif ($ret =~ /^\[/) { }
100TFelsif ($ret =~ /^\{/) { }
100TFelsif ($ret =~ m[                                    # Numeric expressions (heuristic, medium confidence)                                    # Don't match ->                                (?:                                    \+ | -\b | \* | / | %                                  | \+\+ | --                                )                            ]x) { }
50TFelsif ($ret =~ /\|\|\s*\d+\b/) { }
50TFelsif ($ret =~ /^length[\s\(]/) { }
50TFelsif ($ret =~ /^pos[\s\(]/) { }
50TFelsif ($ret =~ /^index[\s\(]/) { }
50TFelsif ($ret =~ /^rindex[\s\(]/) { }
50TFelsif ($ret =~ /^ord[\s\(]/) { }
100TFelsif ($ret =~ /=/ and $ret =~ /\$\w+/) { }
100TFelsif ($ret =~ /\$\w+/) { }
429750TFif ($ret =~ /\b\d+\b/) { }
430650TFif ($ret =~ /\\\@/) { }
50TFelsif ($ret =~ /\\\%/) { }
100TFelsif ($ret =~ /bless/) { }
50TFelsif ($ret =~ /^\{[^}]*\}$/) { }
50TFelsif ($ret =~ /^\[[^\]]*\]$/) { }
4323100TFif (keys %return_types)
4326100TFif ($return_types{'integer'} and not $return_types{'string'})
4327100TFif (not $output->{'type'} or $output->{'type'} eq "scalar")
433150TFif (defined $min)
4336100TFunless ($output->{'type'})
4340100TFif ($most_common eq "number")
434250TFif (defined $min)
4352100TFif (@return_statements == 1 and $return_statements[0] eq 1)
435450TFif not $output->{'type'} or $output->{'type'} eq "scalar"
435550TFif $output->{'type'}
4396100TFunless not $output->{'type'} or $output->{'type'} eq "unknown"
4399100TFif ($pod and not $output->{'type'})
440150TFif ($pod =~ /returns?\s+(?:true|false|1|0)\s+(?:on|for|upon)\s+(?:success|failure|error|valid|invalid)/i)
440750TFif ($pod =~ /(?:method|sub)\s+(\w+)/)
44090TFif ($inferred_method_name =~ /^(is_|has_|can_|should_|contains_|exists_)/)
441750TFif ($code)
442250TFif ($true_returns + $false_returns >= 2) { }
100TFelsif ($true_returns + $false_returns == 1) { }
443150TFif ($code =~ /return\s+(?:\w+\s*[!=]=\s*\w+|\w+\s*>\s*\w+|\w+\s*<\s*\w+)\s*\?\s*(?:1|0)\s*:\s*(?:1|0)/)
443750TFif ($code =~ /return\s+[!\$\@\%]/)
444550TFif ($method_name)
4446100TFif ($method_name =~ /^(?:is_|has_|can_|should_|contains_|exists_|check_|verify_|validate_)/)
445050TFif ($method_name =~ /_ok$/)
4458100TFif ($boolean_score >= $BOOLEAN_SCORE_THRESHOLD)
445950TFif (not $output->{'type'} or $output->{'type'} eq "scalar" or $output->{'type'} eq "array" or $output->{'type'} eq "undef")
448950TFunless $code
4492100TFif ($code =~ /wantarray/)
4497100TFif ($code =~ /(wantarray[^;]+;)/s)
4501100TFif ($code =~ /wantarray\s*\?\s*\(([^)]+)\)\s*:\s*([^;]+)/s) { }
100TFelsif ($code =~ /wantarray\s*\?\s*([^:]+?)\s*:\s*([^;]+)/s) { }
50TFelsif ($code =~ /return[^;]*unless\s+wantarray.*?return\s*\(([^)]+)\)/s) { }
4530100TFif ($code =~ /return\s*\(\s*([^)]+)\s*\)\s*;/)
4539100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
454150TFunless defined $extracted
4544100TFif substr($rest, 0, 1) eq ","
4548100TFif ($comma_count > 0 and not $content =~ /\b(?:bless|new)\b/)
455050TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
458350TFunless $code
4597100TFif ($method_name =~ /$void_patterns->{$type}/)
4617100TFif $ret eq ""
4618100TFif $ret =~ /^(if|unless)\s/
4619100TFif $ret eq 1
4620100TFif $ret eq "\$self"
4621100TFif ($ret =~ /\?\s*1\s*:\s*0\b/)
4634100TFif ($no_value_returns > 0 and $no_value_returns == $total_returns) { }
100TFelsif ($true_returns > 0 and $true_returns == $total_returns and $total_returns >= 1) { }
4642100TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
467250TFunless $code
4682100TFif $ret eq "\$self"
4686100TFif ($self_returns > 0 and $total_returns > 0)
4689100TFif ($ratio >= "0.8")
4694100TFif ($self->{'_document'})
469650TF$pkg ? :
473050TFunless $code
4749100TFif ($code =~ /return\s*\(\s*\)\s*(?:if|unless|;)/)
4759100TFif ($1 eq '0') { }
4766100TFif ($zero_returns > 0 and $one_returns > 0)
4772100TFif ($code =~ /eval\s*\{/)
477450TFif ($code =~ /eval\s*\{.*?\}[^}]*(?:if\s*\(\s*\$\@|catch|return\s+undef)/s)
478550TFif ($has_undef and $has_value and scalar @all_returns >= 2)
4791100TFif (scalar keys %error_patterns) { }
4795100TFif ($error_patterns{'undef_on_error'}) { }
100TFelsif ($error_patterns{'implicit_undef'}) { }
100TFelsif ($error_patterns{'empty_list'}) { }
100TFelsif ($error_patterns{'zero_on_error'}) { }
4809100TFif ($error_patterns{'exception_handling'})
4841100TFunless defined $expr
4846100TFif ($expr =~ /,/)
4851100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
485350TFunless defined $extracted
4856100TFif substr($rest, 0, 1) eq ","
4860100TFif ($comma_count > 0)
4866100TFif ($expr =~ /^\@\w+/ or $expr =~ /^qw\(/ or $expr =~ /^\@\{/)
4871100TFif ($expr =~ /scalar\s*\(/)
4876100TFif ($expr =~ /^\[/ or $expr =~ /^\\\@/)
4881100TFif ($expr =~ /^\{/ or $expr =~ /^\\\%/)
488650TFif ($expr =~ /^\%\w+/ or $expr =~ /^\%\{/)
4891100TFif ($expr =~ /^['"]/ or $expr =~ /['"]$/)
4897100TFif ($expr =~ /^[01]$/)
4902100TFif ($expr =~ /^-?\d+$/)
4906100TFif ($expr =~ /^-?\d+\.\d+$/)
491150TFif ($expr =~ /bless/)
4915100TFif ($expr =~ /\blength\s*\(/)
4943100TFunless $pod
4946100TFif ($pod =~ /returns?\s+(?:\$)?self\b/i or $pod =~ /chainable/i or $pod =~ /fluent\s+interface/i or $pod =~ /method\s+chaining/i)
4978100TFif (defined $output->{'type'} and $output->{'type'} eq "boolean" and not defined $output->{'value'})
498150TFif ($output->{'value'} and defined $output->{'type'} and $output->{'type'} ne "boolean")
4985100TFif (exists $output->{'type'})
4986100TFif (not $valid_types{$output->{'type'}})
5018100TFif ($constraint =~ /(\d+)\s*-\s*(\d+)/) { }
100TFelsif ($constraint =~ /(\d+)\s*\.\.\s*(\d+)/) { }
100TFelsif ($constraint =~ /(?:min|minimum|at least)\s*(\d+)/i) { }
100TFelsif ($constraint =~ /(?:max|maximum|up to)\s*(\d+)/i) { }
100TFelsif ($constraint =~ /positive/i) { }
100TFelsif ($constraint =~ /non-negative/i) { }
100TFelsif ($constraint =~ /^(\S+)\s+(.+)$/) { }
5037100TFif $param->{'type'} and $param->{'type'} eq "integer"
5038100TFif $param->{'type'} and $param->{'type'} eq "number"
504550TFif (&looks_like_number($val))
50460TFif ($op eq '<') { }
0TFelsif ($op eq '<=') { }
0TFelsif ($op eq '>') { }
0TFelsif ($op eq '>=') { }
5058100TFif (defined $param->{'max'})
5061100TFif (defined $param->{'min'})
5109100TFif ($code =~ /Params::Get/)
511350TFif $name =~ /^(self|class)$/i
5123100TFif ($params{$param}{'_default'} and not $params{$param}{'type'})
5125100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
513550TFif ($code =~ /(?:croak|die)\(.*\)\s+if\s*\(\s*scalar\(\@_\)\s*<\s*(\d+)\s*\)/s) { }
50TFelsif ($code =~ /(?:croak|die)\(.*\)\s+if\s*\(\s*scalar\(\@_\)\s*==\s*0\s*\)/s) { }
515150TFif ($param_count++ > $self->{'max_parameters'})
5164100TFif ($code =~ /defined\s*\(\s*\$$param\s*\)/)
5170100TFif ($code =~ m[\s*\$$param\s*(?://|\|\|)=]) { }
100TFelsif ($code =~ m[\s*\$$param\s*(?:[\+\-\*\%]|/(?!/)|(?:\+\+)|(?:--)|(?:[\+\-\*\%]=|/(?!/)=)|\+\$|\$[+-])]) { }
50TFelsif ($code =~ /\$\b$param\b\s*(?:\+0|\*1)/) { }
519050TFif ($code =~ /if\s*\(\s*!\s*defined\s*\(\s*\$$param\s*\)\s*\)\s*\{([^}]+)\}/s)
51920TFif ($block =~ /\b(croak|die|confess)\b/)
519950TFif ($code =~ /\b(croak|die|confess)\b[^;]*\bunless\s+defined\s*\(\s*\$$param\s*\)/)
520550TFif ($code =~ /exists\s*\(\s*\$$param\s*\)/)
521150TFif ($code =~ /scalar\s*\(\s*\@?\$$param\s*\)/)
5248100TFif ($code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"](ARRAY|HASH|SCALAR)['"]/gi) { }
100TFelsif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]([^'"]+)['"]\s*\)/i) { }
100TFelsif ($code =~ /bless\s+.*\$$param/) { }
525050TF$reftype eq 'hash' ? :
100TF$reftype eq 'array' ? :
5267100TFunless ($p->{'type'})
526850TFif ($code =~ /\@\{\s*\$$param\s*\}/ or $code =~ /push\s*\(\s*\@?\$$param/) { }
100TFelsif ($code =~ /\%\{\s*\$$param\s*\}/ or $code =~ /\$$param\s*->\s*\{/) { }
5276100TFif (not $p->{'type'} and exists $p->{'_default'})
527850TFif (ref $default eq 'HASH') { }
50TFelsif (ref $default eq 'ARRAY') { }
5290100TFif (not $p->{'type'})
5297100TFif ($code =~ /\blooks_like_number\s*\(\s*\$$param\s*\)/) { }
100TFelsif ($code =~ m[\$$param\s*(?:[\+\-\*\%]|/(?!/))] or $code =~ m[(?:[\+\-\*\%]|/(?!/))\s*\$$param] or $code =~ /\bint\s*\(\s*\$$param\s*\)/ or $code =~ /\babs\s*\(\s*\$$param\s*\)/) { }
100TFelsif ($code =~ /\$$param\s*(?:==|!=|<=|>=|<|>)/ or $code =~ /(?:==|!=|<=|>=|<|>)\s*\$$param/) { }
539650TFunless defined $param and $param =~ /^\w+$/
5399100TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]DateTime['"]\s*\)/i)
5408100TFif ($code =~ /\$$param\s*->\s*(ymd|dmy|mdy|hms|iso8601|epoch|strftime)/)
541750TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]Time::Piece['"]\s*\)/i or $code =~ /\$$param\s*->\s*(strftime|epoch|year|mon|mday)/)
5427100TFif ($code =~ m[\$$param\s*=~\s*/.*?\\d\{4\}.*?\\d\{2\}.*?\\d\{2\}])
5436100TFif ($code =~ m[\$$param\s*=~\s*/.*?[Tt].*?[Zz].*?/])
544550TFif ($code =~ /\$$param\s*>\s*\d{9,}/ or $code =~ /time\(\s*\)\s*-\s*\$$param/ or $code =~ /\$$param\s*-\s*time\(\s*\)/)
545650TFif ($code =~ /strptime\s*\(\s*\$$param/ or $code =~ /DateTime::Format::\w+\s*->\s*parse_datetime\s*\(\s*\$$param/)
548950TFunless defined $param and $param =~ /^\w+$/
5492100TFif ($code =~ /(?:open|close|read|print|say|sysread|syswrite)\s*\(?\s*\$$param/)
5501100TFif ($code =~ /\$$param\s*->\s*(readline|getline|print|say|close|flush|autoflush)/)
5510100TFif ($code =~ /(?:-[frwxoOeszlpSbctugkTBMAC])\s+\$$param/)
551850TFif ($code =~ /File::(?:Spec|Basename)::\w+\s*\(\s*\$$param/ or $code =~ /(?:basename|dirname|fileparse)\s*\(\s*\$$param/)
552850TFif (defined $p->{'_default'} and $p->{'_default'} =~ m[^([A-Za-z]:\\|/|\./|\.\./)])
553650TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]IO::File['"]\s*\)/ or $code =~ /IO::File\s*->\s*new\s*\(\s*\$$param/)
556950TFunless defined $param and $param =~ /^\w+$/
5572100TFif ($code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i)
558050TFif ($code =~ /\$$param\s*->\s*\(/ or $code =~ /\$$param\s*->\s*\(\s*\@_\s*\)/ or $code =~ /&\s*\{\s*\$$param\s*\}/)
5590100TFif ($param =~ /^(?:callback|cb|handler|sub|code|fn|func|on_\w+)$/i)
559850TFif ($code =~ /blessed\s*\(\s*\$$param\s*\)/ and $code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i)
563750TFunless defined $param and $param =~ /^\w+$/
5641100TFif ($code =~ m[unless\s+\$$param\s*=~\s*/\^?\(([^)]+)\)])
5644100TFunless $p->{'type'}
5654100TFif ($code =~ /\%(\w+)\s*=.*?qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
5657100TFif (defined $values_str and $code =~ /\$$hash_name\s*\{\s*\$$param\s*\}/)
565950TFunless $p->{'type'}
5669100TFif ($code =~ /grep\s*\{[^}]*\$${param}[^}]*\}\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
567250TFunless $p->{'type'}
5680100TFif ($code =~ /given\s*\(\s*\$$param\s*\)/)
568550TFif (@enum_values >= 2)
568650TFunless $p->{'type'}
5703100TFif (@if_values >= 3)
570450TFunless $p->{'type'}
571350TFif ($code =~ /\$$param\s*~~\s*\[([^\]]+)\]/ or $code =~ /\$$param\s*~~\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
57170TFif ($values_str =~ /['"]/) { }
57220TFif (@enum_values)
57230TFunless $p->{'type'}
5776100TFunless $condition =~ /\$$param\b/
5793100TFif ($condition =~ /\$$param\s*([!<>=]=?|eq|ne|lt|gt|le|ge)\s*(.+)/) { }
100TFelsif ($condition =~ /length\s*\(\s*\$$param\s*\)\s*([<>=!]+)\s*(\d+)/) { }
50TFelsif ($condition =~ /\$$param\s*==\s*0/) { }
5804100TFif $constraint
5805100TFif defined $message
5807100TFdefined $message ? :
5814100TFif ($code =~ /\b\Q$param\E\s*(<=|<|>=|>)\s*(-?\d+)/)
5820100TFif ($op eq '<=') { }
100TFelsif ($op eq '<') { }
100TFelsif ($op eq '>=') { }
50TFelsif ($op eq '>') { }
5874100TFif ($code =~ /sub\s+\w+\s*(?::\w+(?:\([^)]*\))?\s*)*\(((?:[^()]|\([^)]*\))*)\)\s*\{/s)
5878100TFif ($potential_sig =~ /[\$\%\@]/)
5888100TFif ($code =~ /my\s+\$(?:self|class)\s*=\s*\$_\[0\]/)
5892100TFif $name =~ /^(self|class)$/i
5900100TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s) { }
100TFelsif ($code =~ /my\s+\$self\s*=\s*shift/) { }
5907100TFif $name =~ /^(self|class)$/i
591450TFunless exists $params->{$name}{'position'}
592550TFif @shifts and $shifts[0] =~ /^(self|class)$/i
593450TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s)
59390TFif $param =~ /^(self|class)$/i
59470TFif ($seen{$param}++)
5985100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
598950TFunless defined $extracted
5993100TFif (substr($rest, 0, 1) eq ",")
600250TFif $current =~ /\S/
601050TFunless $part
601550TFif ($param_info)
6019100TFif ($name =~ /^(self|class)$/i)
6026100TF$param_info->{'optional'} ? :
100TF$param_info->{'_default'} ? :
6071100TFif ($part =~ /^\$(\w+)\s*:\s*(\w+)\s*=\s*(.+)$/s) { }
100TFelsif ($part =~ /^\$(\w+)\s*:\s*(\w+)\s*$/s) { }
100TFelsif ($part =~ /^\$(\w+)\s*=\s*(.+)$/s) { }
100TFelsif ($part =~ /^\$(\w+)$/s) { }
100TFelsif ($part =~ /^\@(\w+)$/s) { }
100TFelsif ($part =~ /^\%(\w+)$/s) { }
6080100TFif ($constraint =~ /^(Int|Integer)$/i) { }
100TFelsif ($constraint =~ /^(Num|Number)$/i) { }
50TFelsif ($constraint =~ /^(Str|String)$/i) { }
0TFelsif ($constraint =~ /^(Bool|Boolean)$/i) { }
0TFelsif ($constraint =~ /^(Array|ArrayRef)$/i) { }
0TFelsif ($constraint =~ /^(Hash|HashRef)$/i) { }
6105100TFif ($constraint =~ /^(Int|Integer)$/i) { }
100TFelsif ($constraint =~ /^(Num|Number)$/i) { }
100TFelsif ($constraint =~ /^(Str|String)$/i) { }
100TFelsif ($constraint =~ /^(Bool|Boolean)$/i) { }
100TFelsif ($constraint =~ /^(Array|ArrayRef)$/i) { }
50TFelsif ($constraint =~ /^(Hash|HashRef)$/i) { }
613150TFif $self->can("_infer_type_from_default")
6185100TFunless defined $default
6187100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
100TFelsif ($default =~ /^-?\d+$/) { }
100TFelsif ($default =~ /^-?\d+\.\d+$/) { }
50TFelsif ($default eq '1' or $default eq '0') { }
6234100TFif ($code =~ /sub\s+\w+\s+((?::\w+(?:\([^)]*\))?\s*)+)/s)
6239100TFif ($attr_section)
6243100TFif (defined $value and $value ne '') { }
6254100TFif ($attributes{'Returns'})
625650TFif ($return_type ne 1)
6261100TFif ($attributes{'lvalue'})
6265100TFif ($attributes{'method'})
6299100TFif ($code =~ /\$\w+\s*->\s*\@\*/)
6305100TFif ($code =~ /\$\w+\s*->\s*\%\*/)
6311100TFif ($code =~ /\$\w+\s*->\s*\$\*/)
6317100TFif ($code =~ /\$\w+\s*->\s*\&\*/)
6323100TFif ($code =~ /\$\w+\s*->\s*\@\[/)
6329100TFif ($code =~ /\$\w+\s*->\s*\%\{/)
6378100TFif ($modifiers =~ /:param(?:\(([^)]+)\))?/)
6381100TFif (defined $1) { }
6393100TFif ($modifiers =~ /=\s*([^:;]+)(?::|;|$)/)
639850TFdefined $field_info{'_default'} ? :
6402100TFif ($modifiers =~ /:isa\(([^)]+)\)/)
6449100TFunless $field->{'is_param'}
645850TFunless $p->{'_source'}
6459100TFif $field_name ne $param_name
6461100TFif ($field->{'_default'})
6466100TFif ($field->{'isa'})
6511100TFunless exists $params->{$param}
651250TFif $value =~ /->/
652250TFunless exists $params->{$param}
653250TFunless exists $params->{$param}
654250TFunless exists $params->{$param}
655250TFunless exists $params->{$param}
6562100TFunless exists $params->{$param}
65870TFunless exists $params->{$param}
659750TFunless exists $params->{$param}
6611100TFif (not keys %{$params;} || $code =~ /my\s+\$(?:self|class)\s*=\s*\$_\[0\]/)
6618100TFif ($var eq 'class' and $position == 0 and $method->{'name'} eq 'new') { }
50TFelsif ($var eq 'self' and $position == 0 and $method->{'name'} ne 'new') { }
6634100TFif ($var eq 'class' and $position == 0 and $method->{'name'} eq 'new') { }
100TFelsif ($var eq 'self' and $position == 0 and $method->{'name'} ne 'new') { }
66490TFif ($var ne "class" or $position > 0 or $method->{'name'} ne "new")
6677100TFunless defined $default
6678100TFif ref $default
6703100TFif exists $self->{'_constants'}
670750TFunless ($doc)
6760100TFif ($code =~ /(die|croak|confess)\b[^{;]*\bif\b[^{;]*\$$param\b/s)
6765100TFif ($code =~ /length\s*\(\s*\$$param\s*\)\s*([<>]=?)\s*(\d+)/)
6768100TFif ($op eq '<') { }
50TFelsif ($op eq '<=') { }
100TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
678450TFunless defined $val
678650TFif ($op eq '<') { }
100TFelsif ($op eq '<=') { }
50TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
6799100TFif (not $guarded and $code =~ /\$$param\s*([<>]=?)\s*([+-]?(?:\d+\.?\d*|\.\d+))/)
68040TF&looks_like_number($val) ? :
6806100TFif ($op eq '<' or $op eq '<=') { }
50TFelsif ($op eq '>' or $op eq '>=') { }
680850TF$op eq '<' ? :
680950TFif not defined $p->{'max'} or $max < $p->{'max'}
6811100TF$op eq '>' ? :
681250TFif not defined $p->{'min'} or $min > $p->{'min'}
6817100TFif ($code =~ m[\$$param\s*=~\s*((?:qr?/[^/]+/|\$[\w:]+|\$\{\w+\}))])
682250TFif ($pattern =~ m[^qr?/([^/]+)/$]) { }
6863100TFif ($code =~ /(?:die|croak|confess)\s+[^;]*unless\s+(?:defined\s+)?\$$param/s)
6869100TFif (defined $default_value and not exists $p->{'_default'})
687450TFunless ($p->{'type'})
687550TFif (&looks_like_number($default_value)) { }
0TFelsif (ref $default_value eq 'ARRAY') { }
0TFelsif (ref $default_value eq 'HASH') { }
0TFelsif ($default_value eq 'undef') { }
0TFelsif (defined $default_value and not ref $default_value) { }
687650TF$default_value =~ /\./ ? :
688850TFref $default_value ? :
6893100TFif (not $default_value || exists $p->{'_default'} and $code =~ /\$$param\s*=\s*([^;{}]+?)(?:\s*[;}])/s)
6896100TFunless ($assignment =~ /\$$param/ or $assignment =~ /^shift/)
690050TFif (defined $possible_default)
6909100TFif ($is_required)
6911100TFif exists $p->{'_default'}
6963100TFif $pod->{$param} and defined $pod->{$param}{'position'}
696450TFif $sig->{$param} and defined $sig->{$param}{'position'}
6965100TFif $code->{$param} and defined $code->{$param}{'position'}
6968100TFif (@positions)
69710TFunless $pos_count{$b} <=> $pos_count{$a}
697250TFunless exists $p->{'position'}
6976100TFif ($pod->{$param})
6981100TFif ($code->{$param})
6983100TFif $key eq "_source"
6984100TFif $key eq "position"
698850TFif $key eq "type" and $pod->{$param} and $pod->{$param}{'_from_input_spec'} and not defined $pod->{$param}{'type'}
6992100TFif (not exists $p->{$key} or $key eq "type" and $from_pod and $p->{'type'} eq "string" and $code->{$param}{$key} ne "string")
700150TFif ($sig->{$param})
70030TFif $key eq "_source"
70040TFif $key eq "position"
7017100TFif ($self->{'verbose'})
702350TFdefined $p->{'optional'} ? :
7054100TF$pod_param ? :
7055100TF$code_param ? :
7058100TFif (defined $pod_optional) { }
100TFelsif (defined $code_optional) { }
100TFelsif (keys %$merged_param > 0) { }
7108100TFunless keys %$params
7120100TFif ($p->{'type'}) { }
7121100TFif ($p->{'type'} eq 'string' and $p->{'min'} || $p->{'max'} || $p->{'matches'}) { }
100TFelsif ($p->{'type'} eq 'string') { }
7136100TFif (defined $p->{'min'})
7140100TFif (defined $p->{'max'})
7144100TFif (defined $p->{'optional'})
7148100TFif ($p->{'matches'})
7152100TFif ($p->{'isa'})
7158100TFif (defined $p->{'position'})
7164100TFif (exists $p->{'_default'})
7170100TFif ($p->{'semantic'})
718450TF$count ? :
7187100TF$count == 1 ? :
719350TFif (@sorted_params)
7198100TFif (@sorted_params > 1)
7207100TFif ($avg >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_LOW_THRESHOLD) { }
7256100TFunless keys %$output
7261100TFif ($output->{'type'}) { }
7269100TFif (defined $output->{'value'})
7275100TFif ($output->{'isa'})
7281100TFif ($output->{'_context_aware'})
728550TFif ($output->{'_list_context'})
7288100TFif ($output->{'_scalar_context'})
7294100TFif ($output->{'_error_return'})
7300100TFif ($output->{'_success_failure_pattern'})
7306100TFif ($output->{'_returns_self'})
7312100TFif ($output->{'_void_context'})
7318100TFif ($output->{'_error_handling'} and $output->{'_error_handling'}{'exception_handling'})
7327100TFif ($score >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_LOW_THRESHOLD) { }
7369100TFunless $schema->{'_analysis'}
738150TFif ($analysis->{'confidence_factors'}{'input'})
739250TFif ($analysis->{'confidence_factors'}{'output'})
740150TFif ($analysis->{'per_parameter_scores'})
7442100TFunless ($p->{'type'})
7446100TFunless (defined $p->{'optional'})
7488100TFunless ref $p eq "HASH"
7489100TFunless ($p->{'type'})
7540100TFunless @param_names
7588100TFif ($rel->{'type'} eq 'mutually_exclusive') { }
100TFelsif ($rel->{'type'} eq 'required_group') { }
100TFelsif ($rel->{'type'} eq 'conditional_requirement') { }
100TFelsif ($rel->{'type'} eq 'dependency') { }
100TFelsif ($rel->{'type'} eq 'value_constraint') { }
50TFelsif ($rel->{'type'} eq 'value_conditional') { }
7604100TFunless ($seen{$sig}++)
7640100TFif $param1 eq $param2
7643100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*if\s+\$$param2\s+&&\s+\$$param1/)
7649100TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
7656100TFif $found_reverse
7668100TFif ($code =~ /(?:die|croak|confess)\s+['"](Cannot|Can't)[^'"]*both[^'"]*${param1}[^'"]*$param2/i or $code =~ /(?:die|croak|confess)\s+['"](Cannot|Can't)[^'"]*both[^'"]*${param2}[^'"]*$param1/i)
767350TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
768050TFif $found_reverse
7724100TFif $param1 eq $param2
7726100TFif ($code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param1\s+\|\|\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param2\s+\|\|\s+\$$param1/)
773250TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
7739100TFif $found_reverse
7752100TFif ($code =~ /(?:die|croak|confess)\s+['"]Must\s+specify\s+either[^'"]*${param1}[^'"]*or[^'"]*$param2/i or $code =~ /(?:die|croak|confess)\s+['"]Must\s+specify\s+either[^'"]*${param2}[^'"]*or[^'"]*$param1/i)
775750TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
776450TFif $found_reverse
7809100TFif $param1 eq $param2
7812100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!\$$param2/)
782450TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!defined\s*\(\s*\$$param2\s*\)/)
7836100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i)
7879100TFif $param1 eq $param2
7883100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i and $code =~ /if\s+\$$param1\s+&&\s+!\$$param2/)
7928100TFif $param1 eq $param2
7931100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*!=\s*(\d+)/)
794650TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*<\s*(\d+)/)
7961100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+eq\s+['"]([^'"]+)['"]\s+&&\s+!\$$param2/)
7991100TFunless defined $self->{'output_dir'}
7993100TFunless -d $self->{'output_dir'}
8002100TFif ($self->{'_document'})
8004100TF$package_stmt ? :
8024100TFif ($schema->{'input'})
8025100TFif (scalar keys %{$$schema{'input'};}) { }
8030100TFif ($param->{'name'})
803250TFif ($name ne $param_name)
804850TFif (@with_pos and @without_pos)
805750TFif ($schema->{'output'} and scalar keys %{$$schema{"output"};})
8058100TFif (ref $schema->{'output'}{'_error_handling'} eq "HASH" and scalar keys %{$$schema{"output"}{"_error_handling"};} == 0)
806450TFif ($schema->{'output'}{'type'} and $schema->{'output'}{'type'} eq "scalar")
8070100TFif ($schema->{'new'})
8072100TFif (ref $schema->{'new'} or $schema->{'new'} eq $package_name) { }
807350TF$schema->{'new'} eq $package_name ? :
8081100TFunless (defined $schema->{'_confidence'}{'input'}{'level'})
8084100TFunless (defined $schema->{'_confidence'}{'output'}{'level'})
8089100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
809350TFif ($schema->{'accessor'} and scalar keys %{$$schema{"accessor"};})
8103100TF$schema->{'relationships'} ? :
8105100TF$schema->{'new'} ? :
8144100TFif ($schema->{'input'})
8149100TFif ($p->{'semantic'})
8153100TFif ($p->{'enum'})
8157100TFif ($p->{'isa'})
8162100TFif (@param_notes)
8172100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
8184100TFif ($schema->{'_notes'} and scalar @{$schema->{'_notes'};})
8192100TFif ($schema->{'_analysis'})
8212100TFif ($schema->{'input'})
8216100TFif ($p->{'type'} and $p->{'type'} eq "coderef")
8220100TFif ($p->{'semantic'} and $p->{'semantic'} eq "filehandle")
8224100TFif ($p->{'isa'} and $p->{'isa'} =~ /DateTime/)
8230100TFif (@warnings)
8277100TFif defined $param->{$field}
8281100TFif (my $semantic = $param->{'semantic'})
8282100TFif ($semantic eq 'datetime_object') { }
50TFelsif ($semantic eq 'timepiece_object') { }
100TFelsif ($semantic eq 'date_string') { }
100TFelsif ($semantic eq 'iso8601_string') { }
100TFelsif ($semantic eq 'unix_timestamp') { }
50TFelsif ($semantic eq 'datetime_parseable') { }
100TFelsif ($semantic eq 'filehandle') { }
100TFelsif ($semantic eq 'filepath') { }
100TFelsif ($semantic eq 'callback') { }
100TFelsif ($semantic eq 'enum') { }
832550TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY")
8335100TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY" and not $cleaned{'enum'})
833850TFif ($param->{'memberof'} and ref $param->{'memberof'} eq "ARRAY")
8343100TFif ($param->{'isa'} and not $cleaned{'isa'})
8348100TFif ($param->{'format'})
8380100TFif ($rel->{'type'} eq 'mutually_exclusive') { }
100TFelsif ($rel->{'type'} eq 'required_group') { }
100TFelsif ($rel->{'type'} eq 'conditional_requirement') { }
100TFelsif ($rel->{'type'} eq 'dependency') { }
100TFelsif ($rel->{'type'} eq 'value_constraint') { }
100TFelsif ($rel->{'type'} eq 'value_conditional') { }
843350TFunless $doc
8437100TF$package_stmt ? :
8453100TFif ($method_name eq "new")
845750TFif ($method_name =~ /^(create|build|construct|init|DESTROY)$/i)
8468100TFif ($is_singleton)
84800TFif ($is_instance_method and $is_instance_method->{'explicit_self'} || $is_instance_method->{'shift_self'} || $is_instance_method->{'accesses_object_data'} || $is_instance_method->{'calls_instance_methods'} && scalar @{$is_instance_method->{'calls_instance_methods'};})
8488100TFif ($is_factory)
850250TFif ($inheritance_info and $inheritance_info->{'use_parent_constructor'})
8514100TFif ($constructor_needs)
852850TFif ($needs_other_object)
85320TFif $needs_other_object->{'package'}
85380TFif $result->{'package'}
8542100TFif ($is_factory and not $skip_object)
854850TFif $is_factory->{'returns_class'}
8584100TFif ($method_name =~ /^(create_|make_|build_|get_)/i)
858950TFif ($method_body)
8591100TFif ($method_body =~ /return\s+bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?/s or $method_body =~ /bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?.*return/s)
8596100TFif ($class_name =~ /^\$(class|self|package)$/) { }
50TFelsif ($class_name =~ /^\$/) { }
8610100TFif ($method_body =~ /return\s+([\$\w:]+)->new\(/s or $method_body =~ /([\$\w:]+)->new\(.*return/s)
861550TFif ($target eq '$self' or $target eq 'shift' or $target =~ /^\$/) { }
100TFelsif ($target =~ /::/) { }
863150TFif ($method_body =~ /return\s+([\$\w:]+)->(create_|make_|build_|get_)/i or $method_body =~ /([\$\w:]+)->(create_|make_|build_|get_).*return/is)
8640100TFif ($method_info and ref $method_info eq "HASH" and $method_info->{'pod'})
864250TFif ($pod =~ /returns?\s+(?:an?\s+)?(object|instance|new\s+\w+)/i)
8682100TFunless $method_name =~ /^(instance|get_instance|singleton|shared_instance)$/i
868950TFif ($method_body)
8691100TFif ($method_body =~ /(?:my\s+)?(?:our\s+)?\$(?:instance|_instance|singleton)\b/s or $method_body =~ /state\s+\$(?:instance|_instance|singleton)\b/s)
8698100TFif ($method_body =~ /return\s+\$instance\s+if\s+(?:defined\s+)?\$instance/ or $method_body =~ /unless\s+\$instance.*?=\s*.*?new/)
8705100TFif ($method_body =~ /\$instance\s*\|\|=\s*.*?new/ or $method_body =~ /\$instance\s*=\s*.*?new\s+unless\s+(?:defined\s+)?\$instance/)
8712100TFif ($method_body =~ /return\s+\$instance;/)
871450TFunless $singleton_info{'confidence'}
871850TFif keys %singleton_info > 0
8753100TFif ($method_body =~ /my\s*\(\s*\$self\s*[,)]/) { }
100TFelsif ($method_body =~ /my\s+\$self\s*=\s*\$_\[0\]/) { }
100TFelsif ($method_body =~ /my\s+\$self\s*=\s*shift/) { }
100TFelsif ($method_body =~ /\$self\s*->\s*(\w+|[\{\[])/) { }
8778100TFif ($method_body =~ /\$self\s*->\s*[\{\[]/)
8780100TFunless $instance_info{'confidence'} eq "high"
8784100TFif ($method_body =~ /\$self\s*->\s*(\w+)\s*\(/s)
878950TFif @{$instance_info{'calls_instance_methods'};}
8793100TFif ($method_name =~ /^_/ and not $method_name =~ /^_new/)
879650TFunless exists $instance_info{'confidence'}
8799100TFif keys %instance_info
8832100TFunless $doc
8843100TFif ($content =~ /use\s+(parent|base)\s+['"]?([\w:]+)['"]?/)
884850TFif ($content =~ /use\s+(parent|base)\s+qw?[\(\[]?(.+?)[\)\]]?;/)
886150TFif ($content =~ /(?:our\s+)?\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
8873100TFif ($content =~ /\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
8882100TFif ($method_body and $method_body =~ /SUPER::/)
888450TFif ($method_body =~ /SUPER::new/)
8891100TFif $_[1]->isa("PPI::Statement::Sub")
8895100TFif ($has_own_new) { }
100TFelsif (@parent_classes) { }
8903100TFif keys %inheritance_info
893750TFunless $doc
8941100TFif ($target_package ne $current_package)
8951100TFif $_[1]->isa("PPI::Statement::Sub")
8955100TFunless $new_method
8963100TFif ($body =~ /my\s*\(\s*\$(self|class)\s*,\s*(.+?)\)\s*=\s*\@_/s)
8967100TFif (@param_names)
898150TFif (@shift_params)
8989100TFif ($body =~ /croak.*unless.*(?:defined\s+)?\$(\w+)/g)
8992100TFif ($body =~ /die.*unless.*(?:defined\s+)?\$(\w+)/g)
8996100TFif (@required_params)
9006100TFif ($requirements{'parameters'})
9009100TFif (defined $default)
9016100TFif (@optional_params)
9021100TFif keys %requirements
9052100TFunless $method_body
9061100TFif $class eq "main" or $class eq "__PACKAGE__" or $class =~ /^\$/
9065100TFif ($dependency_info{'creates_objects'})
9073100TFif ($method_body =~ /\$(\w+)->\w+\(/)
9087100TFif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->(?:new|create)/) { }
50TFelsif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->/) { }
909450TFif (@object_classes)
9096100TFunless $dependency_info{'package'}
9103100TFif keys %dependency_info
912650TFunless $doc
913050TFif $_[1]->isa("PPI::Statement::Include") and $_[1]->type eq "use" and $_[1]->module =~ /^(parent|base)$/
913550TFif ($parent_stmt)
9142100TFif $_[1]->isa("PPI::Statement")
914550TFif ($isa_stmt and $isa_stmt->content =~ /['"](\w+(?:::\w+)*)['"]/)
9179100TFunless $package_stmt
9185100TFif $_[1]->isa("PPI::Statement::Sub")
918850TFif ($has_new)
91940TFif $parent
9230100TFunless $param and $code
9240100TFif ($clean_code =~ /\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*\|\|\s*([^;]+)/)
924450TFif defined $default
9248100TFif ($clean_code =~ m[\$$param\s*//=\s*([^;]+)])
9252100TFif defined $default
9257100TFif ($clean_code =~ /\$$param\s*=\s*defined\s+(?:\$$param|\$[a-zA-Z_]\w*)\s*\?\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*:\s*([^;]+)/)
926150TFif defined $default
9265100TFif ($clean_code =~ /\$$param\s*=\s*([^;]+?)\s+unless\s+defined\s+(?:\$$param|\$[a-zA-Z_]\w*)/)
926850TFif defined $default
9272100TFif ($clean_code =~ /\$$param\s*\|\|=\s*([^;]+)/)
927650TFif defined $default
9280100TFif ($clean_code =~ m[\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*//\s*([^;]+)])
9284100TFif defined $default
9288100TFif ($clean_code =~ /if\s*\(\s*!defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
929250TFif defined $default
9296100TFif ($clean_code =~ /unless\s*\(\s*defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
930050TFif defined $default
9337100TFunless $code
9344100TFunless @{$hints{$k};}
9371100TFif ($code =~ /defined\s*\(\s*\$/)
9376100TFif ($code =~ /\beq\s*''/ or $code =~ /\blength\s*\(/)
9381100TFif ($code =~ /\$\w+\s*<\s*0/)
9409100TFif ($op eq '<') { }
100TFelsif ($op eq '<=') { }
100TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
9449100TFunless $pod
9455100TFif ($pod =~ /=head[12]\s+SYNOPSIS\s*(.+?)(?=\n=head|\z)/s)
9466100TFunless length $synopsis
947550TFdefined $3 ? :
100TFdefined $2 ? :
9479100TFif %kv
9487100TFunless (scalar @examples)
9496100TFunless @args
950750TFif (scalar @examples)
9552100TFunless defined $value
9562100TFif ($value =~ m[\|\||/{2}])
9572100TFif ($value =~ /^qq?\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^qw\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^q[qwx]?\s*([^a-zA-Z0-9\{\[])(.*?)\1$/s) { }
9581100TFif ($value =~ /^(['"])(.*)\1$/s)
9584100TFif ($from_code)
9595100TFunless ($from_code)
9604100TFunless ($value =~ /^\(/)
9609100TFif ($value =~ /^\{\s*\}$/)
9614100TFif ($value =~ /^\[\s*\]$/)
9619100TFif ($value =~ /^-?\d+(?:\.\d+)?$/)
9620100TFif ($value =~ /\./) { }
9628100TFif ($value =~ /^(true|false)$/i)
9629100TFlc $1 eq 'true' ? :
963350TFif ($value eq '1') { }
50TFelsif ($value eq '0') { }
9640100TFif ($value eq "undef")
9645100TFif ($value eq "__PACKAGE__")
9653100TFif ($value =~ /^\$[a-zA-Z_]/ or $value =~ /\(.*\)/)
9654100TFif $value =~ /^\$|\@|\%/
970650TFif $pod->{'_from_input_spec'}
9709100TFif (exists $pod_params->{$param} and not exists $code_params->{$param})
971450TFif (not exists $pod_params->{$param} and exists $code_params->{$param})
9715100TFif ($param eq "class")
9719100TFif ($param eq "self")
9728100TFif ($pod->{'type'} and $code->{'type'} and $pod->{'type'} ne $code->{'type'})
9729100TFif (not $self->_types_are_compatible($pod->{'type'}, $code->{'type'})) { }
9737100TFif (exists $pod->{'optional'} and exists $code->{'optional'} and $pod->{'optional'} != $code->{'optional'})
9739100TF$pod->{'optional'} ? :
9740100TF$code->{'optional'} ? :
97450TFif (defined $pod->{'min'} and defined $code->{'min'} and $pod->{'min'} != $code->{'min'})
97490TFif (defined $pod->{'max'} and defined $code->{'max'} and $pod->{'max'} != $code->{'max'})
97540TFif ($pod->{'matches'} and $code->{'matches'} and $pod->{'matches'} ne $code->{'matches'})
9783100TFunless defined $val
9786100TFif $val =~ /^(0|off|none)$/i
9787100TFif $val =~ /^(1|warn|warning)$/i
9788100TFif $val =~ /^(2|fatal|die|error)$/i
9814100TFif $pod_type eq $code_type
9827100TFif (my $allowed = $compatible_types{$pod_type})
983250TFif (my $allowed = $compatible_types{$code_type})
9897100TFif (my $errors = $schema->{'_pod_validation_errors'})
9899100TF$schema->{'_pod_disagreement'} ? :
9906100TFif (@reports) { }
9922100TFif $self->{'verbose'}