| 1 | package Perl::Critic::Policy::CodeLayout::RequireParensWithBuiltins; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 11 | ▶ | use Perl::Critic::Utils qw/ :severities :data_conversion :classification :language /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use base 'Perl::Critic::Policy'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | our $VERSION = '0.1.4'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | Readonly::Scalar my $DESC => q{Builtin function called without parentheses}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 11 | Readonly::Scalar my $EXPL => [ 13 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # In each section, the order follows that of perlfunc(1). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Some keywords may be repeated if they appear in multiple perlfunc sections. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 11 | Readonly::Array my @REQUIRED => qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | chr crypt fc hex index lc lcfirst length oct ord pack rindex sprintf substr uc ucfirst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | quotemeta split study | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | abs atan2 cos exp hex int log oct rand sin sqrt srand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | splice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | join unpack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | delete exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | binmode close closedir fileno flock read readdir readline rewinddir seek seekdir select syscall sysread sysseek syswrite tell telldir truncate warn write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | pack read syscall sysread sysseek syswrite unpack vec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | chdir chmod chown chroot fcntl glob ioctl link lstat mkdir open opendir readlink rename rmdir select stat symlink sysopen umask unlink utime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | caller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | formline lock scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | alarm exec getpriority kill pipe readpipe setpgrp setpriority sleep system waitpid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | bless ref tie tied untie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | accept bind connect getpeername getsockname getsockopt listen recv send setsockopt shutdown socket socketpair | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 11 | Readonly::Array my @PERMITTED => qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | chomp chop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | eof getc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | defined reset undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | getpgrp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | gmtime localtime time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 11 | Readonly::Array my @ALLOWED => qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | each keys pop push shift unshift values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | each keys values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | grep map reverse sort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | die format print printf say | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | break continue die do dump eval evalbytes goto last next redo return wantarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | import local my our package state use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | fork getppid times wait | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | do import no package require use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | package use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ####----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | ▶ | sub supported_parameters { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | name => 'require', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | description => 'Always require parentheses of these operators.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | default_string => join(' ',@REQUIRED), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | behavior => 'string list', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | name => 'permit', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | description => 'Require parentheses when called with a parameter.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | default_string => join(' ',@PERMITTED), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | behavior => 'string list', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | name => 'allow', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | description => 'Never require parentheses.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | default_string => join(' ', @ALLOWED), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | behavior => 'string list', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 20 | ▶ | sub default_severity { return $SEVERITY_HIGH } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub default_themes { return qw( core cosmetic ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_themes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 53 | ▶ | sub applies_to { return 'PPI::Token::Word' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 122 | ▶ | sub violates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
violates: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 122 | my ($self,$elem,undef)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 122 | ▶ | if(!is_function_call($elem)) { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 100 | ▶ | if(exists($$self{_allow}{ $elem->content() })) { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 51 | my $sibling=$elem->snext_sibling(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 51 | ▶ | if(exists($$self{_require}{ $elem->content() })) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 24 | ▶ | if(!$sibling||!$sibling->isa('PPI::Structure::List')) { return $self->violation(sprintf("$DESC (%s)",$elem->content()),$EXPL,$elem) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sibling and $sibling->isa("PPI::Structure::List")
MC/DC100%2/2
$sibling and $sibling->isa("PPI::Structure::List")
$sibling
$sibling->isa("PPI::Structure::List")
Truth table100%3/3
A and B
A= $siblingB= $sibling->isa("PPI::Structure::List")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 39 | ▶ | if(!$sibling||$sibling->isa('PPI::Structure::List')) { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $sibling or $sibling->isa("PPI::Structure::List")
MC/DC100%2/2
not $sibling or $sibling->isa("PPI::Structure::List")
not $sibling
$sibling->isa("PPI::Structure::List")
Truth table100%3/3
not(A) or B
A= not $siblingB= $sibling->isa("PPI::Structure::List")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 20 | ▶ | if(exists($$self{_permit}{ $elem->content() })) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 14 | ▶ | if( $sibling->isa('PPI::Token::Number') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$sibling->isa("PPI::Token::Number") or $sibling->isa("PPI::Token::Quote") or $sibling->isa("PPI::Token::QuoteLike") or $sibling->isa("PPI::Token::Symbol")
$sibling->isa("PPI::Token::Number") or $sibling->isa("PPI::Token::Quote") or $sibling->isa("PPI::Token::QuoteLike")
$sibling->isa("PPI::Token::Number") or $sibling->isa("PPI::Token::Quote")
MC/DC75%3/4
$sibling->isa("PPI::Token::Number") or $sibling->isa("PPI::Token::Quote") or $sibling->isa("PPI::Token::QuoteLike") or $sibling->isa("PPI::Token::Symbol")
$sibling->isa("PPI::Token::Number")
$sibling->isa("PPI::Token::Quote")
$sibling->isa("PPI::Token::QuoteLike")
$sibling->isa("PPI::Token::Symbol")
Truth table80%4/5
A or B or C or D
A= $sibling->isa("PPI::Token::Number")B= $sibling->isa("PPI::Token::Quote")C= $sibling->isa("PPI::Token::QuoteLike")D= $sibling->isa("PPI::Token::Symbol")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | || $sibling->isa('PPI::Token::Quote') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | || $sibling->isa('PPI::Token::QuoteLike') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | || $sibling->isa('PPI::Token::Symbol') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 8 | return $self->violation(sprintf("$DESC (%s)",$elem->content()),$EXPL,$elem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||