Branch Coverage

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

line%coveragebranch
134250TFunless exists $params->{'input_file'}
1358100TFunless (-f $self->{'input_file'})
144750TFunless my $document = "PPI::Document"->new($self->{'input_file'})
1469100TFunless $params->{'no_write'}
1500100TFunless (defined $document)
1504100TFif (@$pkgs == 0)
150650TF$package_stmt ? :
150850TFif @$pkgs > 1
155250TFunless defined $name
1553100TFif $name =~ /^(BEGIN|END|DESTROY|AUTOLOAD|CHECK|INIT|UNITCHECK)$/
1556100TFif ($name =~ /^_/ and not $name =~ /^_(new|init|build)/)
1557100TFunless $self->{'include_private'}
1574100TFif ($content =~ /\bclass\b/)
158250TFif ($content =~ /^\s*(before|after|around)\s+['"]?(\w+)['"]?\b/)
15920TFif ($next_sib and $next_sib->isa("PPI::Statement::Sub"))
1612100TFif ($seen{$n}++) { }
166650TFunless defined $extracted
168050TFif ($method_name =~ /^_/ and not $method_name =~ /^_(new|init|build)/)
16810TFunless $self->{'include_private'}
1746100TFif ($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')) { }
175250TFif ($comment =~ /#\s*(?:param|arg|input)\s+\$(\w+)\s*:\s*(.+)/i)
181850TFif ($method->{'fields'} and keys %{$$method{"fields"};})
1841100TFif ($self->{'strict_pod'} and $pod)
1852100TFif (@validation_errors)
1860100TFif ($self->{'strict_pod'} == 2) { }
1873100TFif ($validator_params) { }
1882100TFif (keys %$fields)
1910100TFif ($method->{'name'} ne "new" and $needs_object)
191750TFunless (ref $input_confidence)
193850TFif ($input_confidence->{'per_parameter'})
1957100TF$level_rank{$input_level} < $level_rank{$output_level} ? :
1963100TFif ($relationships and @{$relationships;})
1969100TFif keys %$attributes
1970100TFif keys %$postfix_derefs
1971100TFif keys %$fields
1974100TFif ($method->{'class'})
198450TFdefined $_ ? :
1992100TFif ($self->_method_has_numeric_intent($schema))
19980TFdefined $_ ? :
2002100TFdefined $v ? :
200350TFunless $seen{$key}++
200950TFif (keys %$hints)
2013100TFunless exists $schema->{'_yamltest_hints'}{$k}
2017100TFif ($level_rank{$overall} < $level_rank{$LEVEL_MEDIUM} and $level_rank{$overall} < $self->{'confidence_threshold'} * 4)
203550TFif ($schema->{'output'})
2104100TFif $schema->{'output'} and $schema->{'output'}{'type'} and $schema->{'output'}{'type'} =~ /^(number|integer)$/
2107100TFunless $schema->{'input'}
2108100TFif $p->{'optional'}
2109100TFif $p->{'type'} and $p->{'type'} =~ /^(number|integer)$/
2180100TFif (keys %fields_seen > 1)
218850TFif ($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*;/) { }
21960TFunless (defined $property)
21970TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=\s*shift\s*;/)
22170TFif (my $pod = $method->{'pod'})
22180TFif ($pod =~ /\b(LWP::UserAgent(::\w+)*)\b/)
224550TFunless (defined $property)
224650TFif ($code =~ /\$self\s*->\s*\{\s*['"]?([^}'"]+)['"]?\s*\}\s*=/)
2250100TFif ($code =~ /validate_strict/) { }
225650TFif ($code =~ /blessed\s*\(\s*\$(\w+)\s*\)/) { }
2285100TFif (my $pod = $method->{'pod'})
228650TFif ($pod =~ /\b(LWP::UserAgent(::\w+)*)\b/)
230450TFif (ref $schema->{'input'} eq "HASH")
230550TFif (scalar keys %{$$schema{"input"};} > 1)
2323100TFunless ($code =~ /\$self\s*->\s*\{\s*['"]?\Q$property\E['"]?\s*\}\s*=\s*(?:shift|\$\w+\s*=\s*shift|\@_|\$_\[\d+\])/)
2327100TFif (scalar @returns == scalar @self_returns)
2369100TFif ($schema->{'output'}{'_returns_self'}) { }
50TFelsif (scalar keys %{$$schema{'output'};} != 0) { }
237050TFif ($schema->{'output'}{'type'} ne "object")
237350TFif ($schema->{'output'}{'isa'} ne $self->{'_package_name'})
2384100TFif (exists $schema->{'accessor'})
238550TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'type'} =~ /setter|getset/ and $schema->{'input'})
2389100TFif ($in->{'type'} and $in->{'type'} eq "object")
239250TF$in->{'isa'} ? :
2403100TFif ($schema->{'accessor'}{'type'} and $schema->{'accessor'}{'property'} and $schema->{'accessor'}{'type'} =~ /getter|getset/ and !defined($schema->{'output'}{'type'}) || $schema->{'output'}{'type'} eq 'string')
2405100TFif (my $pod = $method->{'pod'})
2407100TFif ($pod =~ /\bUser[- ]?Agent\b.*\bobject\b/i)
248250TFunless $res->{'input'}
50TFif $res and ref $res eq "HASH" and keys %{{} unless $res->{'input'};}
251650TFif ($child->isa("PPI::Statement") or $child->isa("PPI::Statement::Expression"))
25250TFif ($tokens[$i]->isa('PPI::Token::Word') || $tokens[$i]->isa('PPI::Token::Quote') and $tokens[$i + 1]->isa("PPI::Structure::Constructor"))
25340TFunless $key and $val
25380TFunless $inner->isa("PPI::Statement") or $inner->isa("PPI::Statement::Expression")
25450TFunless $k and $v
25480TF$v->can('content') ? :
25490TFif defined $value
25510TFif ($keyname eq 'type') { }
0TFelsif ($keyname eq 'optional') { }
0TFelsif ($keyname =~ /^(min|max)$/ and &looks_like_number($value)) { }
0TFelsif ($keyname eq 'matches') { }
25540TF$value ? :
2604100TFif ref $code and $code->can("find")
2630100TFunless $code =~ /\bvalidate_strict\s*\(/
263250TFunless my $doc = $self->_ppi($code)
2635100TFif $_[1]->isa("PPI::Token::Word")
263650TFunless 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"); } )
264350TFunless (defined $list)
264550TFunless defined $next
2646100TFif ($next->content =~ /schema\s*=>\s*(\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})/s)
265350TFif (scalar keys %{$schema;})
266250TFunless $list
26660TFunless $schema_block
26690TFif $schema
2694100TFunless $code =~ /\bvalidate\s*\(/
269650TFunless my $doc = $self->_ppi($code)
2699100TFif $_[1]->isa("PPI::Token::Word")
270050TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validate" or $_[1]->content eq "Params::Validate::validate" if $_[1]->isa("PPI::Token::Word"); } )
270750TFunless (defined $list)
271150TFif ($schema_text)
2718100TFif (scalar keys %{$schema;})
272150TFif (my $type = $field->{'type'})
2722100TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
273950TFunless $list
27430TFunless $schema_block
27460TFif $schema
2787100TFif (substr($rest, 0, 1) eq "{")
279150TFunless defined $extracted
2795100TFif (substr($rest, 0, 1) eq ",")
2803100TFunless $found_comma
2836100TFunless $code =~ /\bvalidated_hash\s*\(/
283850TFunless my $doc = $self->_ppi($code)
2841100TFif $_[1]->isa("PPI::Token::Word")
284250TFunless my $calls = $doc->find(sub {         $_[1]->content eq "validated_hash" if $_[1]->isa("PPI::Token::Word"); } )
284950TFunless (defined $list)
285350TFif ($schema_text)
286150TFif (scalar keys %{$schema;})
286450TFif (my $isa = delete $field->{'isa'})
2867100TFif (exists $field->{'required'}) { }
2869100TF$required ? :
2873100TFif (ref $field->{'default'} eq "CODE")
288050TFif (my $type = $field->{'type'})
288150TFif ($type eq 'ARRAYREF') { }
50TFelsif ($type eq 'SCALAR') { }
28980TFunless $list
29020TFunless $schema_block
29050TFif $schema
293450TFunless $block and $block->can("children")
29380TFunless $result and ref $result eq "HASH" and $result->{'input'}
2975100TFexists $spec->{'optional'} ? :
3010100TFunless my $function = $self->_extract_function_name($code)
3012100TFunless my $doc = $self->{'_document'}
3013100TFunless my $stmt = $self->_find_signature_statement($doc, $function)
301550TFunless my $signature_expr = $self->_extract_signature_expression($stmt, $function)
3017100TFunless my $meta = $self->_compile_signature_isolated($function, $signature_expr)
3039100TFif $code =~ /^\s*sub\s+([a-zA-Z0-9_]+)/
3063100TFif $_[1]->isa("PPI::Statement")
3065100TFunless my $statements = $doc->find(sub {         $_[1]->content =~ /^\s*signature_for\b/ if $_[1]->isa("PPI::Statement"); } )
306950TFif ($content =~ /^\s*signature_for\s+\Q$function\E\b/)
3099100TFif ($content =~ /^\s*signature_for\s+\Q$function\E\s*=>\s*(.+?);?\s*$/s)
316650TFunless ($self->{'allow_signature_exec'})
317050TFif $self->{'verbose'}
31830TFif ($signature_expr =~ /\b(?:system|exec|open|fork|require|do|eval|qx)\b/)
31870TFif ($signature_expr =~ /[`{};]/)
32840TFif ($stderr and length $stderr)
333350TFunless $meta->{'parameters'}
3336100TFunless (exists $type_map{$p->{'type'}})
3344100TF$p->{'optional'} ? :
3352100TFif (my $ret = $meta->{'returns'})
335550TFunless (exists $type_map{$ret->{'type'}})
3412100TFunless $pod
3419100TFif ($pod =~ /=head2\s+\w+\s*\(([^)]+)\)/s)
342550TFif @sig_params and $sig_params[0] =~ /^(self|class)$/i
3440100TFif ($pod =~ /(?:Parameters?|Arguments?|Inputs?):?\s*\n((?:\s*\$.*\n)+)/is) { }
100TFelsif ($pod =~ /^=head\d+\s+(?:Parameters?|Arguments?|Inputs?)\b.*?\n(.*?)(?=^=head|\Z)/ism) { }
3445100TFif ($param_section)
345150TFif ($line =~ /C<\$(\w+)>\s*\((Required|Mandatory)\)/i)
3459100TFif ($line =~ /^\s*\$(\w+)\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i or $line =~ /^\s*C<\$(\w+)>\s*-\s*(\w+)(?:\s*\(([^)]+)\))?\s*,?\s*(.*)$/i)
3464100TFif $desc
3467100TFif $name =~ /^(self|class|return|returns?)$/i
3472100TFunless (exists $params{$name}{'position'})
347850TFif $type eq "int"
347950TFif $type eq "num" or $type eq "float"
348050TFif $type eq "bool"
348150TFif $type eq "array"
348250TFif $type eq "hash"
3487100TFif ($constraint)
3494100TFif ($full_text =~ /\boptional\b/i) { }
100TFelsif ($full_text =~ /required|mandatory/i) { }
3503100TFif ($desc =~ /\b(email|url|uri|path|filename)\b/i)
3510100TFif ($desc and $desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
3514100TF$constraint ? :
100TF$desc ? :
3526100TFif exists $params{$name}
352950TFif $desc
3532100TFif $name =~ /^(self|class|return|returns?)$/i
353750TFif $type eq "int"
353850TFif $type eq "num" or $type eq "float"
353950TFif $type eq "bool"
354050TFif $type eq "array"
354150TFif $type eq "hash"
354650TFif ($constraint)
355250TFif ($desc)
355350TFif ($desc =~ /\boptional\b/i) { }
50TFelsif ($desc =~ /required|mandatory/i) { }
356050TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
356550TF$constraint ? :
357550TFunless defined $name and length $name
358050TFif $name =~ /^(self|class|return|returns?)$/i
358650TFif ($desc =~ /^\s*(string|integer|int|number|num|float|boolean|bool|array|arrayref|hash|hashref|any)\b(?:\s*\(([^)]+)\))?/i) { }
35910TFif $type eq "int"
35920TFif $type eq "num" or $type eq "float"
35930TFif $type eq "bool"
35940TFif $type eq "array"
35950TFif $type eq "hash"
35990TFif ($constraint)
360650TFif ($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) { }
361950TFif ($desc =~ /\boptional\b/i) { }
100TFelsif ($desc =~ /required|mandatory/i) { }
362650TFif ($desc =~ m[matches?\s+(/[^/]+/|qr/.+?/)]i)
363650TFif (exists $params{$param})
3638100TFunless defined $params{$param}{'optional'}
3641100TFdefined $pod_defaults->{$param} ? :
364850TFif $name =~ /^(self|class)$/i
3662100TFif ($pod =~ /=head[34]\s+Input\b(.*?)(?==head|\z)/is)
3666100TFif ($block =~ /\A\[/) { }
100TFelsif ($block =~ /\A\{/) { }
3673100TFif (defined $name)
367550TFif (my $t = $self->_map_formal_input_type($spec))
367950TFif ($spec =~ /\boptional\s*=>\s*(0|1)/i)
368950TFif $name =~ /^(self|class)$/i
369250TFif (my $t = $self->_map_formal_input_type($spec))
3696100TFif ($spec =~ /\boptional\s*=>\s*(0|1)/i)
3729100TFunless $spec =~ /\btype\s*=>\s*['"]([^'"]+)['"]/i
3756100TFif exists $map{$t}
3800100TFif keys %output
3803100TFkeys %output ? :
3834100TFif ($pod)
3840100TFif ($pod =~ /=head4\s+Output\b(.*?)(?==head|\z)/is)
3843100TFif ($block =~ /^\(/) { }
50TFelsif ($block =~ /^\[/) { }
50TFelsif ($block =~ /^\{/) { }
38470TFunless ($block =~ /^\[\s*\]/)
385250TFif ($block =~ /type\s*=>\s*['"]?(\w[\w:]*?)['"]?\s*[,}]/i) { }
0TFelsif ($block =~ /\bisa\s*=>/) { }
385450TFif $type eq "hash"
385550TFif $type eq "array"
385650TFif ($VALID_OUTPUT_TYPES{$type}) { }
0TFelsif ($block =~ /\bisa\s*=>/) { }
3872100TFif ($pod =~ /Returns?:\s+([^\n]+(?:\n[^\n]+){0,2})/is)
3879100TFif (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) { }
3898100TFif ($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) { }
390050TFif (defined $output->{'type'} and $output->{'type'} eq 'scalar') { }
3912100TFif ($returns_desc =~ /\b(true|false)\b/i)
391550TFif ($returns_desc =~ /\bundef\b/i)
3921100TFif (not $output->{'type'} and $pod =~ /returns?\s+(?:an?\s+)?(\w+)/i)
3924100TFif $type =~ /^(true|false|bool)$/
392650TFif $type eq "int"
392750TFif $type =~ /^(num|float)$/
392850TFif $type eq "array"
392950TFif $type eq "hash"
393150TFif ($type =~ /^\d+$/)
39320TFif ($type eq '1' or $type eq '0') { }
39340TFif ($pod =~ /1 on success.+0 (on|if) /i) { }
0TFelsif ($pod =~ /return 0 .+ 1 on success/) { }
394650TFif not $type and $pod =~ /returns?\s+.+\slist\b/i
3948100TFif ($VALID_OUTPUT_TYPES{$type}) { }
3986100TFunless $pod
399950TFif @param_matches
400150TFif ($param)
400350TFif ($default_text =~ /(\w+)\s*=\s*(.+)$/) { }
402350TFif (@param_matches)
406150TFif ($code)
4064100TFif (@all_returns)
4071100TFif $ret =~ /^(?:0|1)(?:\s|$)/
4075100TFif ($boolean_count >= 2 and $boolean_count >= $total_count * "0.8")
407650TFunless ($output->{'type'})
4085100TFif ($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*=/) { }
408850TFif ($method_name eq 'new') { }
40900TFif ($self->{'_document'} and my $package_stmt = $self->{'_document'}->find_first("PPI::Statement::Package"))
4100100TFif ($method_name eq 'new') { }
41140TFif ($self->{'_document'})
41160TF$pkg ? :
412250TFif ($content =~ /,/)
412850TFif ($self->{'_document'})
413050TF$pkg ? :
4142100TFif (@return_statements) { }
4148100TFif ($output->{'type'})
4156100TFif ($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+/) { }
420150TFif ($ret =~ /\b\d+\b/) { }
421050TFif ($ret =~ /\\\@/) { }
50TFelsif ($ret =~ /\\\%/) { }
100TFelsif ($ret =~ /bless/) { }
50TFelsif ($ret =~ /^\{[^}]*\}$/) { }
50TFelsif ($ret =~ /^\[[^\]]*\]$/) { }
4227100TFif (keys %return_types)
4230100TFif ($return_types{'integer'} and not $return_types{'string'})
423150TFif (not $output->{'type'} or $output->{'type'} eq "scalar")
423550TFif (defined $min)
4240100TFunless ($output->{'type'})
4244100TFif ($most_common eq "number")
424650TFif (defined $min)
4256100TFif (@return_statements == 1 and $return_statements[0] eq 1)
425850TFif not $output->{'type'} or $output->{'type'} eq "scalar"
425950TFif $output->{'type'}
4300100TFunless not $output->{'type'} or $output->{'type'} eq "unknown"
4303100TFif ($pod and not $output->{'type'})
430550TFif ($pod =~ /returns?\s+(true|false|true|false|1|0)\s+(?:on|for|upon)\s+(success|failure|error|valid|invalid)/i)
431150TFif ($pod =~ /(?:method|sub)\s+(\w+)/)
43130TFif ($inferred_method_name =~ /^(is_|has_|can_|should_|contains_|exists_)/)
432150TFif ($code)
432650TFif ($true_returns + $false_returns >= 2) { }
100TFelsif ($true_returns + $false_returns == 1) { }
433550TFif ($code =~ /return\s+(?:\w+\s*[!=]=\s*\w+|\w+\s*>\s*\w+|\w+\s*<\s*\w+)\s*\?\s*(?:1|0)\s*:\s*(?:1|0)/)
434150TFif ($code =~ /return\s+[!\$\@\%]/)
434950TFif ($method_name)
4350100TFif ($method_name =~ /^(is_|has_|can_|should_|contains_|exists_|check_|verify_|validate_)/)
435450TFif ($method_name =~ /_ok$/)
4362100TFif ($boolean_score >= $BOOLEAN_SCORE_THRESHOLD)
436350TFif (not $output->{'type'} or $output->{'type'} eq "scalar" or $output->{'type'} eq "array" or $output->{'type'} eq "undef")
439350TFunless $code
4396100TFif ($code =~ /wantarray/)
4401100TFif ($code =~ /(wantarray[^;]+;)/s)
4405100TFif ($code =~ /wantarray\s*\?\s*\(([^)]+)\)\s*:\s*([^;]+)/s) { }
100TFelsif ($code =~ /wantarray\s*\?\s*([^:]+?)\s*:\s*([^;]+)/s) { }
50TFelsif ($code =~ /return[^;]*unless\s+wantarray.*?return\s*\(([^)]+)\)/s) { }
4434100TFif ($code =~ /return\s*\(\s*([^)]+)\s*\)\s*;/)
4443100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
444550TFunless defined $extracted
4448100TFif substr($rest, 0, 1) eq ","
4452100TFif ($comma_count > 0 and not $content =~ /\b(?:bless|new)\b/)
445450TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
448750TFunless $code
4501100TFif ($method_name =~ /$void_patterns->{$type}/)
4521100TFif $ret eq ""
4522100TFif $ret =~ /^(if|unless)\s/
4523100TFif $ret eq 1
4524100TFif $ret eq "\$self"
4525100TFif ($ret =~ /\?\s*1\s*:\s*0\b/)
4538100TFif ($no_value_returns > 0 and $no_value_returns == $total_returns) { }
100TFelsif ($true_returns > 0 and $true_returns == $total_returns and $total_returns >= 1) { }
4546100TFunless ($output->{'type'} and $output->{'type'} eq "boolean")
457650TFunless $code
4586100TFif $ret eq "\$self"
4590100TFif ($self_returns > 0 and $total_returns > 0)
4593100TFif ($ratio >= "0.8")
4598100TFif ($self->{'_document'})
460050TF$pkg ? :
463450TFunless $code
4653100TFif ($code =~ /return\s*\(\s*\)\s*(?:if|unless|;)/)
4663100TFif ($1 eq '0') { }
4670100TFif ($zero_returns > 0 and $one_returns > 0)
4676100TFif ($code =~ /eval\s*\{/)
467850TFif ($code =~ /eval\s*\{.*?\}[^}]*(?:if\s*\(\s*\$\@|catch|return\s+undef)/s)
468950TFif ($has_undef and $has_value and scalar @all_returns >= 2)
4695100TFif (scalar keys %error_patterns) { }
4699100TFif ($error_patterns{'undef_on_error'}) { }
100TFelsif ($error_patterns{'implicit_undef'}) { }
100TFelsif ($error_patterns{'empty_list'}) { }
100TFelsif ($error_patterns{'zero_on_error'}) { }
4713100TFif ($error_patterns{'exception_handling'})
4745100TFunless defined $expr
4750100TFif ($expr =~ /,/)
4755100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
475750TFunless defined $extracted
4760100TFif substr($rest, 0, 1) eq ","
4764100TFif ($comma_count > 0)
4770100TFif ($expr =~ /^\@\w+/ or $expr =~ /^qw\(/ or $expr =~ /^\@\{/)
4775100TFif ($expr =~ /scalar\s*\(/)
4780100TFif ($expr =~ /^\[/ or $expr =~ /^\\\@/)
4785100TFif ($expr =~ /^\{/ or $expr =~ /^\\\%/)
479050TFif ($expr =~ /^\%\w+/ or $expr =~ /^\%\{/)
4795100TFif ($expr =~ /^['"]/ or $expr =~ /['"]$/)
4801100TFif ($expr =~ /^[01]$/)
4806100TFif ($expr =~ /^-?\d+$/)
4810100TFif ($expr =~ /^-?\d+\.\d+$/)
481550TFif ($expr =~ /bless/)
4819100TFif ($expr =~ /\blength\s*\(/)
4847100TFunless $pod
4850100TFif ($pod =~ /returns?\s+(?:\$)?self\b/i or $pod =~ /chainable/i or $pod =~ /fluent\s+interface/i or $pod =~ /method\s+chaining/i)
4882100TFif (defined $output->{'type'} and $output->{'type'} eq "boolean" and not defined $output->{'value'})
488550TFif ($output->{'value'} and defined $output->{'type'} and $output->{'type'} ne "boolean")
4889100TFif (exists $output->{'type'})
4890100TFif (not $valid_types{$output->{'type'}})
4922100TFif ($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) { }
50TFelsif ($constraint =~ /(.+)?\s(.+)/) { }
4941100TFif $param->{'type'} and $param->{'type'} eq "integer"
4942100TFif $param->{'type'} and $param->{'type'} eq "number"
49490TFif (&looks_like_number($val))
49500TFif ($op eq '<') { }
0TFelsif ($op eq '<=') { }
0TFelsif ($op eq '>') { }
0TFelsif ($op eq '>=') { }
4962100TFif (defined $param->{'max'})
4965100TFif (defined $param->{'min'})
5013100TFif ($code =~ /Params::Get/)
501750TFif $name =~ /^(self|class)$/i
5027100TFif ($params{$param}{'_default'} and not $params{$param}{'type'})
5029100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
503950TFif ($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) { }
505550TFif ($param_count++ > $self->{'max_parameters'})
5068100TFif ($code =~ /defined\s*\(\s*\$$param\s*\)/)
5074100TFif ($code =~ m[\s*\$$param\s*(?://|\|\|)=]) { }
100TFelsif ($code =~ m[\s*\$$param\s*(?:[\+\-\*\%]|/(?!/)|(?:\+\+)|(?:--)|(?:[\+\-\*\%]=|/(?!/)=)|\+\$|\$[+-])]) { }
50TFelsif ($code =~ /\$\b$param\b\s*(?:\+0|\*1)/) { }
509450TFif ($code =~ /if\s*\(\s*!\s*defined\s*\(\s*\$$param\s*\)\s*\)\s*\{([^}]+)\}/s)
50960TFif ($block =~ /\b(croak|die|confess)\b/)
510350TFif ($code =~ /\b(croak|die|confess)\b[^;]*\bunless\s+defined\s*\(\s*\$$param\s*\)/)
510950TFif ($code =~ /exists\s*\(\s*\$$param\s*\)/)
511550TFif ($code =~ /scalar\s*\(\s*\@?\$$param\s*\)/)
5152100TFif ($code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"](ARRAY|HASH|SCALAR)['"]/gi) { }
100TFelsif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]([^'"]+)['"]\s*\)/i) { }
50TFelsif ($code =~ /bless\s+.*\$$param/) { }
515450TF$reftype eq 'hash' ? :
100TF$reftype eq 'array' ? :
5171100TFunless ($p->{'type'})
517250TFif ($code =~ /\@\{\s*\$$param\s*\}/ or $code =~ /push\s*\(\s*\@?\$$param/) { }
50TFelsif ($code =~ /\%\{\s*\$$param\s*\}/ or $code =~ /\$$param\s*->\s*\{/) { }
5180100TFif (not $p->{'type'} and exists $p->{'_default'})
518250TFif (ref $default eq 'HASH') { }
50TFelsif (ref $default eq 'ARRAY') { }
5194100TFif (not $p->{'type'})
5201100TFif ($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/) { }
530050TFunless defined $param and $param =~ /^\w+$/
5303100TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]DateTime['"]\s*\)/i)
5312100TFif ($code =~ /\$$param\s*->\s*(ymd|dmy|mdy|hms|iso8601|epoch|strftime)/)
532150TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]Time::Piece['"]\s*\)/i or $code =~ /\$$param\s*->\s*(strftime|epoch|year|mon|mday)/)
5331100TFif ($code =~ m[\$$param\s*=~\s*/.*?\\d\{4\}.*?\\d\{2\}.*?\\d\{2\}])
5340100TFif ($code =~ m[\$$param\s*=~\s*/.*?[Tt].*?[Zz].*?/])
534950TFif ($code =~ /\$$param\s*>\s*\d{9,}/ or $code =~ /time\(\s*\)\s*-\s*\$$param/ or $code =~ /\$$param\s*-\s*time\(\s*\)/)
536050TFif ($code =~ /strptime\s*\(\s*\$$param/ or $code =~ /DateTime::Format::\w+\s*->\s*parse_datetime\s*\(\s*\$$param/)
539350TFunless defined $param and $param =~ /^\w+$/
5396100TFif ($code =~ /(?:open|close|read|print|say|sysread|syswrite)\s*\(?\s*\$$param/)
5405100TFif ($code =~ /\$$param\s*->\s*(readline|getline|print|say|close|flush|autoflush)/)
5414100TFif ($code =~ /(?:-[frwxoOeszlpSbctugkTBMAC])\s+\$$param/)
542250TFif ($code =~ /File::(?:Spec|Basename)::\w+\s*\(\s*\$$param/ or $code =~ /(?:basename|dirname|fileparse)\s*\(\s*\$$param/)
543250TFif (defined $p->{'_default'} and $p->{'_default'} =~ m[^([A-Za-z]:\\|/|\./|\.\./)])
544050TFif ($code =~ /\$$param\s*->\s*isa\s*\(\s*['"]IO::File['"]\s*\)/ or $code =~ /IO::File\s*->\s*new\s*\(\s*\$$param/)
547350TFunless defined $param and $param =~ /^\w+$/
5476100TFif ($code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i)
548450TFif ($code =~ /\$$param\s*->\s*\(/ or $code =~ /\$$param\s*->\s*\(\s*\@_\s*\)/ or $code =~ /&\s*\{\s*\$$param\s*\}/)
5494100TFif ($param =~ /^(?:callback|cb|handler|sub|code|fn|func|on_\w+)$/i)
550250TFif ($code =~ /blessed\s*\(\s*\$$param\s*\)/ and $code =~ /ref\s*\(\s*\$$param\s*\)\s*eq\s*['"]CODE['"]/i)
554150TFunless defined $param and $param =~ /^\w+$/
5545100TFif ($code =~ m[unless\s+\$$param\s*=~\s*/\^?\(([^)]+)\)])
554850TFunless $p->{'type'}
5558100TFif ($code =~ /\%(\w+)\s*=.*?qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
5561100TFif (defined $values_str and $code =~ /\$$hash_name\s*\{\s*\$$param\s*\}/)
556350TFunless $p->{'type'}
5573100TFif ($code =~ /grep\s*\{[^}]*\$${param}[^}]*\}\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
557650TFunless $p->{'type'}
558450TFif ($code =~ /given\s*\(\s*\$$param\s*\)/)
55890TFif (@enum_values >= 2)
55900TFunless $p->{'type'}
5607100TFif (@if_values >= 3)
560850TFunless $p->{'type'}
561750TFif ($code =~ /\$$param\s*~~\s*\[([^\]]+)\]/ or $code =~ /\$$param\s*~~\s*qw\s*[\(\[<{]([^)\]>}]+)[\)\]>}]/)
56210TFif ($values_str =~ /['"]/) { }
56260TFif (@enum_values)
56270TFunless $p->{'type'}
5680100TFunless $condition =~ /\$$param\b/
5697100TFif ($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/) { }
5708100TFif $constraint
5709100TFif defined $message
5711100TFdefined $message ? :
5718100TFif ($code =~ /\b\Q$param\E\s*(<=|<|>=|>)\s*(-?\d+)/)
5724100TFif ($op eq '<=') { }
100TFelsif ($op eq '<') { }
100TFelsif ($op eq '>=') { }
50TFelsif ($op eq '>') { }
5778100TFif ($code =~ /sub\s+\w+\s*(?::\w+(?:\([^)]*\))?\s*)*\(((?:[^()]|\([^)]*\))*)\)\s*\{/s)
5782100TFif ($potential_sig =~ /[\$\%\@]/)
5792100TFif ($code =~ /my\s+\$(?:self|class)\s*=\s*\$_\[0\]/)
579650TFif $name =~ /^(self|class)$/i
5804100TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s) { }
100TFelsif ($code =~ /my\s+\$self\s*=\s*shift/) { }
5811100TFif $name =~ /^(self|class)$/i
581850TFunless exists $params->{$name}{'position'}
582950TFif @shifts and $shifts[0] =~ /^(self|class)$/i
583850TFif ($code =~ /my\s*\(\s*([^)]+)\)\s*=\s*\@_/s)
58430TFif $param =~ /^(self|class)$/i
58510TFif ($seen{$param}++)
5889100TFif (substr($rest, 0, 1) =~ /[(\[{]/)
589350TFunless defined $extracted
5897100TFif (substr($rest, 0, 1) eq ",")
590650TFif $current =~ /\S/
591450TFunless $part
591950TFif ($param_info)
5923100TFif ($name =~ /^(self|class)$/i)
5930100TF$param_info->{'optional'} ? :
100TF$param_info->{'_default'} ? :
5975100TFif ($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) { }
5984100TFif ($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) { }
6009100TFif ($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) { }
603550TFif $self->can("_infer_type_from_default")
6089100TFunless defined $default
6091100TFif (ref $default eq 'HASH') { }
100TFelsif (ref $default eq 'ARRAY') { }
100TFelsif ($default =~ /^-?\d+$/) { }
100TFelsif ($default =~ /^-?\d+\.\d+$/) { }
50TFelsif ($default eq '1' or $default eq '0') { }
6138100TFif ($code =~ /sub\s+\w+\s+((?::\w+(?:\([^)]*\))?\s*)+)/s)
6143100TFif ($attr_section)
6147100TFif (defined $value and $value ne '') { }
6158100TFif ($attributes{'Returns'})
616050TFif ($return_type ne 1)
6165100TFif ($attributes{'lvalue'})
6169100TFif ($attributes{'method'})
6203100TFif ($code =~ /\$\w+\s*->\s*\@\*/)
6209100TFif ($code =~ /\$\w+\s*->\s*\%\*/)
6215100TFif ($code =~ /\$\w+\s*->\s*\$\*/)
6221100TFif ($code =~ /\$\w+\s*->\s*\&\*/)
6227100TFif ($code =~ /\$\w+\s*->\s*\@\[/)
6233100TFif ($code =~ /\$\w+\s*->\s*\%\{/)
6282100TFif ($modifiers =~ /:param(?:\(([^)]+)\))?/)
6285100TFif (defined $1) { }
6297100TFif ($modifiers =~ /=\s*([^:;]+)(?::|;|$)/)
630250TFdefined $field_info{'_default'} ? :
6306100TFif ($modifiers =~ /:isa\(([^)]+)\)/)
6353100TFunless $field->{'is_param'}
636250TFunless $p->{'_source'}
6363100TFif $field_name ne $param_name
6365100TFif ($field->{'_default'})
6370100TFif ($field->{'isa'})
6415100TFunless exists $params->{$param}
641650TFif $value =~ /->/
642650TFunless exists $params->{$param}
643650TFunless exists $params->{$param}
644650TFunless exists $params->{$param}
645650TFunless exists $params->{$param}
6466100TFunless exists $params->{$param}
64910TFunless exists $params->{$param}
650150TFunless exists $params->{$param}
6515100TFif (not keys %{$params;} || $code =~ /my\s+\$(?:self|class)\s*=\s*\$_\[0\]/)
6522100TFif ($var eq 'class' and $position == 0 and $method->{'name'} eq 'new') { }
50TFelsif ($var eq 'self' and $position == 0 and $method->{'name'} ne 'new') { }
653850TFif ($var eq 'class' and $position == 0 and $method->{'name'} eq 'new') { }
50TFelsif ($var eq 'self' and $position == 0 and $method->{'name'} ne 'new') { }
65530TFif ($var ne "class" or $position > 0 or $method->{'name'} ne "new")
6581100TFunless defined $default
6582100TFif ref $default
6618100TFif ($code =~ /(die|croak|confess)\b[^{;]*\bif\b[^{;]*\$$param\b/s)
6623100TFif ($code =~ /length\s*\(\s*\$$param\s*\)\s*([<>]=?)\s*(\d+)/)
6626100TFif ($op eq '<') { }
50TFelsif ($op eq '<=') { }
100TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
6639100TFif (not $guarded and $code =~ /\$$param\s*([<>]=?)\s*([+-]?(?:\d+\.?\d*|\.\d+))/)
66440TF&looks_like_number($val) ? :
6646100TFif ($op eq '<' or $op eq '<=') { }
50TFelsif ($op eq '>' or $op eq '>=') { }
664850TF$op eq '<' ? :
664950TFif not defined $p->{'max'} or $max < $p->{'max'}
6651100TF$op eq '>' ? :
665250TFif not defined $p->{'min'} or $min > $p->{'min'}
6657100TFif ($code =~ m[\$$param\s*=~\s*((?:qr?/[^/]+/|\$[\w:]+|\$\{\w+\}))])
666250TFif ($pattern =~ m[^qr?/([^/]+)/$]) { }
6703100TFif ($code =~ /(?:die|croak|confess)\s+[^;]*unless\s+(?:defined\s+)?\$$param/s)
6709100TFif (defined $default_value and not exists $p->{'_default'})
671450TFunless ($p->{'type'})
671550TFif (&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) { }
671650TF$default_value =~ /\./ ? :
672850TFref $default_value ? :
6733100TFif (not $default_value || exists $p->{'_default'} and $code =~ /\$$param\s*=\s*([^;{}]+?)(?:\s*[;}])/s)
673650TFunless ($assignment =~ /\$$param/ or $assignment =~ /^shift/)
674050TFif (defined $possible_default)
6749100TFif ($is_required)
6751100TFif exists $p->{'_default'}
6803100TFif $pod->{$param} and defined $pod->{$param}{'position'}
680450TFif $sig->{$param} and defined $sig->{$param}{'position'}
6805100TFif $code->{$param} and defined $code->{$param}{'position'}
6808100TFif (@positions)
68110TFunless $pos_count{$b} <=> $pos_count{$a}
681250TFunless exists $p->{'position'}
6816100TFif ($pod->{$param})
6821100TFif ($code->{$param})
6823100TFif $key eq "_source"
6824100TFif $key eq "position"
6828100TFif (not exists $p->{$key} or $key eq "type" and $from_pod and $p->{'type'} eq "string" and $code->{$param}{$key} ne "string")
683750TFif ($sig->{$param})
68390TFif $key eq "_source"
68400TFif $key eq "position"
6853100TFif ($self->{'verbose'})
685950TFdefined $p->{'optional'} ? :
6890100TF$pod_param ? :
6891100TF$code_param ? :
6894100TFif (defined $pod_optional) { }
100TFelsif (defined $code_optional) { }
100TFelsif (keys %$merged_param > 0) { }
6944100TFunless keys %$params
6956100TFif ($p->{'type'}) { }
6957100TFif ($p->{'type'} eq 'string' and $p->{'min'} || $p->{'max'} || $p->{'matches'}) { }
100TFelsif ($p->{'type'} eq 'string') { }
6972100TFif (defined $p->{'min'})
6976100TFif (defined $p->{'max'})
6980100TFif (defined $p->{'optional'})
6984100TFif ($p->{'matches'})
6988100TFif ($p->{'isa'})
6994100TFif (defined $p->{'position'})
7000100TFif (exists $p->{'_default'})
7006100TFif ($p->{'semantic'})
702050TF$count ? :
7023100TF$count == 1 ? :
702950TFif (@sorted_params)
7034100TFif (@sorted_params > 1)
7043100TFif ($avg >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($avg >= $CONFIDENCE_LOW_THRESHOLD) { }
7092100TFunless keys %$output
7097100TFif ($output->{'type'}) { }
7105100TFif (defined $output->{'value'})
7111100TFif ($output->{'isa'})
7117100TFif ($output->{'_context_aware'})
712150TFif ($output->{'_list_context'})
7124100TFif ($output->{'_scalar_context'})
7130100TFif ($output->{'_error_return'})
7136100TFif ($output->{'_success_failure_pattern'})
7142100TFif ($output->{'_returns_self'})
7148100TFif ($output->{'_void_context'})
7154100TFif ($output->{'_error_handling'} and $output->{'_error_handling'}{'exception_handling'})
7163100TFif ($score >= $CONFIDENCE_HIGH_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_MEDIUM_THRESHOLD) { }
100TFelsif ($score >= $CONFIDENCE_LOW_THRESHOLD) { }
7205100TFunless $schema->{'_analysis'}
721750TFif ($analysis->{'confidence_factors'}{'input'})
722850TFif ($analysis->{'confidence_factors'}{'output'})
723750TFif ($analysis->{'per_parameter_scores'})
7278100TFunless ($p->{'type'})
7282100TFunless (defined $p->{'optional'})
7324100TFunless ref $p eq "HASH"
7325100TFunless ($p->{'type'})
7376100TFunless @param_names
7424100TFif ($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') { }
7440100TFunless ($seen{$sig}++)
7476100TFif $param1 eq $param2
7479100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*if\s+\$$param2\s+&&\s+\$$param1/)
7485100TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
7492100TFif $found_reverse
7504100TFif ($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)
750950TFif ($rel->{'type'} eq "mutually_exclusive" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
751650TFif $found_reverse
7560100TFif $param1 eq $param2
7562100TFif ($code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param1\s+\|\|\s+\$$param2/ or $code =~ /(?:die|croak|confess)[^;]*unless\s+\$$param2\s+\|\|\s+\$$param1/)
756850TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
7575100TFif $found_reverse
7588100TFif ($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)
759350TFif ($rel->{'type'} eq "required_group" and ($rel->{'params'}[0] eq $param2 and $rel->{'params'}[1] eq $param1))
760050TFif $found_reverse
7645100TFif $param1 eq $param2
7648100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!\$$param2/)
766050TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+!defined\s*\(\s*\$$param2\s*\)/)
7672100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i)
7715100TFif $param1 eq $param2
7719100TFif ($code =~ /(?:die|croak|confess)\s+['"]\w*${param1}[^'"]*requires[^'"]*$param2/i and $code =~ /if\s+\$$param1\s+&&\s+!\$$param2/)
7764100TFif $param1 eq $param2
7767100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*!=\s*(\d+)/)
778250TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+&&\s+\$$param2\s*<\s*(\d+)/)
7797100TFif ($code =~ /(?:die|croak|confess)[^;]*if\s+\$$param1\s+eq\s+['"]([^'"]+)['"]\s+&&\s+!\$$param2/)
7827100TFunless defined $self->{'output_dir'}
7829100TFunless -d $self->{'output_dir'}
7838100TFif ($self->{'_document'})
7840100TF$package_stmt ? :
7860100TFif ($schema->{'input'})
7861100TFif (scalar keys %{$$schema{'input'};}) { }
7866100TFif ($param->{'name'})
786850TFif ($name ne $param_name)
788450TFif (@with_pos and @without_pos)
789350TFif ($schema->{'output'} and scalar keys %{$$schema{"output"};})
7894100TFif (ref $schema->{'output'}{'_error_handling'} eq "HASH" and scalar keys %{$$schema{"output"}{"_error_handling"};} == 0)
790050TFif ($schema->{'output'}{'type'} and $schema->{'output'}{'type'} eq "scalar")
7906100TFif ($schema->{'new'})
7908100TFif (ref $schema->{'new'} or $schema->{'new'} eq $package_name) { }
790950TF$schema->{'new'} eq $package_name ? :
7917100TFunless (defined $schema->{'_confidence'}{'input'}{'level'})
7920100TFunless (defined $schema->{'_confidence'}{'output'}{'level'})
7925100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
792950TFif ($schema->{'accessor'} and scalar keys %{$$schema{"accessor"};})
7939100TF$schema->{'relationships'} ? :
7941100TF$schema->{'new'} ? :
7980100TFif ($schema->{'input'})
7985100TFif ($p->{'semantic'})
7989100TFif ($p->{'enum'})
7993100TFif ($p->{'isa'})
7998100TFif (@param_notes)
8008100TFif ($schema->{'relationships'} and @{$schema->{'relationships'};})
8020100TFif ($schema->{'_notes'} and scalar @{$schema->{'_notes'};})
8028100TFif ($schema->{'_analysis'})
8048100TFif ($schema->{'input'})
8052100TFif ($p->{'type'} and $p->{'type'} eq "coderef")
8056100TFif ($p->{'semantic'} and $p->{'semantic'} eq "filehandle")
8060100TFif ($p->{'isa'} and $p->{'isa'} =~ /DateTime/)
8066100TFif (@warnings)
8113100TFif defined $param->{$field}
8117100TFif (my $semantic = $param->{'semantic'})
8118100TFif ($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') { }
816150TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY")
8171100TFif ($param->{'enum'} and ref $param->{'enum'} eq "ARRAY" and not $cleaned{'enum'})
817450TFif ($param->{'memberof'} and ref $param->{'memberof'} eq "ARRAY")
8179100TFif ($param->{'isa'} and not $cleaned{'isa'})
8184100TFif ($param->{'format'})
8216100TFif ($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') { }
826950TFunless $doc
8273100TF$package_stmt ? :
8289100TFif ($method_name eq "new")
829350TFif ($method_name =~ /^(create|build|construct|init|DESTROY)$/i)
8304100TFif ($is_singleton)
83160TFif ($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'};})
8324100TFif ($is_factory)
833850TFif ($inheritance_info and $inheritance_info->{'use_parent_constructor'})
8350100TFif ($constructor_needs)
836450TFif ($needs_other_object)
83680TFif $needs_other_object->{'package'}
83740TFif $result->{'package'}
8378100TFif ($is_factory and not $skip_object)
838450TFif $is_factory->{'returns_class'}
8420100TFif ($method_name =~ /^(create_|make_|build_|get_)/i)
842550TFif ($method_body)
8427100TFif ($method_body =~ /return\s+bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?/s or $method_body =~ /bless\s*\{[^}]*\},\s*['"]?(\w+(?:::\w+)*|\$\w+)['"]?.*return/s)
8432100TFif ($class_name =~ /^\$(class|self|package)$/) { }
50TFelsif ($class_name =~ /^\$/) { }
8446100TFif ($method_body =~ /return\s+([\$\w:]+)->new\(/s or $method_body =~ /([\$\w:]+)->new\(.*return/s)
845150TFif ($target eq '$self' or $target eq 'shift' or $target =~ /^\$/) { }
100TFelsif ($target =~ /::/) { }
846750TFif ($method_body =~ /return\s+([\$\w:]+)->(create_|make_|build_|get_)/i or $method_body =~ /([\$\w:]+)->(create_|make_|build_|get_).*return/is)
8476100TFif ($method_info and ref $method_info eq "HASH" and $method_info->{'pod'})
847850TFif ($pod =~ /returns?\s+(?:an?\s+)?(object|instance|new\s+\w+)/i)
8518100TFunless $method_name =~ /^(instance|get_instance|singleton|shared_instance)$/i
852550TFif ($method_body)
8527100TFif ($method_body =~ /(?:my\s+)?(?:our\s+)?\$(?:instance|_instance|singleton)\b/s or $method_body =~ /state\s+\$(?:instance|_instance|singleton)\b/s)
8534100TFif ($method_body =~ /return\s+\$instance\s+if\s+(?:defined\s+)?\$instance/ or $method_body =~ /unless\s+\$instance.*?=\s*.*?new/)
8541100TFif ($method_body =~ /\$instance\s*\|\|=\s*.*?new/ or $method_body =~ /\$instance\s*=\s*.*?new\s+unless\s+(?:defined\s+)?\$instance/)
8548100TFif ($method_body =~ /return\s+\$instance;/)
855050TFunless $singleton_info{'confidence'}
855450TFif keys %singleton_info > 0
8589100TFif ($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+|[\{\[])/) { }
8614100TFif ($method_body =~ /\$self\s*->\s*[\{\[]/)
8616100TFunless $instance_info{'confidence'} eq "high"
8620100TFif ($method_body =~ /\$self\s*->\s*(\w+)\s*\(/s)
862550TFif @{$instance_info{'calls_instance_methods'};}
8629100TFif ($method_name =~ /^_/ and not $method_name =~ /^_new/)
863250TFunless exists $instance_info{'confidence'}
8635100TFif keys %instance_info
8668100TFunless $doc
8679100TFif ($content =~ /use\s+(parent|base)\s+['"]?([\w:]+)['"]?/)
868450TFif ($content =~ /use\s+(parent|base)\s+qw?[\(\[]?(.+?)[\)\]]?;/)
869750TFif ($content =~ /(?:our\s+)?\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
8709100TFif ($content =~ /\@ISA\s*=\s*qw?[\(\[]?(.+?)[\)\]]?/)
8718100TFif ($method_body and $method_body =~ /SUPER::/)
872050TFif ($method_body =~ /SUPER::new/)
8727100TFif $_[1]->isa("PPI::Statement::Sub")
8731100TFif ($has_own_new) { }
100TFelsif (@parent_classes) { }
8739100TFif keys %inheritance_info
877350TFunless $doc
8777100TFif ($target_package ne $current_package)
8787100TFif $_[1]->isa("PPI::Statement::Sub")
8791100TFunless $new_method
8799100TFif ($body =~ /my\s*\(\s*\$(self|class)\s*,\s*(.+?)\)\s*=\s*\@_/s)
8803100TFif (@param_names)
881750TFif (@shift_params)
8825100TFif ($body =~ /croak.*unless.*(?:defined\s+)?\$(\w+)/g)
8828100TFif ($body =~ /die.*unless.*(?:defined\s+)?\$(\w+)/g)
8832100TFif (@required_params)
8842100TFif ($requirements{'parameters'})
8845100TFif (defined $default)
8852100TFif (@optional_params)
8857100TFif keys %requirements
8888100TFunless $method_body
8897100TFif $class eq "main" or $class eq "__PACKAGE__" or $class =~ /^\$/
8901100TFif ($dependency_info{'creates_objects'})
8909100TFif ($method_body =~ /\$(\w+)->\w+\(/)
8923100TFif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->(?:new|create)/) { }
50TFelsif ($method_body =~ /my\s+\$$var\s*=\s*(\w+(?:::\w+)+)->/) { }
893050TFif (@object_classes)
8932100TFunless $dependency_info{'package'}
8939100TFif keys %dependency_info
896250TFunless $doc
896650TFif $_[1]->isa("PPI::Statement::Include") and $_[1]->type eq "use" and $_[1]->module =~ /^(parent|base)$/
897150TFif ($parent_stmt)
8978100TFif $_[1]->isa("PPI::Statement")
898150TFif ($isa_stmt and $isa_stmt->content =~ /['"](\w+(?:::\w+)*)['"]/)
9015100TFunless $package_stmt
9021100TFif $_[1]->isa("PPI::Statement::Sub")
902450TFif ($has_new)
90300TFif $parent
9066100TFunless $param and $code
9076100TFif ($clean_code =~ /\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*\|\|\s*([^;]+)/)
908050TFif defined $default
9084100TFif ($clean_code =~ m[\$$param\s*//=\s*([^;]+)])
9088100TFif defined $default
9093100TFif ($clean_code =~ /\$$param\s*=\s*defined\s+(?:\$$param|\$[a-zA-Z_]\w*)\s*\?\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*:\s*([^;]+)/)
909750TFif defined $default
9101100TFif ($clean_code =~ /\$$param\s*=\s*([^;]+?)\s+unless\s+defined\s+(?:\$$param|\$[a-zA-Z_]\w*)/)
910450TFif defined $default
9108100TFif ($clean_code =~ /\$$param\s*\|\|=\s*([^;]+)/)
911250TFif defined $default
9116100TFif ($clean_code =~ m[\$$param\s*=\s*(?:\$$param|\$[a-zA-Z_]\w*)\s*//\s*([^;]+)])
9120100TFif defined $default
9124100TFif ($clean_code =~ /if\s*\(\s*!defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
912850TFif defined $default
9132100TFif ($clean_code =~ /unless\s*\(\s*defined\s+\$$param\s*\)\s*\{[^}]*\$$param\s*=\s*([^;]+)/s)
913650TFif defined $default
9173100TFunless $code
9180100TFunless @{$hints{$k};}
9207100TFif ($code =~ /defined\s*\(\s*\$/)
9212100TFif ($code =~ /\beq\s*''/ or $code =~ /\blength\s*\(/)
9217100TFif ($code =~ /\$\w+\s*<\s*0/)
9245100TFif ($op eq '<') { }
100TFelsif ($op eq '<=') { }
100TFelsif ($op eq '>') { }
50TFelsif ($op eq '>=') { }
9282100TFunless $pod
9287100TFunless $pod =~ /=head2\s+SYNOPSIS\s*(.+?)(?=\n=head|\z)/s
929750TFdefined $3 ? :
100TFdefined $2 ? :
9301100TFif %kv
9309100TFunless (scalar @examples)
931850TFunless @args
932950TFif (scalar @examples)
9374100TFunless defined $value
9384100TFif ($value =~ m[\|\||/{2}])
9394100TFif ($value =~ /^qq?\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^qw\{(.*?)\}$/s) { }
50TFelsif ($value =~ /^q[qwx]?\s*([^a-zA-Z0-9\{\[])(.*?)\1$/s) { }
9403100TFif ($value =~ /^(['"])(.*)\1$/s)
9406100TFif ($from_code)
9417100TFunless ($from_code)
9426100TFunless ($value =~ /^\(/)
9431100TFif ($value =~ /^\{\s*\}$/)
9436100TFif ($value =~ /^\[\s*\]$/)
9441100TFif ($value =~ /^-?\d+(?:\.\d+)?$/)
9442100TFif ($value =~ /\./) { }
9450100TFif ($value =~ /^(true|false)$/i)
9451100TFlc $1 eq 'true' ? :
945550TFif ($value eq '1') { }
50TFelsif ($value eq '0') { }
9462100TFif ($value eq "undef")
9467100TFif ($value eq "__PACKAGE__")
9475100TFif ($value =~ /^\$[a-zA-Z_]/ or $value =~ /\(.*\)/)
947650TFif $value =~ /^\$|\@|\%/
952850TFif $pod->{'_from_input_spec'}
9531100TFif (exists $pod_params->{$param} and not exists $code_params->{$param})
953650TFif (not exists $pod_params->{$param} and exists $code_params->{$param})
9537100TFif ($param eq "class")
9541100TFif ($param eq "self")
9550100TFif ($pod->{'type'} and $code->{'type'} and $pod->{'type'} ne $code->{'type'})
9551100TFif (not $self->_types_are_compatible($pod->{'type'}, $code->{'type'})) { }
955950TFif (exists $pod->{'optional'} and exists $code->{'optional'} and $pod->{'optional'} != $code->{'optional'})
95610TF$pod->{'optional'} ? :
95620TF$code->{'optional'} ? :
95670TFif (defined $pod->{'min'} and defined $code->{'min'} and $pod->{'min'} != $code->{'min'})
95710TFif (defined $pod->{'max'} and defined $code->{'max'} and $pod->{'max'} != $code->{'max'})
95760TFif ($pod->{'matches'} and $code->{'matches'} and $pod->{'matches'} ne $code->{'matches'})
9605100TFunless defined $val
9608100TFif $val =~ /^(0|off|none)$/i
9609100TFif $val =~ /^(1|warn|warning)$/i
9610100TFif $val =~ /^(2|fatal|die|error)$/i
9636100TFif $pod_type eq $code_type
9649100TFif (my $allowed = $compatible_types{$pod_type})
965450TFif (my $allowed = $compatible_types{$code_type})
9719100TFif (my $errors = $schema->{'_pod_validation_errors'})
9721100TF$schema->{'_pod_disagreement'} ? :
9728100TFif (@reports) { }
9744100TFif $self->{'verbose'}