Branch Coverage

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

line%coveragebranch
138350TFunless exists $params->{'input_file'}
1399100TFunless (-f $self->{'input_file'})
149050TFunless my $document = "PPI::Document"->new($self->{'input_file'})
1511100TFif $method->{'name'} eq "new"
1514100TFif defined $target
1526100TFif (exists $schemas{'new'})
153150TF$new_method ? :
1533100TFif %{$object_stubs;}
1536100TFif (defined $ctor_args)
1538100TFif $method_name eq "new"
1540100TFunless exists $schema->{'new'} and defined $schema->{'new'}
1553100TFif ($ctor_body and $schemas{'new'} and my $reason = _constructor_requires_live_objects($ctor_body, $schemas{'new'}))
1555100TFunless %{$object_stubs;}
1556100TFunless %{$object_stubs;}
1568100TFif ($ctor_body and $schemas{'new'} and my $reason = _constructor_needs_live_dependencies($schemas{'new'}))
157350TFunless %{$object_stubs;}
157450TFunless %{$object_stubs;}
1583100TFif ($ctor_body and $schemas{'new'} and _constructor_refuses_direct_instantiation($ctor_body, $schemas{'new'}))
1588100TFif $method_name eq "new"
159050TFunless exists $schema->{'new'} and defined $schema->{'new'}
160550TFunless $schema and ref $schema->{'output'} eq "HASH"
1620100TFif ($body =~ /\bmy\s*(?:\(([^)]*)\)|(%\w+))\s*=\s*\@_/s)
1622100TFif (not defined $declared or $declared =~ /[\@%]\w+/)
1625100TFif $decl =~ /^\s*[\@%]/
1626100TFif $decl =~ /^\s*\$(?!self\b|class\b)(\w+)/
1635100TFexists $keep{$param} ? :
1636100TFif (defined $pos and $pos < @prefix) { }
1641100TFif @prefix
1647100TFif ($body =~ /\bcroak\b[^;\n]*must be implemented by subclass/) { }
100TFelsif ($body =~ /\breturn\s+\@\{/ and ($method->{'pod'} // '') =~ /\b(?:a\s+)?list\s+of\b|\breturns?\s+a\s+list\b/i) { }
100TFelsif ($body =~ /\breturn\s*;/ and not $body =~ /\breturn\s+[^\s;]/) { }
50TFelsif ($body =~ /\breturn\s+\\?[A-Z]\w*(?:::\w+)+(?:->)?\w*\s*\(/) { }
1668100TFif (_always_croaks($body))
1676100TFif (_keeps_database_handle($body, $method->{'pod'} // ""))
1680100TFif (my $skip = _requires_input_file($body, $schema->{'input'}))
1692100TFif ((my $pod = $method->{'pod'} // "") =~ /(?:HASHREF|hashref)\s+of\s*\{|(?:HASHREF|hashref)[^\n]*\bmodel store\b/i)
1700100TFif ((my $pod = $method->{'pod'} // "") =~ /HASHREF[^\n]*\{[^}]*\bdatabase\b[^}]*\b(?:username|password)\b/i)
1706100TFif (ref $schema->{'new'} eq "HASH" and %{$schema->{'new'};})
1712100TFunless $reads_keys and $body =~ /\bcroak\b/
171350TFif $self->{'_package_name'}
172050TFunless ref $spec eq "HASH"
1723100TFif ($body =~ /ref\(\s*\$args\{\s*['"]?${p}['"]?\s*\}\s*\)\s*(?:ne|eq)\s*['"]CODE['"]/ or $body =~ /\$args\{\s*['"]?${p}['"]?\s*\}\s*->\s*\(/)
1731100TFif ($body =~ /my\s+\$(\w+)\s*=\s*\$args\{\s*['"]?${p}['"]?\s*\}/)
1733100TFif ($body =~ /[\$%](\w+)\s*\{\s*\$$var\s*\}/)
173550TF$self->{'_document'} ? :
173650TFif ($source =~ /%$const\s*(?:=|=>)\s*.*?qw\s*[\(\{\[]([^\)\}\]]+)[\)\}\]]/s)
173850TFif @values
175850TFif $from < 0
1766100TF$prefix =~ /\breturn\b[^;]*\bunless\b/ ? :
176950TFif (not $accepts and $prefix =~ /\bif\s*\([^;{}]*$/)
17730TFif ($brace >= 0)
17750TF$close >= 0 ? :
17770TF$block =~ /\breturn\b/ ? :
1780100TFunless $accepts
178350TFif $prefix =~ /\b(?:croak|die|confess)\b[^;]*\bif\b/
178450TFunless (_pattern_is_self_contained($pattern))
1794100TFunless $body =~ /\b(?:croak|die|confess)\b[^;]*$subject/s
1800100TFif ($body =~ m[\$args\{\s*['"]?${p}['"]?\s*\}\s*=~\s*/([^/\n]+)/]) { }
100TFelsif ($body =~ m[\$$p\b\s*=~\s*/([^/\n]+)/]) { }
1805100TFif (@accepted and $croaks_about_param) { }
50TFelsif (defined $pattern and _pattern_is_self_contained($pattern) and $body =~ /\bcroak\b[^;\n]*(?:not a valid|invalid)/i) { }
1810100TF@accepted == 1 ? :
1823100TFif ($schemas{'new'} and $schemas{'new'}{'skip'})
1825100TFif $method_name eq "new"
1827100TFunless exists $schema->{'new'} and defined $schema->{'new'}
183950TFif $method_name eq $target
1841100TFunless $target_schema
184450TFunless $schema
185050TFif (ref $target_schema->{'output'} eq "HASH" and %{$target_schema->{'output'};})
1855100TFunless ref $target_schema->{'input'} eq "HASH" and scalar keys %{$$target_schema{"input"};}
185650TFif ref $schema->{'input'} eq "HASH" and scalar keys %{$$schema{"input"};}
1873100TFif ($self->{'_multiple_packages'})
1880100TFunless ($params->{'no_write'})
191450TFunless defined $code
1921100TF$body =~ /\A\{ (?:my \$self = shift; )?(?:carp\s+(?:'[^']*'|"[^"]*")\s*; )?return \$self->(\w+)\(\s*\\?\@_\s*\); \}\z/ ? :
1951100TFunless (defined $document)
1955100TFif (@$pkgs == 0)
195750TF$package_stmt ? :
1960100TFif (@$pkgs > 1)
1973100TFunless $pkgs and @$pkgs > 1
197650TFunless ref $loc eq "ARRAY"
198150TFunless ref $pkg_loc eq "ARRAY"
1982100TFif $pkg_loc->[0] > $loc->[0]
203650TFunless defined $name
2039100TFunless $self->_in_primary_package($sub, $pkgs)
2040100TFif $name =~ /^(BEGIN|END|DESTROY|AUTOLOAD|CHECK|INIT|UNITCHECK)$/
204150TFif $name =~ /::/
2044100TFif ($name =~ /^_/ and not $name =~ /^_(new|init|build)/)
2045100TFunless $self->{'include_private'}
2063100TFif (@$pkgs <= 1 and $content =~ /\bclass\b/)
20760TFunless $self->_in_primary_package($decl, $pkgs)
20780TFif ($content =~ /^\s*(before|after|around)\s+['"]?(\w+)['"]?\b/)
20880TFif ($next_sib and $next_sib->isa("PPI::Statement::Sub"))
2108100TFif ($seen{$n}++) { }
216250TFunless defined $extracted
217650TFif ($method_name =~ /^_/ and not $method_name =~ /^_(new|init|build)/)
21770TFunless $self->{'include_private'}
223350TF$sub->can('name') ? :
2243100TFif ($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')) { }
100TFelsif ($current->isa('PPI::Statement::Variable') and $current->content =~ /\A\s*(?:my|our)\b/ and not $current->content =~ /\bsub\b/) { }
224850TFif (not $skipped_declaration or defined $name and $content =~ /^=head[1-6]\s+\Q$name\E\b/m)
225650TFif ($comment =~ /#\s*(?:param|arg|input)\s+\$(\w+)\s*:\s*(.+)/i)
2281100TFif ($pod and defined $name and $pod =~ /^=head([1-6])\s+\Q$name\E\b/m)
228650TFif (my $doc = eval {         do {         $sub->document } })
229050TFunless $subs
229250TFif defined $method_name
2301100TFif $-[0] == 0
230250TFif ($heading_level < $level or $heading_level == $level and $method_names->{$title})
230850TFif (defined $cut)
2318100TFif (defined $name and not $pod =~ /^=head[1-6]\s+\Q$name\E\b/m)
2320100TFif defined $named and length $named
235050TFunless my $doc = eval {         do {         $sub->document } }
2351100TFunless my $tokens = $doc->find("PPI::Token::Pod")
2366100TFunless $heads[$j][1] <= $level
2380100TFunless ($heads[$i][2] // "") =~ /\A\Q$name\E\b/ or defined $synopsis and $synopsis =~ /^\s*\Q$name\E\s*\(/m
2412100TFunless defined $pod and length $pod
2415100TFunless defined $section and length $section
2417100TFif $section =~ /\b(?:creates?|writes?|rewrites?|overwrites?|updates?)\b[^.\n]*\bfiles?\b/i
241850TFif $section =~ /\bfiles?\b[^.\n]*\b(?:is|are)\s+(?:created|written|rewritten|overwritten|updated)\b/i
247150TFif ($method->{'fields'} and keys %{$$method{"fields"};})
2494100TFif $self->_pod_documents_class_invocant($pod)
2503100TFif ($self->{'strict_pod'} and $pod)
2514100TFif (@validation_errors)
2522100TFif ($self->{'strict_pod'} == $STRICT_POD_FATAL) { }
2535100TFif ($validator_params) { }
254650TFunless ($pod_params->{$name}{'_source'} // "") eq "input_spec"
254950TFif defined $pod_p->{'optional'}
255050TFif defined $pod_p->{'memberof'}
255150TFif defined $pod_p->{'matches'}
255250TFif defined $pod_p->{'type'}
255350TFif defined $pod_p->{'min'}
255450TFif defined $pod_p->{'max'}
2557100TFif ref $pod_p->{'schema'} eq "HASH"
256250TFunless defined $pod_p->{$key}
2574100TFif (keys %$fields)
2607100TFif ($method->{'name'} ne "new" and $needs_object)
261450TFunless (ref $input_confidence)
263550TFif ($input_confidence->{'per_parameter'})
2654100TF$level_rank{$input_level} < $level_rank{$output_level} ? :
2660100TFif ($relationships and @{$relationships;})
2666100TFif keys %$attributes
2667100TFif keys %$postfix_derefs
2668100TFif keys %$fields
2671100TFif ($method->{'class'})
268150TFdefined $_ ? :
2689100TFif ($self->_method_has_numeric_intent($schema))
26950TFdefined $_ ? :
2699100TFdefined $v ? :
270050TFunless $seen{$key}++
270650TFif (keys %$hints)
2710100TFunless exists $schema->{'_yamltest_hints'}{$k}
2714100TFif ($level_rank{$overall} < $level_rank{$LEVEL_MEDIUM} and $level_rank{$overall} < $self->{'confidence_threshold'} * 4)
273250TFif ($schema->{'output'})
277150TFif ($self->_pod_documents_file_write($pod))
2809100TFif $schema->{'output'} and $schema->{'output'}{'type'} and $schema->{'output'}{'type'} =~ /^(number|integer)$/
2812100TFunless $schema->{'input'}
2813100TFif $p->{'optional'}
2814100TFif $p->{'type'} and $p->{'type'} =~ /^(number|integer)$/
2881100TFif ($method->{'name'} // "") eq "new"
2894100TFif (keys %fields_seen > 1)
2914100TFif $arg eq "self"
2915100TFif ($code =~ /(?:if|unless)\s*\(?\s*(?:defined\s*\(?\s*)?\$\Q$arg\E\b/)
2927100TF$code =~ /\bif\s*\(\s*(?:\@_|scalar\s*\(\s*\@_\s*\))/ ? :
293250TFif ($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 ($arg_guard || $conditional_arg 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*;/) { }
29400TFunless (defined $property)
29410TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*shift\s*;/)
29610TFif (my $pod = $method->{'pod'})
29620TFif ($pod =~ /\b(LWP::UserAgent(?:::\w+)*)\b/)
299250TFif ($conditional_arg and not $arg_guard and ref $schema->{'input'} eq "HASH" and scalar keys %{$$schema{"input"};} > 1)
299850TFunless (defined $property)
299950TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=/)
3003100TFif ($code =~ /validate_strict/) { }
300950TFif ($code =~ /blessed\s*\(\s*\$(\w+)\s*\)/) { }
3038100TFif (my $pod = $method->{'pod'})
303950TFif ($pod =~ /\b(LWP::UserAgent(?:::\w+)*)\b/)
306350TFif (ref $schema->{'input'} eq "HASH")
306550TFif (scalar @input_keys > 1) { }
50TFelsif (@input_keys == 1) { }
3086100TFunless ($code =~ /\$self\s*->\s*\{\s*['"]?\Q$property\E['"]?\s*\}\s*=\s*(?:shift|\$\w+\s*=\s*shift|\@_|\$_\[\d+\])/)
3090100TFif (scalar @returns == scalar @self_returns)
310550TFif ($code =~ m(\$self\s*->\s*\{\s*['"]?\Q$property\E['"]?\s*\}\s*//=\s*\[)) { }
50TFelsif ($code =~ m[\$self\s*->\s*\{\s*['"]?\Q$property\E['"]?\s*\}\s*//=\s*\{]) { }
3146100TFif ($1 =~ /(?:->|::)\w+\s*\([^)]*\$\Q$param\E\b/)
3161100TFif ($schema->{'output'}{'_returns_self'}) { }
50TFelsif (scalar keys %{$$schema{'output'};} != 0) { }
316250TFif ($schema->{'output'}{'type'} ne "object")
316550TFif ($schema->{'output'}{'isa'} ne $self->{'_package_name'})
3176100TFif (exists $schema->{'accessor'})
317750TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'type'} =~ /setter|getset/ and $schema->{'input'})
3181100TFif ($in->{'type'} and $in->{'type'} eq "object")
318450TF$in->{'isa'} ? :
3195100TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'property'} and $schema->{'accessor'}{'type'} =~ /getter|getset/ and !defined($schema->{'output'}{'type'}) || $schema->{'output'}{'type'} eq 'string')
3197100TFif (my $pod = $method->{'pod'})
3199100TFif ($pod =~ /\bUser[- ]?Agent\b.*\bobject\b/i)
327450TFunless $res->{'input'}
50TFif $res and ref $res eq "HASH" and keys %{{} unless $res->{'input'};}
330850TFif ($child->isa("PPI::Statement") or $child->isa("PPI::Statement::Expression"))
33170TFif ($tokens[$i]->isa('PPI::Token::Word') || $tokens[$i]->isa('PPI::Token::Quote') and $tokens[$i + 1]->isa("PPI::Structure::Constructor"))
33260TFunless $key and $val
33300TFunless $inner->isa("PPI::Statement") or $inner->isa("PPI::Statement::Expression")
33370TFunless $k and $v
33400TF$v->can('content') ? :
33410TFif defined $value
33430TFif ($keyname eq 'type') { }
0TFelsif ($keyname eq 'optional') { }
0TFelsif ($keyname =~ /^(min|max)$/ and &looks_like_number($value)) { }
0TFelsif ($keyname eq 'matches') { }
33460TF$value ? :
3396100TFif ref $code and $code->can("find")
3422100TFunless $code =~ /\bvalidate_strict\s*\(/
342450TFunless my $doc = $self->_ppi($code)
3427100TFif $_[1]->isa("PPI::Token::Word")
342850TFunless 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"); } )
343550TFunless (defined $list)
343750TFunless defined $next
3438100TFif ($next->content =~ /schema\s*=>\s*(\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})/s)
344050TFif $schema_text =~ /$UNSAFE_KEYWORD_RE/
3446100TFif ($self->_usable_validator_schema($schema))
345550TFunless $list
34590TFunless $schema_block
34620TFif $schema
3487100TFunless $code =~ /\bvalidate\s*\(/
348950TFunless my $doc = $self->_ppi($code)
3492100TFif $_[1]->isa("PPI::Token::Word")
349350TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validate" or $_[1]->content eq "Params::Validate::validate" if $_[1]->isa("PPI::Token::Word"); } )
350050TFunless (defined $list)
350450TFif ($schema_text and not $schema_text =~ /$UNSAFE_KEYWORD_RE/)
3511100TFif ($self->_usable_validator_schema($schema))
351450TFif (my $type = $field->{'type'})
3515100TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
353250TFunless $list
35360TFunless $schema_block
35390TFif $schema
3580100TFif (substr($rest, 0, 1) eq "{")
358450TFunless defined $extracted
3588100TFif (substr($rest, 0, 1) eq ",")
3596100TFunless $found_comma
3629100TFunless $code =~ /\bvalidated_hash\s*\(/
363150TFunless my $doc = $self->_ppi($code)
3634100TFif $_[1]->isa("PPI::Token::Word")
363550TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validated_hash" if $_[1]->isa("PPI::Token::Word"); } )
364250TFunless (defined $list)
364650TFif ($schema_text and not $schema_text =~ /$UNSAFE_KEYWORD_RE/)
365450TFif ($self->_usable_validator_schema($schema))
365750TFif (my $isa = delete $field->{'isa'})
3660100TFif (exists $field->{'required'}) { }
3662100TF$required ? :
3666100TFif (ref $field->{'default'} eq "CODE")
367350TFif (my $type = $field->{'type'})
367450TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
36910TFunless $list
36950TFunless $schema_block
36980TFif $schema
372750TFunless $block and $block->can("children")
37310TFunless $result and ref $result eq "HASH" and $result->{'input'}
3775100TFunless ref $schema eq "HASH"
377850TFunless @names
3781100TFunless length $name
378250TFunless ref $schema->{$name} eq "HASH"
3820100TFexists $spec->{'optional'} ? :
3855100TFunless my $function = $self->_extract_function_name($code)
3857100TFunless my $doc = $self->{'_document'}
3858100TFunless my $stmt = $self->_find_signature_statement($doc, $function)
386050TFunless my $signature_expr = $self->_extract_signature_expression($stmt, $function)
3862100TFunless my $meta = $self->_compile_signature_isolated($function, $signature_expr)
3884100TFif $code =~ /^\s*sub\s+([a-zA-Z0-9_]+)/
3908100TFif $_[1]->isa("PPI::Statement")
3910100TFunless my $statements = $doc->find(sub {         $_[1]->content =~ /^\s*signature_for\b/ if $_[1]->isa("PPI::Statement"); } )
391450TFif ($content =~ /^\s*signature_for\s+\Q$function\E\b/)
3944100TFif ($content =~ /^\s*signature_for\s+\Q$function\E\s*=>\s*(.+?);?\s*$/s)
4011100TFunless ($self->{'allow_signature_exec'})
401550TFif $self->{'verbose'}
402950TFif ($signature_expr =~ /$UNSAFE_KEYWORD_RE/ or $signature_expr =~ /$UNSAFE_CHAR_RE/)
4137100TFif ($stderr and length $stderr)
413850TFif $self->{'verbose'}
4145100TFunless (defined $stdout and length $stdout)
414650TFif $self->{'verbose'}
415150TFif ($@)
415250TFif $self->{'verbose'}
420050TFunless $meta->{'parameters'}
4203100TFunless (exists $type_map{$p->{'type'}})
4211100TF$p->{'optional'} ? :
4219100TFif (my $ret = $meta->{'returns'})
422250TFunless (exists $type_map{$ret->{'type'}})
4279100TFunless $pod
4286100TFif ($pod =~ /=head2\s+\w+\s*\(([^)]+)\)/s)
429250TFif @sig_params and $sig_params[0] =~ /^(self|class|pkg|proto|klass)$/i
4307100TFif ($pod =~ /(?:Parameters?|Arguments?|Inputs?):?\s*\n((?:\s*\$.*\n)+)/is) { }
100TFelsif ($pod =~ /^=head\d+\s+(?:Parameters?|Arguments?|Inputs?)\b.*?\n(.*?)(?=^=head|\Z)/ism) { }
4312100TFif ($param_section)
431850TFif ($line =~ /C<\$(\w+)>\s*\((Required|Mandatory)\)/i)
4326100TFif ($line =~ /^\s*\$(\w+)\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i or $line =~ /^\s*C<\$(\w+)>\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i)
4331100TFif $desc
4334100TFif $name =~ /^(self|class|pkg|proto|klass|return|returns?)$/i
4339100TFunless (exists $params{$name}{'position'})
434550TFif $type eq "int"
434650TFif $type eq "num" or $type eq "float"
434750TFif $type eq "bool"
434850TFif $type eq "array"
434950TFif $type eq "hash"
4354100TFif ($constraint)
4361100TFif ($full_text =~ /\boptional\b/i) { }
100TFelsif ($full_text =~ /required|mandatory/i) { }
4370100TFif ($desc =~ /\b(email|url|uri|path|filename)\b/i)
4377100TFif ($desc and $desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
438250TFif (my $values = $self->_prose_memberof($desc))
4388100TF$constraint ? :
100TF$desc ? :
4400100TFif exists $params{$name}
440350TFif $desc
4406100TFif $name =~ /^(self|class|pkg|proto|klass|return|returns?)$/i
441150TFif $type eq "int"
441250TFif $type eq "num" or $type eq "float"
441350TFif $type eq "bool"
441450TFif $type eq "array"
441550TFif $type eq "hash"
442050TFif ($constraint)
442650TFif ($desc)
442750TFif ($desc =~ /\boptional\b/i) { }
50TFelsif ($desc =~ /required|mandatory/i) { }
443450TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
443950TFif (my $values = $self->_prose_memberof($desc))
444550TF$constraint ? :
447550TFunless defined $name and length $name
448050TFif $name =~ /^(self|class|pkg|proto|klass|return|returns?)$/i
4486100TFif ($desc =~ /^\s*(string|integer|int|number|num|float|boolean|bool|array|arrayref|hash|hashref|any)\b(?:\s*\(([^)]+)\))?/i) { }
449150TFif $type eq "int"
449250TFif $type eq "num" or $type eq "float"
449350TFif $type eq "bool"
449450TFif $type eq "array"
449550TFif $type eq "hash"
4499100TFif ($constraint)
450650TFif ($desc =~ /\bstring\b/i) { }
100TFelsif ($desc =~ /\b(int|integer)\b/i) { }
50TFelsif ($desc =~ /\b(num|number|float)\b/i) { }
50TFelsif ($desc =~ /\b(bool|boolean)\b/i) { }
100TFelsif ($desc =~ /\bhashref\b/i) { }
4528100TFif ($optionality_text =~ /\boptional\b/i) { }
100TFelsif ($optionality_text =~ /\b(?:required|mandatory)\b/i) { }
453550TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
4540100TFif (my $values = $self->_prose_memberof($desc))
455250TFif (exists $params{$param})
4554100TFunless defined $params{$param}{'optional'}
4557100TFdefined $pod_defaults->{$param} ? :
456450TFif $name =~ /^(self|class|pkg|proto|klass)$/i
4578100TFif ($pod =~ /=head[34]\s+Input\b(.*?)(?==head|\z)/is)
4583100TFunless $block =~ /\A[\[\{]/
4585100TFif ($block =~ /\A\[/) { }
100TFelsif ($block =~ /\A\{/) { }
4592100TFif (defined $name)
459450TFif (my $t = $self->_map_formal_input_type($spec))
459850TFif (defined(my $opt = _spec_optionality($spec)))
4608100TFif $name =~ /^(self|class|pkg|proto|klass)$/i
461150TFif (my $t = $self->_map_formal_input_type($spec))
4615100TFif (defined(my $opt = _spec_optionality($spec)))
4618100TFif ($spec =~ /\bmemberof\s*=>\s*\[([^\]]*)\]/i)
462450TFif (@vals)
4630100TFif ($spec =~ /\bmin\s*=>\s*(\d+)/i)
4633100TFif ($spec =~ /\bmax\s*=>\s*(\d+)/i)
4640100TFif (exists $params{$name}{'min'} or exists $params{$name}{'max'})
464350TFif ($spec =~ /\bisa\s*=>\s*['"]([^'"]+)['"]/i)
4669100TFunless ($block =~ /\A[\[\{]/)
467250TFif $bare_name =~ /^(self|class|pkg|proto|klass)$/i
4674100TFunless $own =~ /\brequired\s*=>\s*(0|1)/i
467550TFif $own =~ /\boptional\s*=>\s*(?:0|1)/i
468250TFif (my $shape = _pod_nested_input_shape($bare_type // "", $desc))
4697100TFunless $params{$name}
4698100TFif defined $params{$name}{'memberof'}
470050TFif (my $values = $self->_prose_memberof($text))
4732100TFunless $spec =~ /\btype\s*=>\s*(?:['"]([^'"]+)['"]|([A-Z_]+))/i
4733100TFdefined $1 ? :
4759100TFif exists $map{$t}
4795100TFunless defined $pod and length $pod
4796100TFunless $pod =~ /=head[34]\s+Input\b(.*?)(?==head|\z)/is
4800100TF$1 =~ /^\s*\$?class\b/im ? :
482050TFunless defined $code
485350TFunless defined $code
4855100TFif ($node and $node->can("tokens"))
4857100TF$_->isa('PPI::Token::Comment') ? :
487950TFunless defined $text
488050TFif $text =~ /\barrayref\b|\barray\s+of\b|\blist\s+of\b/i
488150TFif $text =~ /\bhashref\b|\bhash\s+of\b/i
488250TFif $text =~ /\bboolean\b|\bbool\b/i
488350TFif $text =~ /\binteger\b|\bint\b/i
488450TFif $text =~ /\bnumber\b|\bfloat\b/i
4885100TFif $text =~ /\bstring\b|\btext\b/i
4920100TFif (not defined $name) { }
4921100TFunless $line =~ /^\s*(\w+)\s*=>\s*\{(.*)$/
4930100TFif $depth > 0
493250TFif $depth == 0
495250TFif ($body =~ /\benum\s*=>\s*\[([^\]]*)\]/)
49540TFif @values
4968100TFunless defined $type and length $type
496950TFunless defined $desc and not ref $desc and length $desc
4971100TFif ($type eq "arrayref" and $desc =~ /\bof\s+\{([^}]+)\}/i)
4976100TFif ($desc =~ /\b\Q$key\E\s*--\s*one\s+of:\s*([^\n]+)/i)
497850TFif @values
498250TFif %element
4987100TFif ($type eq "arrayref" and $desc =~ /\bhashrefs?\b/i)
4991100TFif $type eq "hashref" and $desc =~ /=>\s*\w+\s+hashref\b/i
500250TFunless defined $number
5041100TFif (my(@dump) = _pod_input_hash_dump($block))
5045100TFif $name =~ /^(?:self|class|pkg|proto|klass|returns?)$/i
505250TFif (defined $fields->{'type'})
505450TFif defined $type
5058100TF$fields->{'optional'} ? :
506050TFif defined $fields->{'isa'} and not $fields->{'isa'} =~ /\Aundef\z/i
506450TFif ref $fields->{'enum'} eq "ARRAY" and @{$fields->{'enum'};}
5066100TFif defined $fields->{'min'} and $fields->{'min'} =~ /\A-?\d/
5068100TFif defined $fields->{'max'} and $fields->{'max'} =~ /\A-?\d/
5077100TFif (my $shape = _pod_nested_input_shape($p->{'type'}, $desc))
508250TFdefined $p->{'type'} ? :
508750TFif $count
5102100TFif ($line =~ /^(\s{0,8})(\\?[\$\@%]\w+\s*,\s*(?:\\?[\$\@%]\w+\s*,\s*)*\\?[\$\@%]\w+)\s*(.*)$/) { }
5115100TFif ($line =~ /^\s{0,8}(\w+)\s*:\s*\\?[\$\@%](\w+)\s+#\s*(\S.*)$/) { }
100TFelsif ($line =~ /^\s{0,8}\\?[\$\@%]?(\w+)\s*(?::|=>)\s*(\S.*)$/) { }
100TFelsif ($line =~ /^\s{0,8}\\?[\$\@%](\w+)\s+(SCALAR|ARRAYREF|HASHREF|CODEREF|CODE|OBJECT|GLOB)\b\s*,?\s*(.*)$/i) { }
100TFelsif ($line =~ /^\s*\\?[\$\@%](\w+)\s+#\s*(\S.*)$/) { }
100TFelsif ($line =~ /^\s{0,8}\\?[\$\@%](\w+)\s+(\S.*)$/) { }
513050TFunless defined $first and exists $types{lc $first}
5146100TFif defined $routine and defined $row_routine and $row_routine ne $routine
5148100TFif $name =~ /^(?:self|class|pkg|proto|klass|returns?)$/i
5155100TFif ($prose) { }
5160100TFif not defined $type and defined $type_word
516250TFdefined $type_word ? :
516350TFif not defined $type and $prose
5171100TFunless defined $p->{'position'}
5172100TFif defined $type
5178100TFif (my $shape = _pod_nested_input_shape($type, $spec))
5182100TFif ($spec =~ /\boptional\b/i or $spec =~ /\bdefault\b/i) { }
100TFelsif ($spec =~ /\b(?:required|mandatory)\b/i) { }
5193100TFif (defined $type and $type eq "arrayref" and $spec =~ /\b(?:one\s+or\s+more|at\s+least\s+one|non-empty)\b/i)
5195100TFunless defined $p->{'optional'}
5200100TFif (defined $type and $type eq "string" and $spec =~ /\b(?:readable|existing)\b[^;:]*\bfile\b/i)
5207100TFif (defined $type and $type eq "string" and $spec =~ /\bdir(?:ectory)?\b/i and $spec =~ /\b(?:existing|readable|writable)\b/i)
5215100TFif ($name =~ /\A(?:bytes|blob)\z/i or $spec =~ /\braw\s+bytes\b|file'?s\s+contents|\bbinary\s+(?:data|contents)\b/i)
5222100TFif ($spec =~ /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/) { }
100TFelsif ($spec =~ /(-?\d[\d_]*)\s+to\s+(-?\d[\d_]*)/) { }
5243100TFif (defined $type and $type =~ /\A(?:integer|number)\z/ and $spec =~ /\bdefault\b\s*\(?\s*(-?\d[\d_]*)/i)
525050TFif defined $p->{'max'} and $default > 0 and $p->{'max'} >= 10 * $default and !defined($p->{'min'}) || $default >= $p->{'min'}
525350TFif (my $values = $self->_prose_memberof($spec))
5257100TFdefined $type ? :
526750TFif ($block =~ /^(\w+)\s+hashref\s+keys\s*:\s*\n(.*?)(?=\n\s*\n|\z)/ism)
52710TFunless $line =~ /^\s{0,8}(\w+)\s*=>\s*(\S.*)$/
52770TFif $text =~ /\brequired\b[^;]*\bexcept\b/i
52790TFif ($text =~ /\(([^)]*\|[^)]*)\)/)
52810TFif @values
52840TFif ($text =~ m[match(?:es)?\s+C?<\s*/(.*?)/\s*>])
52920TFif (my($except) = $rows =~ /\bexcept\s+(?:bare\s+)?(\w+)/i)
52940TFunless grep {$_ eq $except;} @{$alternation{$key};}
52990TFif (%element)
53020TFunless ($p->{'_source'} // "") eq "input_spec"
53030TFunless ($p->{'type'} // "") =~ /^array/
53050TFunless defined $row_text{$name} and $row_text{$name} =~ /arrayref\s+of\s+\Q$kind\E\s+hashrefs/i
531650TFif ($block =~ /\bReserved keys\b/i)
53190TFunless ($p->{'_source'} // "") eq "input_spec"
53210TFunless defined $p->{'optional'} and not $p->{'optional'}
53240TFunless $type eq "arrayref" or $type eq "array" or $type eq "hashref"
53250TFif ref $p->{'schema'} eq "HASH"
53260TFif ref $p->{'memberof'} eq "ARRAY" and @{$p->{'memberof'};}
53280TFif $p->{'optional'}
5374100TFif keys %output
5377100TFkeys %output ? :
5408100TFif ($pod)
5414100TFif ($pod =~ /=head4\s+Output\b(.*?)(?==head|\z)/is)
5417100TFif ($block =~ /^\(/) { }
50TFelsif ($block =~ /^\[/) { }
100TFelsif ($block =~ /^\{/) { }
100TFelsif ($block =~ /\A(?:(?:Always|Usually)\s+)?(?:An?\s+)?(Hashref|Hash|Arrayref|Array|List)(?=\s*(?:of\b|:|\(|\[|\.|;|,|\z))/i) { }
54210TFunless ($block =~ /^\[\s*\]/)
5426100TFif ($block =~ /type\s*=>\s*['"]?(\w[\w:]*?)['"]?\s*[,}]/i) { }
50TFelsif ($block =~ /\bisa\s*=>/) { }
50TFelsif ($block =~ /^\{[^}]*\}/ and $block =~ /=>/) { }
542850TFif $type eq "scalar" or $type eq "scalarref" or $type eq "str"
542950TFif $type eq "int"
543050TFif $type eq "float" or $type eq "num"
543150TFif $type eq "bool"
543250TFif $type eq "hash"
543350TFif $type eq "array"
543450TFif ($VALID_OUTPUT_TYPES{$type}) { }
0TFelsif ($block =~ /\bisa\s*=>/) { }
545750TF$word =~ /^array|^list/ ? :
5464100TFif ($pod =~ /Returns?:\s+([^\n]+(?:\n[^\n]+){0,2})/is)
5471100TFif (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) { }
5490100TFif ($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) { }
549250TFif (defined $output->{'type'} and $output->{'type'} eq 'scalar') { }
5504100TFif ($returns_desc =~ /\b(true|false)\b/i)
550750TFif ($returns_desc =~ /\bundef\b/i)
5513100TFif (not $output->{'type'} and $pod =~ /returns?\s+(?:an?\s+)?(\w+)/i)
5516100TFif $type =~ /^(true|false|bool)$/
551850TFif $type eq "int"
551950TFif $type =~ /^(num|float)$/
552050TFif $type eq "array"
552150TFif $type eq "hash"
552350TFif ($type =~ /^\d+$/)
55240TFif ($type eq '1' or $type eq '0') { }
55260TFif ($pod =~ /1 on success.+0 (on|if) /i) { }
0TFelsif ($pod =~ /return 0 .+ 1 on success/) { }
553850TFif not $type and $pod =~ /returns?\s+.+\slist\b/i
5540100TFif ($VALID_OUTPUT_TYPES{$type}) { }
5578100TFunless $pod
559150TFif @param_matches
559350TFif ($param)
559550TFif ($default_text =~ /(\w+)\s*=\s*(.+)$/) { }
5615100TFif (@param_matches)
565350TFif ($code)
5656100TFif (@all_returns)
5663100TFif $ret =~ /^(?:0|1)(?:\s|$)/
5667100TFif ($boolean_count >= 2 and $boolean_count >= $total_count * "0.8")
566850TFunless ($output->{'type'})
5677100TFif ($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*=/) { }
5680100TFif ($method_name eq 'new') { }
568250TFif ($self->{'_document'} and my $package_stmt = $self->{'_document'}->find_first("PPI::Statement::Package"))
5692100TFif ($method_name eq 'new') { }
57060TFif ($self->{'_document'})
57080TF$pkg ? :
571450TFif ($content =~ /,/)
572050TFif ($self->{'_document'})
572250TF$pkg ? :
5734100TFif (@return_statements) { }
5740100TFif ($output->{'type'})
5755100TFif ($ret eq '1' or $ret eq '0') { }
100TFelsif ($ret =~ /^['"]/) { }
100TFelsif ($ret =~ /^-?\d+$/) { }
50TFelsif ($ret =~ /^-?\d+\.\d+$/) { }
100TFelsif ($ret =~ /\A(?:sprintf|join|lc|uc|lcfirst|ucfirst|quotemeta)\b/) { }
100TFelsif ($ret =~ /\Aundef\b/) { }
100TFelsif ($self->_returns_time_list($ret)) { }
100TFelsif ($ret =~ /^\[/) { }
100TFelsif ($ret =~ /^\{/) { }
100TFelsif ($ret =~ /^\\\%/) { }
50TFelsif ($ret =~ /^\\\@/) { }
100TFelsif ($ops_ret =~ m[                                    # Numeric expressions (heuristic, medium confidence).                                    # `->` is a method call, `//` a defined-or, and `-e` a file                                    # test, not operators.                                (?:                                    \+ | -(?!>|[A-Za-z]\b) | \* | (?<!\/)\/(?!\/) | (?<!\\)%                                  | \+\+ | --                                )                            ]x) { }
100TFelsif ($ret =~ /\|\|\s*\d+\b/) { }
100TFelsif ($ret =~ /^length[\s\(]/) { }
50TFelsif ($ret =~ /^pos[\s\(]/) { }
50TFelsif ($ret =~ /^index[\s\(]/) { }
50TFelsif ($ret =~ /^rindex[\s\(]/) { }
50TFelsif ($ret =~ /^ord[\s\(]/) { }
100TFelsif ($ops_ret =~ /=/ and $ops_ret =~ /\$\w+/) { }
100TFelsif ($ret =~ /\$\w+/) { }
5826100TFif ($numeric_ret =~ /\b\d+\b/) { }
584050TFif ($ref_ret =~ /\\\@/) { }
100TFelsif ($ref_ret =~ /\\\%/) { }
100TFelsif ($ret =~ /bless/) { }
50TFelsif ($ret =~ /^\{[^}]*\}$/) { }
50TFelsif ($ret =~ /^\[[^\]]*\]$/) { }
5857100TFif (keys %return_types)
5863100TFif keys %value_types > 1
586850TFunless $value_types{$b} <=> $value_types{$a}
5870100TFif ($return_types{'integer'} and not $return_types{'string'})
5871100TFif (not $output->{'type'} or $output->{'type'} eq "scalar")
5875100TFif (defined $min)
5880100TFunless ($output->{'type'})
5884100TFif ($most_common eq "number")
588650TFif (defined $min)
5894100TFif ($time_list and ($output->{'type'} // "") eq "array")
5903100TFif (@return_statements == 1 and $return_statements[0] eq 1)
590550TFif not $output->{'type'} or $output->{'type'} eq "scalar"
590650TFif $output->{'type'}
5947100TFunless not $output->{'type'} or $output->{'type'} eq "unknown"
5950100TFif ($pod and not $output->{'type'})
595250TFif ($pod =~ /returns?\s+(?:true|false|1|0)\s+(?:on|for|upon)\s+(?:success|failure|error|valid|invalid)/i)
595850TFif ($pod =~ /(?:method|sub)\s+(\w+)/)
59600TFif ($inferred_method_name =~ /^(is_|has_|can_|should_|contains_|exists_)/)
596850TFif ($code)
597350TFif ($true_returns + $false_returns >= 2) { }
100TFelsif ($true_returns + $false_returns == 1) { }
598250TFif ($code =~ /return\s+(?:\w+\s*[!=]=\s*\w+|\w+\s*>\s*\w+|\w+\s*<\s*\w+)\s*\?\s*(?:1|0)\s*:\s*(?:1|0)/)
598850TFif ($code =~ /return\s+[!\$\@\%]/)
599650TFif ($method_name)
5997100TFif ($method_name =~ /^(?:is_|has_|can_|should_|contains_|exists_|check_|verify_|validate_)/)
600150TFif ($method_name =~ /_ok$/)
6009100TFif ($boolean_score >= $BOOLEAN_SCORE_THRESHOLD)
601050TFif (not $output->{'type'} or $output->{'type'} eq "scalar" or $output->{'type'} eq "array" or $output->{'type'} eq "undef")
604050TFunless $code
6043100TFif ($code =~ /wantarray/)
6048100TFif ($code =~ /(wantarray[^;]+;)/s)
6052100TFif ($code =~ /wantarray\s*\?\s*\(([^)]+)\)\s*:\s*([^;]+)/s) { }
100TFelsif ($code =~ /wantarray\s*\?\s*([^:]+?)\s*:\s*([^;]+)/s) { }
50TFelsif ($code =~ /return[^;]*unless\s+wantarray.*?return\s*\(([^)]+)\)/s) { }
6081100TFif ($code =~ /return\s*\(\s*([^)]+)\s*\)\s*;/)
6090100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
609250TFunless defined $extracted
6095100TFif substr($rest, 0, 1) eq ","
6099100TFif ($comma_count > 0 and not $content =~ /\b(?:bless|new)\b/)
610150TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
612850TFunless defined $ret
6129100TFunless $ret =~ /(?:\A|[?:])\s*\(*\s*(?:localtime|gmtime)\s*\(/
613150TF$ret =~ /(?:localtime|gmtime)\s*\([^()]*\)\s*\)*\s*\z/ ? :
615850TFunless $code
6172100TFif ($method_name =~ /$void_patterns->{$type}/)
6192100TFif $ret eq ""
6193100TFif $ret =~ /^(if|unless)\s/
6194100TFif $ret eq 1
6195100TFif $ret eq "\$self"
6196100TFif ($ret =~ /\?\s*1\s*:\s*0\b/)
6209100TFif ($no_value_returns > 0 and $no_value_returns == $total_returns) { }
100TFelsif ($true_returns > 0 and $true_returns == $total_returns and $total_returns >= 1) { }
6217100TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
624750TFunless $code
6257100TFif $ret eq "\$self"
6261100TFif ($self_returns > 0 and $total_returns > 0)
6264100TFif ($ratio >= "0.8")
6269100TFif ($self->{'_document'})
627150TF$pkg ? :
630550TFunless $code
6324100TFif ($code =~ /return\s*\(\s*\)\s*(?:if|unless|;)/)
6334100TFif ($1 eq '0') { }
6341100TFif ($zero_returns > 0 and $one_returns > 0)
6347100TFif ($code =~ /eval\s*\{/)
6349100TFif ($code =~ /eval\s*\{.*?\}[^}]*(?:if\s*\(\s*\$\@|catch|return\s+undef)/s)
636050TFif ($has_undef and $has_value and scalar @all_returns >= 2)
6366100TFif (scalar keys %error_patterns) { }
6370100TFif ($error_patterns{'undef_on_error'}) { }
100TFelsif ($error_patterns{'implicit_undef'}) { }
100TFelsif ($error_patterns{'empty_list'}) { }
100TFelsif ($error_patterns{'zero_on_error'}) { }
6384100TFif ($error_patterns{'exception_handling'})
6416100TFunless defined $expr
6421100TFif ($expr =~ /,/)
6426100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
642850TFunless defined $extracted
6431100TFif substr($rest, 0, 1) eq ","
6435100TFif ($comma_count > 0)
6441100TFif ($expr =~ /^\@\w+/ or $expr =~ /^qw\(/ or $expr =~ /^\@\{/)
6446100TFif ($expr =~ /scalar\s*\(/)
6451100TFif ($expr =~ /^\[/ or $expr =~ /^\\\@/)
6456100TFif ($expr =~ /^\{/ or $expr =~ /^\\\%/)
646150TFif ($expr =~ /^\%\w+/ or $expr =~ /^\%\{/)
6466100TFif ($expr =~ /^['"]/ or $expr =~ /['"]$/)
6472100TFif ($expr =~ /^[01]$/)
6477100TFif ($expr =~ /^-?\d+$/)
6481100TFif ($expr =~ /^-?\d+\.\d+$/)
648650TFif ($expr =~ /bless/)
6490100TFif ($expr =~ /\blength\s*\(/)
6518100TFunless $pod
6521100TFif ($pod =~ /returns?\s+(?:\$)?self\b/i or $pod =~ /chainable/i or $pod =~ /fluent\s+interface/i or $pod =~ /method\s+chaining/i)
6553100TFif (defined $output->{'type'} and $output->{'type'} eq "boolean" and not defined $output->{'value'})
655650TFif ($output->{'value'} and defined $output->{'type'} and $output->{'type'} ne "boolean")
6560100TFif (exists $output->{'type'})
6561100TFif (not $valid_types{$output->{'type'}})
6589100TFunless defined $text and length $text
6598100TFif ($plain =~ /\b(?:one\s+of|valid\s+values?\s*(?:are|is)?\s*:?|allowed\s+values?\s*(?:are|is)?\s*:?|accepted\s+values?\s*(?:are|is)?\s*:?|permitted\s+values?\s*(?:are|is)?\s*:?)\s*(.+)$/i) { }
100TFelsif ($plain =~ /\b(?:must\s+be\s+)?either\s+(.+)$/i) { }
100TFelsif ($plain =~ /\b(?:also\s+)?accepts\s+the\s+strings?\s+(.+)$/i) { }
6614100TFif @values < 2 or @values > 20
6619100TFunless $value =~ /\A[A-Za-z0-9_:.+-]+\z/
665150TFif (my $values = $self->_prose_memberof($constraint))
6656100TFif ($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+(.+)$/) { }
6675100TFif $param->{'type'} and $param->{'type'} eq "integer"
6676100TFif $param->{'type'} and $param->{'type'} eq "number"
668350TFif (&looks_like_number($val))
66840TFif ($op eq '<') { }
0TFelsif ($op eq '<=') { }
0TFelsif ($op eq '>') { }
0TFelsif ($op eq '>=') { }
6696100TFif (defined $param->{'max'})
6699100TFif (defined $param->{'min'})
6706100TFif (defined $param->{'min'} or defined $param->{'max'} or $param->{'memberof'})
6758100TFif ($code =~ /Params::Get/)
676250TFif $name =~ /^(self|class|pkg|proto|klass)$/i
6772100TFif ($params{$param}{'_default'} and not $params{$param}{'type'})
6774100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
678450TFif ($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) { }
680050TFif ($param_count++ > $self->{'max_parameters'})
6813100TFif ($code =~ /defined\s*\(\s*\$$param\s*\)/)
6819100TFif ($code =~ m[\s*\$$param\s*(?://|\|\|)=]) { }
100TFelsif ($code =~ m[\s*\$$param\s*(?!->)(?:[\+\-\*\%]|/(?!/)|(?:\+\+)|(?:--)|(?:[\+\-\*\%]=|/(?!/)=)|\+\$|\$[+-])]) { }
50TFelsif ($code =~ /\$\b$param\b\s*(?:\+0|\*1)/) { }
683950TFif ($code =~ /if\s*\(\s*!\s*defined\s*\(\s*\$$param\s*\)\s*\)\s*\{([^}]+)\}/s)
68410TFif ($block =~ /\b(croak|die|confess)\b/)
6848100TFif ($code =~ /\b(croak|die|confess)\b[^;]*\bunless\s+defined\s*\(\s*\$$param\s*\)/)
685450TFif ($code =~ /exists\s*\(\s*\$$param\s*\)/)
686050TFif ($code =~ /scalar\s*\(\s*\@?\$$param\s*\)/)
6898100TFif ($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/) { }
690050TF$reftype eq 'hash' ? :
100TF$reftype eq 'array' ? :
6917100TFunless ($p->{'type'})
6918100TFif ($code =~ /\@\{\s*\$$param\s*\}/ or $code =~ /push\s*\(\s*\@?\$$param/) { }
100TFelsif ($code =~ /\%\{\s*\$$param\s*\}/ or $code =~ /\$$param\s*->\s*\{/) { }
6930100TFif (not $p->{'type'} and $code =~ /\$$param\s*->\s*[A-Za-z_]\w*/)
6940100TFif (not $p->{'type'} and exists $p->{'_default'})
694250TFif (ref $default eq 'HASH') { }
50TFelsif (ref $default eq 'ARRAY') { }
6954100TFif (not $p->{'type'})
6964100TFif ($code =~ /\blooks_like_number\s*\(\s*\$$param\s*\)/) { }
100TFelsif ($ops_code =~ m[\$$param\s*(?:[\+\*\%]|-(?!>|[A-Za-z]\b)|(?<!/)/(?!/))] or $ops_code =~ m[(?:[\+\*\%]|-(?!>|[A-Za-z]\b)|(?<!/)/(?!/))\s*\$$param] or $ops_code =~ /\bint\s*\(\s*\$$param\s*\)/ or $ops_code =~ /\babs\s*\(\s*\$$param\s*\)/) { }
100TFelsif ($ops_code =~ /\$$param\s*(?:==|!=|<=|>=|<|>)/ or $ops_code =~ /(?:==|!=|<=|>=|<|>)\s*\$$param/) { }
706550TFunless defined $param and $param =~ /^\w+$/
7068100TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]DateTime['"]\s*\)/i)
7077100TFif ($code =~ /\$$param\s*->\s*(ymd|dmy|mdy|hms|iso8601|epoch|strftime)/)
708650TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]Time::Piece['"]\s*\)/i or $code =~ /\$$param\s*->\s*(strftime|epoch|year|mon|mday)/)
7097100TFif ($code =~ m[\$$param\s*=~\s*/([^/]+)/])
7099100TFif ($self->_looks_like_iso8601_regex($regex))
7109100TFif ($code =~ m[\$$param\s*=~\s*/.*?\\d\{4\}.*?\\d\{2\}.*?\\d\{2\}])
711850TFif ($code =~ /\$$param\s*>\s*\d{9,}/ or $code =~ /time\(\s*\)\s*-\s*\$$param/ or $code =~ /\$$param\s*-\s*time\(\s*\)/)
712950TFif ($code =~ /strptime\s*\(\s*\$$param/ or $code =~ /DateTime::Format::\w+\s*->\s*parse_datetime\s*\(\s*\$$param/)
7157100TFunless defined $regex and $regex =~ /[Tt]/ and $regex =~ /[Zz]/
7163100TF$regex =~ /${year}[^A-Za-z]{0,3}${short}[^A-Za-z]{0,3}$short/ ? :
719050TFunless defined $param and $param =~ /^\w+$/
7195100TFif ($code =~ /(?<![\w:])(?:open|close|read|print|say|sysread|syswrite)\s*\(?\s*\$$param/)
7204100TFif ($code =~ /\$$param\s*->\s*(readline|getline|print|say|close|flush|autoflush)/)
7215100TFif ($code =~ /(?:-[frwxoOeszlpSbctugkTBMAC])\s+\$$param/)
7217100TFif ($code =~ /-d\s+\$$param/) { }
722850TFif ($code =~ /File::(?:Spec|Basename)::\w+\s*\(\s*\$$param/ or $code =~ /(?:basename|dirname|fileparse)\s*\(\s*\$$param/)
723850TFif (defined $p->{'_default'} and $p->{'_default'} =~ m[^([A-Za-z]:\\|/|\./|\.\./)])
724650TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]IO::File['"]\s*\)/ or $code =~ /IO::File\s*->\s*new\s*\(\s*\$$param/)
727950TFunless defined $param and $param =~ /^\w+$/
7282100TFif ($code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i or $code =~ /ref\s*\(\s*\$args\{\s*['"]?${param}['"]?\s*\}\s*\)\s*eq\s*['"]CODE['"]/i)
729150TFif ($code =~ /\$$param\s*->\s*\(/ or $code =~ /\$$param\s*->\s*\(\s*\@_\s*\)/ or $code =~ /&\s*\{\s*\$$param\s*\}/)
7301100TFif ($param =~ /^(?:callback|cb|handler|sub|code|fn|func|on_\w+)$/i)
730950TFif ($code =~ /blessed\s*\(\s*\$$param\s*\)/ and $code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i)
734850TFunless defined $param and $param =~ /^\w+$/
7352100TFif ($code =~ m[unless\s+\$$param\s*=~\s*/\^?\(([^)]+)\)])
7355100TFunless $p->{'type'}
7365100TFif ($code =~ /\%(\w+)\s*=.*?qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
7368100TFif (defined $values_str and $code =~ /\$$hash_name\s*\{\s*\$$param\s*\}/)
737050TFunless $p->{'type'}
7380100TFif ($code =~ /grep\s*\{[^}]*\$${param}[^}]*\}\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
738350TFunless $p->{'type'}
7391100TFif ($code =~ /given\s*\(\s*\$$param\s*\)/)
739650TFif (@enum_values >= 2)
739750TFunless $p->{'type'}
7414100TFif (@if_values >= 3)
741550TFunless $p->{'type'}
742450TFif ($code =~ /\$$param\s*~~\s*\[([^\]]+)\]/ or $code =~ /\$$param\s*~~\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
74280TFif ($values_str =~ /['"]/) { }
74330TFif (@enum_values)
74340TFunless $p->{'type'}
7487100TFunless $condition =~ /\$$param\b/
7504100TFif ($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/) { }
7515100TFif $constraint
7516100TFif defined $message
7518100TFdefined $message ? :
7525100TFif ($code =~ /\b\Q$param\E\s*(<=|<|>=|>)\s*(-?\d+)/)
7531100TFif ($op eq '<=') { }
100TFelsif ($op eq '<') { }
100TFelsif ($op eq '>=') { }
50TFelsif ($op eq '>') { }
7585100TFif ($code =~ /sub\s+\w+\s*(?::\w+(?:\([^)]*\))?\s*)*\(((?:[^()]|\([^)]*\))*)\)\s*\{/s)
7589100TFif ($potential_sig =~ /[\$\%\@]/)
7599100TFif ($code =~ /my\s+\$(?:self|class)\s*=\s*\$_\[0\]/)
7603100TFif $name =~ /^(self|class|pkg|proto|klass)$/i
7611100TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s) { }
100TFelsif ($code =~ /my\s+\$self\s*=\s*shift/) { }
7618100TFif $name =~ /^(self|class|pkg|proto|klass)$/i
762550TFunless exists $params->{$name}{'position'}
763650TFif @shifts and $shifts[0] =~ /^(self|class|pkg|proto|klass)$/i
764550TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s)
76500TFif $param =~ /^(self|class|pkg|proto|klass)$/i
76580TFif ($seen{$param}++)
7696100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
770050TFunless defined $extracted
7704100TFif (substr($rest, 0, 1) eq ",")
771350TFif $current =~ /\S/
772150TFunless $part
772650TFif ($param_info)
7730100TFif ($name =~ /^(self|class|pkg|proto|klass)$/i)
7737100TF$param_info->{'optional'} ? :
100TF$param_info->{'_default'} ? :
7782100TFif ($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) { }
7791100TFif ($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) { }
7816100TFif ($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) { }
784250TFif $self->can("_infer_type_from_default")
7896100TFunless defined $default
7898100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
100TFelsif ($default =~ /^-?\d+$/) { }
100TFelsif ($default =~ /^-?\d+\.\d+$/) { }
50TFelsif ($default eq '1' or $default eq '0') { }
7945100TFif ($code =~ /sub\s+\w+\s+((?::\w+(?:\([^)]*\))?\s*)+)/s)
7950100TFif ($attr_section)
7954100TFif (defined $value and $value ne '') { }
7965100TFif ($attributes{'Returns'})
796750TFif ($return_type ne 1)
7972100TFif ($attributes{'lvalue'})
7976100TFif ($attributes{'method'})
8010100TFif ($code =~ /\$\w+\s*->\s*\@\*/)
8016100TFif ($code =~ /\$\w+\s*->\s*\%\*/)
8022100TFif ($code =~ /\$\w+\s*->\s*\$\*/)
8028100TFif ($code =~ /\$\w+\s*->\s*\&\*/)
8034100TFif ($code =~ /\$\w+\s*->\s*\@\[/)
8040100TFif ($code =~ /\$\w+\s*->\s*\%\{/)
8089100TFif ($modifiers =~ /:param(?:\(([^)]+)\))?/)
8092100TFif (defined $1) { }
8104100TFif ($modifiers =~ /=\s*([^:;]+)(?::|;|$)/)
810950TFdefined $field_info{'_default'} ? :
8113100TFif ($modifiers =~ /:isa\(([^)]+)\)/)
8160100TFunless $field->{'is_param'}
816950TFunless $p->{'_source'}
8170100TFif $field_name ne $param_name
8172100TFif ($field->{'_default'})
8177100TFif ($field->{'isa'})
8222100TFunless exists $params->{$param}
822350TFif $value =~ /->/
823350TFunless exists $params->{$param}
824350TFunless exists $params->{$param}
825350TFunless exists $params->{$param}
826350TFunless exists $params->{$param}
8273100TFunless exists $params->{$param}
82980TFunless exists $params->{$param}
830850TFunless exists $params->{$param}
8322100TFif (not keys %{$params;} || $code =~ /my\s+\$(?:self|class|pkg|proto|klass)\s*=\s*\$_\[0\]/)
832950TFif ($position == 0 and $var =~ /^(self|class|pkg|proto|klass)$/i) { }
8342100TFif ($position == 0 and $var =~ /^(self|class|pkg|proto|klass)$/i) { }
83540TFif ($index > 0 or not $var =~ /^(self|class|pkg|proto|klass)$/i)
8382100TFunless defined $default
8383100TFif ref $default
8392100TFif $rhs =~ /^\d+$/
839350TFunless $rhs =~ /^\$(\w+)$/
8402100TFif ($invert)
840750TFif ($op eq '<') { }
100TFelsif ($op eq '<=') { }
50TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
84090TFif not defined $p->{'max'} or $max < $p->{'max'}
841150TFif not defined $p->{'max'} or $val < $p->{'max'}
84140TFif not defined $p->{'min'} or $min > $p->{'min'}
8416100TFif not defined $p->{'min'} or $val > $p->{'min'}
84390TFif ($char eq '(') { }
0TFelsif ($char eq ')') { }
84430TFif ($depth < 0)
84490TFunless $balanced and $depth == 0
8455100TFunless $condition =~ /^length\s*\(\s*\$\Q$param\E\s*\)\s*([<>]=?)\s*(\d+|\$\w+)$/
845950TFunless defined $val
8485100TFif exists $self->{'_constants'}
848950TFunless ($doc)
8542100TFif ($code =~ /(die|croak|confess)\b[^{;]*\bif\b[^{;]*\$$param\b/s)
8551100TFif $code =~ /length\s*\(\s*\$$param\s*\)/
8557100TFunless defined $op
856550TFunless $block =~ /\b(?:croak|die|confess)\b/
856750TFunless defined $val
8573100TFif (not $guarded and $code =~ /\$$param\s*([<>]=?)\s*([+-]?(?:\d+\.?\d*|\.\d+))/)
85780TF&looks_like_number($val) ? :
8580100TFif ($op eq '<' or $op eq '<=') { }
50TFelsif ($op eq '>' or $op eq '>=') { }
858250TF$op eq '<' ? :
858350TFif not defined $p->{'max'} or $max < $p->{'max'}
8585100TF$op eq '>' ? :
858650TFif not defined $p->{'min'} or $min > $p->{'min'}
8591100TFif ($code =~ m[\$$param\s*=~\s*(?:qr?/([^/]+)/|(\$[\w:]+|\$\{\w+\}))])
8595100TFif (defined $variable) { }
50TFelsif (not _pattern_is_self_contained($body)) { }
863150TFunless defined $pattern and length $pattern
8632100TFif $pattern =~ /\\[QE]/
863350TFif $pattern =~ /(?<!\\)[\$\@]\w/
8670100TFif ($code =~ /(?:die|croak|confess)\s+[^;]*unless\s+(?:defined\s+)?\$$param/s)
8677100TFif ($code =~ /(?:croak|die|confess)\b[^;]*\bunless\b[^;]*?(?:length\s*\(?\s*\$$param\b|defined\s+\$$param\b[^;]*?\blength\b)/s)
8685100TFif (defined $default_value and not exists $p->{'_default'})
869050TFunless ($p->{'type'})
869150TFif (&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) { }
869250TF$default_value =~ /\./ ? :
870450TFref $default_value ? :
8709100TFif (not $default_value || exists $p->{'_default'} and $code =~ /\$$param\s*=\s*([^;{}]+?)(?:\s*[;}])/s)
8712100TFunless ($assignment =~ /\$$param/ or $assignment =~ /^shift/)
871650TFif (defined $possible_default)
8727100TFif (not $is_required and $code =~ /\b(?:if|unless)\s*\(\s*\$$param\s*\)/)
8733100TFif ($is_required)
8735100TFif exists $p->{'_default'}
8767100TFunless @documented == 1
8768100TFunless $self->_argument_style($code) eq "positional"
877650TF@code_names == 1 ? :
100TF$code_params->{$name} ? :
8781100TF$source ? :
880950TFunless defined $code
881450TFif $body =~ /\bmy\s+%\w+\s*=[^;]*\@_/s
8815100TFif $body =~ /\bmy\s*\(\s*[^)]*%\w+\s*\)\s*=\s*\@_/s
881650TFif $body =~ /\$_\s*\[\s*\d+\s*\]\s*(?:->\s*)?\{/
8817100TFif $body =~ /\$\w+\s*->\s*\{/
8819100TFif $body =~ /\$_\s*\[\s*\d+\s*\]/
8820100TFif $body =~ /\bmy\s+\$(?!self\b|class\b)\w+\s*=\s*shift\b/
882150TFif $body =~ /\bmy\s*\((?!\s*\$(?:self|class)\s*\))[^)]*\)\s*=\s*\@_/s
8886100TFunless $invalid
890950TFif (ref $pod eq "HASH" and ref $code eq "HASH")
8911100TFif exists $pod->{$code_name}
8913100TFunless defined $pos
8917100TFif not exists $code->{$_} and defined $pod->{$_}{'position'}
8919100TFunless defined $pod_name
8938100TFif $pod->{$param} and defined $pod->{$param}{'position'}
893950TFif $sig->{$param} and defined $sig->{$param}{'position'}
8940100TFif $code->{$param} and defined $code->{$param}{'position'}
8943100TFif (@positions)
89460TFunless $pos_count{$b} <=> $pos_count{$a}
894750TFunless exists $p->{'position'}
8951100TFif ($pod->{$param})
8959100TFunless exists $pod->{$param}{$key} and defined $pod->{$param}{$key}
8965100TFif ($code->{$param})
8967100TFif $key eq "_source"
8968100TFif $key eq "position"
8979100TFif (not exists $p->{$key} or $key eq "type" and $from_pod and $p->{'type'} eq "string" and $code->{$param}{$key} ne "string" and not $heuristic_type)
8983100TFif $is_constraint{$key}
899050TFif ($sig->{$param})
89920TFif $key eq "_source"
89930TFif $key eq "position"
89940TFif defined $p->{$key}
89960TFif $is_constraint{$key}
9010100TFif ($self->{'verbose'})
901650TFdefined $p->{'position'} ? :
50TFdefined $p->{'optional'} ? :
9047100TF$pod_param ? :
9048100TF$code_param ? :
9051100TFif (defined $pod_optional) { }
100TFelsif (defined $code_optional) { }
50TFelsif (keys %$merged_param > 0) { }
9101100TFunless keys %$params
9113100TFif ($p->{'type'}) { }
9114100TFif ($p->{'type'} eq 'string' and $p->{'min'} || $p->{'max'} || $p->{'matches'}) { }
100TFelsif ($p->{'type'} eq 'string') { }
9129100TFif (defined $p->{'min'})
9133100TFif (defined $p->{'max'})
9137100TFif (defined $p->{'optional'})
9141100TFif ($p->{'matches'})
9145100TFif ($p->{'isa'})
9151100TFif (defined $p->{'position'})
9157100TFif (exists $p->{'_default'})
9163100TFif ($p->{'semantic'})
917750TF$count ? :
9180100TF$count == 1 ? :
918650TFif (@sorted_params)
9191100TFif (@sorted_params > 1)
9200100TFif ($avg >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_LOW_THRESHOLD) { }
9249100TFunless keys %$output
9254100TFif ($output->{'type'}) { }
9262100TFif (defined $output->{'value'})
9268100TFif ($output->{'isa'})
9274100TFif ($output->{'_context_aware'})
927850TFif ($output->{'_list_context'})
9281100TFif ($output->{'_scalar_context'})
9287100TFif ($output->{'_error_return'})
9293100TFif ($output->{'_success_failure_pattern'})
9299100TFif ($output->{'_returns_self'})
9305100TFif ($output->{'_void_context'})
9311100TFif ($output->{'_error_handling'} and $output->{'_error_handling'}{'exception_handling'})
9320100TFif ($score >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_LOW_THRESHOLD) { }
9362100TFunless $schema->{'_analysis'}
937450TFif ($analysis->{'confidence_factors'}{'input'})
938550TFif ($analysis->{'confidence_factors'}{'output'})
939450TFif ($analysis->{'per_parameter_scores'})
9435100TFunless ($p->{'type'})
9439100TFunless (defined $p->{'optional'})
9481100TFunless ref $p eq "HASH"
9482100TFunless ($p->{'type'})
9533100TFunless @param_names
9581100TFif ($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') { }
9597100TFunless ($seen{$sig}++)
9633100TFif $param1 eq $param2
9636100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*if\s+\$$param2\s+&&\s+\$$param1/)
9642100TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
9649100TFif $found_reverse
9661100TFif ($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)
966650TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
967350TFif $found_reverse
9717100TFif $param1 eq $param2
9719100TFif ($code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param1\s+\|\|\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param2\s+\|\|\s+\$$param1/)
972550TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
9732100TFif $found_reverse
9745100TFif ($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)
975050TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
975750TFif $found_reverse
9802100TFif $param1 eq $param2
9805100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!\$$param2/)
981750TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!defined\s*\(\s*\$$param2\s*\)/)
9829100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i)
9872100TFif $param1 eq $param2
9876100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i and $code =~ /if\s+\$$param1\s+&&\s+!\$$param2/)
9921100TFif $param1 eq $param2
9924100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*!=\s*(\d+)/)
993950TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*<\s*(\d+)/)
9954100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+eq\s+['"]([^'"]+)['"]\s+&&\s+!\$$param2/)
9984100TFunless defined $self->{'output_dir'}
9986100TFunless -d $self->{'output_dir'}
9994100TFif ($self->{'_document'})
9996100TF$package_stmt ? :
10017100TFif ($schema->{'_analysis'}{'side_effects'}{'writes_file'})
10022100TFif ($schema->{'_analysis'}{'side_effects'}{'keeps_fd'})
10028100TFif $schema->{'skip'}
1003150TFif $schema->{'invocant'}
10034100TFif ($schema->{'input'})
10035100TFif (scalar keys %{$$schema{'input'};}) { }
10040100TFif ($param->{'name'})
1004250TFif ($name ne $param_name)
10060100TFif (@with_pos and grep {not $output->{'input'}{$_}{'named'};} @without_pos)
1006950TFif ($schema->{'output'} and scalar keys %{$$schema{"output"};})
10070100TFif (ref $schema->{'output'}{'_error_handling'} eq "HASH" and scalar keys %{$$schema{"output"}{"_error_handling"};} == 0)
1007950TFif ($schema->{'output'}{'type'} and $schema->{'output'}{'type'} eq "scalar")
10085100TFif ($schema->{'new'})
10087100TFif (ref $schema->{'new'} or $schema->{'new'} eq $package_name) { }
10088100TF$schema->{'new'} eq $package_name ? :
10096100TFunless (defined $schema->{'_confidence'}{'input'}{'level'})
10099100TFunless (defined $schema->{'_confidence'}{'output'}{'level'})
10104100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
1010850TFif ($schema->{'accessor'} and scalar keys %{$$schema{"accessor"};})
10118100TF$schema->{'relationships'} ? :
10120100TF$schema->{'new'} ? :
10159100TFif ($schema->{'input'})
10164100TFif ($p->{'semantic'})
10168100TFif ($p->{'enum'})
10172100TFif ($p->{'isa'})
10177100TFif (@param_notes)
10188100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
1019450TFunless $_->{'description'}
10202100TFif ($schema->{'_notes'} and scalar @{$schema->{'_notes'};})
10210100TFif ($schema->{'_analysis'})
10230100TFif ($schema->{'input'})
10234100TFif ($p->{'type'} and $p->{'type'} eq "coderef")
10238100TFif ($p->{'semantic'} and $p->{'semantic'} eq "filehandle")
10242100TFif ($p->{'isa'} and $p->{'isa'} =~ /DateTime/)
10248100TFif (@warnings)
10295100TFif defined $param->{$field}
10299100TFif defined $param->{'_source'} and length $param->{'_source'}
10303100TFif (ref $param->{'_constraint_source'} eq "HASH")
10307100TFif defined $source and length $source
1030950TFif keys %provenance
10313100TFif (my $semantic = $param->{'semantic'})
10314100TFif ($semantic eq 'datetime_object') { }
50TFelsif ($semantic eq 'timepiece_object') { }
100TFelsif ($semantic eq 'date_string') { }
50TFelsif ($semantic eq 'bytes') { }
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 'existing_file') { }
100TFelsif ($semantic eq 'directory') { }
100TFelsif ($semantic eq 'callback') { }
100TFelsif ($semantic eq 'enum') { }
1037950TFif (($param->{'_source'} // '') eq 'input_spec' and defined $param->{'type'} and $param->{'type'} ne 'string') { }
1038450TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY")
1039550TFif $param->{'_fixture'}
1039950TFif (ref $param->{'schema'} eq "HASH")
10409100TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY" and not $cleaned{'enum'} and not $formal_non_string)
10412100TFif ($param->{'memberof'} and ref $param->{'memberof'} eq "ARRAY")
10417100TFif ($param->{'isa'} and not $cleaned{'isa'})
10422100TFif ($param->{'format'})
10432100TFif (defined(my $pattern = $cleaned{'matches'}))
1043350TFif ((&reftype($pattern) // '') eq 'REGEXP') { }
50TFelsif (not ref $pattern) { }
104370TFif defined $body
1044150TFif ($@) { }
1045150TFif (ref $param->{'_stub_elements'} eq "HASH")
10458100TFunless ($cleaned{'semantic'} // "") =~ /^(?:directory|existing_file|bytes)$/
10483100TFif ($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') { }
10534100TFunless ref $input eq "HASH"
1053550TFunless defined $body and length $body
10543100TFif $1 ne $param
10548100TFif $body =~ /\b(?:PPI::Document->new|_load_schema|_slurp|read_file|slurp_file)\s*\(\s*\$$v\b/ or $body =~ /\bopen\b\s*\(?[^;]*['"]<[^;]*\$$v\b/
10559100TFunless $tests_existence
1056250TFif ref $spec eq "HASH"
10588100TFif $own =~ /\boptional\s*=>\s*(0|1)/i
10589100TFif $own =~ /\brequired\s*=>\s*(0|1)/i
10602100TFif (defined $1)
10603100TFif $depth == 0
10606100TFif ($2 eq "{")
10607100TFif ($depth == 0 and defined $pending)
1061450TFunless $depth > 0
10616100TFif ($depth == 0 and defined $name)
1064350TFunless ref $input eq "HASH"
1064750TFunless ref $spec eq "HASH"
1065050TFif ($type =~ /\bobject\b/ and not defined $spec->{'can'} and not defined $spec->{'isa'})
1065350TFif (($spec->{'semantic'} // "") eq "directory")
1067050TFref $body ? :
1067150TFunless defined $content and length $content
1067450TFunless ref $input eq "HASH"
1067950TFunless ref $spec eq "HASH"
10680100TFif $spec->{'optional'}
10683100TFunless $type eq "arrayref" or $type eq "array"
10696100TFunless $empty_guard or $elements_are_objects
10698100TF$empty_guard ? :
10711100TFunless %reasons
1072650TFunless defined $pod and length $pod
10728100TFif $pod =~ /\bsubclass(?:es)?\s+of\s+(?:C<)?([A-Z]\w*(?:::\w+)+)/
1072950TFif $pod =~ /\bisa\s*\(\s*['\"]?([A-Z]\w*(?:::\w+)+)/
1073050TFif $pod =~ /\binstances?\s+of\s+(?:C<)?([A-Z]\w*(?:::\w+)+)/
10752100TFunless %reasons
10755100TFunless defined $base and $base eq "Database::Abstraction"
1075950TFref $input->{'join_column'} eq 'HASH' ? :
1076050TFunless defined $join_column and not ref $join_column and length $join_column
1078450TFif (ref $input->{'join_column'} eq "HASH")
10795100TFunless ref $element eq "HASH" and ref $element->{'col'} eq "HASH"
1079650TFif ref $element->{'col'}{'memberof'} eq "ARRAY" and @{$element->{'col'}{'memberof'};}
1083550TFunless defined $body
10838100TFif $body =~ /\breturn\s*\{[^}]*\bdbh\s*=>/s and $pod =~ /\bdbh\b/
1084150TFif $body =~ /\$self\s*->\s*\{_sqlite_cache\}\s*=\s*\{/s and $body =~ /\bdbh\s*=>/
10846100TFif $pod =~ /\b(?:SQLite\s+)?cache/i and $body =~ /\$self\s*->\s*(?:_build_sqlite_cache|_sqlite_join|_sqlite_aggregate)\s*\(/
10864100TF$code =~ /\A\s*(?:my\s+[^;]+;\s*)*croak\b[^;]*;\s*\z/s ? :
1087650TFref $body ? :
1087750TFunless defined $content and length $content
1087950TFif $content =~ /\bcheck_abstract\s*\(/
10880100TFif $content =~ /\bcroak\b/ and $content =~ /\beq\s+__PACKAGE__\b/
1088250TFref $ctor_schema->{'input'} eq 'HASH' ? :
1088450TFunless exists $declared{$2}
10907100TFif $spec->{'optional'}
10914100TFif ($param_name =~ /(?:file|filename)/i)
10917100TFif ($param_name =~ /(?:dir|path)/i)
10923100TFif (ref $spec->{'_stub_elements'} eq "HASH")
10928100TFunless (exists $REP{$type})
1096950TFunless $doc
10973100TF$package_stmt ? :
10989100TFif ($method_name eq "new")
10993100TFif ($method_name =~ /^(create|build|construct|init|DESTROY)$/i)
11004100TFif ($is_singleton)
110160TFif ($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'};})
11024100TFif ($is_factory)
1103850TFif ($inheritance_info and $inheritance_info->{'use_parent_constructor'})
11050100TFif ($constructor_needs)
1106450TFif ($needs_other_object)
110680TFif $needs_other_object->{'package'}
110740TFif $result->{'package'}
11078100TFif ($is_factory and not $skip_object)
1108450TFif $is_factory->{'returns_class'}
11120100TFif ($method_name =~ /^(create_|make_|build_|get_)/i)
1112550TFif ($method_body)
11127100TFif ($method_body =~ /return\s+bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?/s or $method_body =~ /bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?.*return/s)
11132100TFif ($class_name =~ /^\$(class|self|package)$/) { }
100TFelsif ($class_name =~ /^\$/) { }
11146100TFif ($method_body =~ /return\s+([\$\w:]+)->new\(/s or $method_body =~ /([\$\w:]+)->new\(.*return/s)
1115150TFif ($target eq '$self' or $target eq 'shift' or $target =~ /^\$/) { }
100TFelsif ($target =~ /::/) { }
1116750TFif ($method_body =~ /return\s+([\$\w:]+)->(create_|make_|build_|get_)/i or $method_body =~ /([\$\w:]+)->(create_|make_|build_|get_).*return/is)
11176100TFif ($method_info and ref $method_info eq "HASH" and $method_info->{'pod'})
1117850TFif ($pod =~ /returns?\s+(?:an?\s+)?(object|instance|new\s+\w+)/i)
11218100TFunless $method_name =~ /^(instance|get_instance|singleton|shared_instance)$/i
1122550TFif ($method_body)
11227100TFif ($method_body =~ /(?:my\s+)?(?:our\s+)?\$(?:instance|_instance|singleton)\b/s or $method_body =~ /state\s+\$(?:instance|_instance|singleton)\b/s)
11234100TFif ($method_body =~ /return\s+\$instance\s+if\s+(?:defined\s+)?\$instance/ or $method_body =~ /unless\s+\$instance.*?=\s*.*?new/)
11241100TFif ($method_body =~ /\$instance\s*\|\|=\s*.*?new/ or $method_body =~ /\$instance\s*=\s*.*?new\s+unless\s+(?:defined\s+)?\$instance/)
11248100TFif ($method_body =~ /return\s+\$instance;/)
1125050TFunless $singleton_info{'confidence'}
1125450TFif keys %singleton_info > 0
11289100TFif ($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+|[\{\[])/) { }
11314100TFif ($method_body =~ /\$self\s*->\s*[\{\[]/)
11316100TFunless $instance_info{'confidence'} eq "high"
11320100TFif ($method_body =~ /\$self\s*->\s*(\w+)\s*\(/s)
1132550TFif @{$instance_info{'calls_instance_methods'};}
11329100TFif ($method_name =~ /^_/ and not $method_name =~ /^_new/)
1133250TFunless exists $instance_info{'confidence'}
11335100TFif keys %instance_info
11368100TFunless $doc
11379100TFif ($content =~ /use\s+(parent|base)\s+['"]?([\w:]+)['"]?/)
1138450TFif ($content =~ /use\s+(parent|base)\s+qw?[\(\[]?(.+?)[\)\]]?;/)
1139750TFif ($content =~ /(?:our\s+)?\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
11409100TFif ($content =~ /\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
11418100TFif ($method_body and $method_body =~ /SUPER::/)
1142050TFif ($method_body =~ /SUPER::new/)
11427100TFif $_[1]->isa("PPI::Statement::Sub")
11431100TFif ($has_own_new) { }
100TFelsif (@parent_classes) { }
11439100TFif keys %inheritance_info
1147350TFunless $doc
11477100TFif ($target_package ne $current_package)
11487100TFif $_[1]->isa("PPI::Statement::Sub")
11491100TFunless $new_method
11499100TFif ($body =~ /my\s*\(\s*\$(self|class)\s*,\s*(.+?)\)\s*=\s*\@_/s)
11503100TFif (@param_names)
1151750TFif (@shift_params)
11525100TFif ($body =~ /croak.*unless.*(?:defined\s+)?\$(\w+)/g)
11528100TFif ($body =~ /die.*unless.*(?:defined\s+)?\$(\w+)/g)
11532100TFif (@required_params)
11542100TFif ($requirements{'parameters'})
11545100TFif (defined $default)
11552100TFif (@optional_params)
11557100TFif keys %requirements
11588100TFunless $method_body
11597100TFif $class eq "main" or $class eq "__PACKAGE__" or $class =~ /^\$/
11601100TFif ($dependency_info{'creates_objects'})
11609100TFif ($method_body =~ /\$(\w+)->\w+\(/)
11623100TFif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->(?:new|create)/) { }
50TFelsif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->/) { }
11630100TFif (@object_classes)
11632100TFunless $dependency_info{'package'}
11639100TFif keys %dependency_info
1166250TFunless $doc
1166650TFif $_[1]->isa("PPI::Statement::Include") and $_[1]->type eq "use" and $_[1]->module =~ /^(parent|base)$/
1167150TFif ($parent_stmt)
11678100TFif $_[1]->isa("PPI::Statement")
1168150TFif ($isa_stmt and $isa_stmt->content =~ /['"](\w+(?:::\w+)*)['"]/)
11715100TFunless $package_stmt
11721100TFif $_[1]->isa("PPI::Statement::Sub")
1172450TFif ($has_new)
117300TFif $parent
11766100TFunless $param and $code
11776100TFif ($clean_code =~ /\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*\|\|\s*([^;]+)/)
1178050TFif defined $default
11784100TFif ($clean_code =~ m[\$$param\s*//=\s*([^;]+)])
11788100TFif defined $default
11793100TFif ($clean_code =~ /\$$param\s*=\s*defined\s+(?:\$$param|\$[a-zA-Z_]\w*)\s*\?\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*:\s*([^;]+)/)
1179750TFif defined $default
11801100TFif ($clean_code =~ /\$$param\s*=\s*([^;]+?)\s+unless\s+defined\s+(?:\$$param|\$[a-zA-Z_]\w*)/)
1180450TFif defined $default
11808100TFif ($clean_code =~ /\$$param\s*\|\|=\s*([^;]+)/)
1181250TFif defined $default
11816100TFif ($clean_code =~ m[\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*//\s*([^;]+)])
11820100TFif defined $default
11824100TFif ($clean_code =~ /if\s*\(\s*!defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
1182850TFif defined $default
11832100TFif ($clean_code =~ /unless\s*\(\s*defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
1183650TFif defined $default
11873100TFunless $code
11880100TFunless @{$hints{$k};}
11907100TFif ($code =~ /defined\s*\(\s*\$/)
11912100TFif ($code =~ /\beq\s*''/ or $code =~ /\blength\s*\(/)
11917100TFif ($code =~ /\$\w+\s*<\s*0/)
11945100TFif ($op eq '<') { }
100TFelsif ($op eq '<=') { }
100TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
11985100TFunless $pod
11991100TFif ($pod =~ /=head[12]\s+SYNOPSIS\s*(.+?)(?=\n=head|\z)/s)
12002100TFunless length $synopsis
1201150TFdefined $3 ? :
100TFdefined $2 ? :
12015100TFif %kv
12023100TFunless (scalar @examples)
1203250TFunless @args
1204350TFif (scalar @examples)
12088100TFunless defined $value
12098100TFif ($value =~ m[\|\||/{2}])
12108100TFif ($value =~ /^qq?\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^qw\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^q[qwx]?\s*([^a-zA-Z0-9\{\[])(.*?)\1$/s) { }
12117100TFif ($value =~ /^(['"])(.*)\1$/s)
12120100TFif ($from_code)
12131100TFunless ($from_code)
12140100TFunless ($value =~ /^\(/)
12145100TFif ($value =~ /^\{\s*\}$/)
12150100TFif ($value =~ /^\[\s*\]$/)
12155100TFif ($value =~ /^-?\d+(?:\.\d+)?$/)
12156100TFif ($value =~ /\./) { }
12164100TFif ($value =~ /^(true|false)$/i)
12165100TFlc $1 eq 'true' ? :
1216950TFif ($value eq '1') { }
50TFelsif ($value eq '0') { }
12176100TFif ($value eq "undef")
12181100TFif ($value eq "__PACKAGE__")
12189100TFif ($value =~ /^\$[a-zA-Z_]/ or $value =~ /\(.*\)/)
12190100TFif $value =~ /^\$|\@|\%/
12244100TFunless (($pod->{'_source'} // "") eq "input_spec")
12246100TFif (exists $pod_params->{$param} and not exists $code_params->{$param})
1225150TFif (not exists $pod_params->{$param} and exists $code_params->{$param})
12252100TFif ($param =~ /^(class|pkg|proto|klass)$/i)
12256100TFif ($param eq "self")
12265100TFif ($pod->{'type'} and $code->{'type'} and $pod->{'type'} ne $code->{'type'})
12266100TFif (not $self->_types_are_compatible($pod->{'type'}, $code->{'type'})) { }
12274100TFif (exists $pod->{'optional'} and exists $code->{'optional'} and $pod->{'optional'} != $code->{'optional'})
12276100TF$pod->{'optional'} ? :
12277100TF$code->{'optional'} ? :
1228250TFif ($pod->{'matches'} and $code->{'matches'} and $pod->{'matches'} ne $code->{'matches'})
12288100TFif (defined $pod->{'min'} and defined $code->{'min'} and $pod->{'min'} != $code->{'min'})
12292100TFif (defined $pod->{'max'} and defined $code->{'max'} and $pod->{'max'} != $code->{'max'})
12296100TFif (defined $pod->{'min'} and defined $code->{'max'} and $pod->{'min'} > $code->{'max'})
1230050TFif (defined $code->{'min'} and defined $pod->{'max'} and $code->{'min'} > $pod->{'max'})
12329100TFunless defined $val
12332100TFif $val =~ /^(0|off|none)$/i
12333100TFif $val =~ /^(1|warn|warning)$/i
12334100TFif $val =~ /^(2|fatal|die|error)$/i
12360100TFif $pod_type eq $code_type
12373100TFif (my $allowed = $compatible_types{$pod_type})
1237850TFif (my $allowed = $compatible_types{$code_type})
12443100TFif (my $errors = $schema->{'_pod_validation_errors'})
12445100TF$schema->{'_pod_disagreement'} ? :
12452100TFif (@reports) { }
12468100TFif $self->{'verbose'}