lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm

filter: Statementstmt 84.3% 27 / 32 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 76.7% 43 / 56 CC 5 SCAR 18.9
CC
5
Cov
70%
violates
17.8
BEGIN
1.0
BEGIN
1.0
CRAP 6.6
« lib/Perl/Critic/Policy/Modules/RequireVersionVar.pm ↑ Summary lib/Perl/Critic/PolicyParameter/Behavior/Integer.pm »
1 package Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap;
2  
3 40 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 40 ▶use Perl::Critic::Utils qw{ :severities :classification :ppi };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 40 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 40 our $VERSION = '1.156';
12  
13 #-----------------------------------------------------------------------------
14  
15 40 Readonly::Scalar my $DESC => q{Expression form of "map"};
16 40 Readonly::Scalar my $EXPL => [ 169 ];
17  
18 #-----------------------------------------------------------------------------
19  
20 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
21 74 ▶sub default_severity { return $SEVERITY_HIGH }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
22 91 ▶sub default_themes { return qw( core bugs pbp ) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
23 33 ▶sub applies_to { return 'PPI::Token::Word' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
24  
25 #-----------------------------------------------------------------------------
26  
27 349 ▶sub violates {
Subroutine violates: called CC=5 SCAR=28.8
Pod documented
28 349 my ( $self, $elem, undef ) = @_;
29  
30 349 ▶ return if $elem ne 'map';
Branch: 1 branch
BranchTrueFalseTotal
if $elem ne "map" 349 0 349
31 0 ▶ return if ! is_function_call($elem);
Branch: 1 branch
BranchTrueFalseTotal
unless is_function_call($elem) 0 0 0
32  
33 0 my $arg = first_arg($elem);
34 0 ▶ return if !$arg;
Branch: 1 branch
BranchTrueFalseTotal
unless $arg 0 0 0
35 0 ▶ return if $arg->isa('PPI::Structure::Block');
Branch: 1 branch
BranchTrueFalseTotal
if $arg->isa("PPI::Structure::Block") 0 0 0
36  
37 0 return $self->violation( $DESC, $EXPL, $elem );
38 }
39  
40 40 1;
41  
42 __END__
« lib/Perl/Critic/Policy/Modules/RequireVersionVar.pm ↑ Summary lib/Perl/Critic/PolicyParameter/Behavior/Integer.pm »