← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm
StatementsExecuted 2132 statements in 3.85ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
982113.30ms20.3msPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::violatesPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::violates
14411330µs330µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::applies_toPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::applies_to
11116µs16µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@10Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@10
11114µs16µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::supported_parametersPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::supported_parameters
11113µs67µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@18Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@18
1118µs194µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@15Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@15
1118µs394µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@17Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@17
1118µs11µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@12Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@12
1117µs28µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@13Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@13
1117µs18µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::BEGIN@11Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@11
1116µs7µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::default_severityPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::default_severity
1116µs6µsPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::_parse_allowPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::_parse_allow
0000s0sPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::__ANON__[:82]Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::__ANON__[:82]
0000s0sPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::::default_themesPerl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::default_themes
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8package Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict;
9
10240µs116µs
# spent 16µs within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs229µs
# spent 18µs (7+11) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@11 # spent 11µs making 1 call to strict::import
12219µs215µs
# spent 11µs (8+4) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@12 # spent 4µs making 1 call to warnings::import
13223µs249µs
# spent 28µs (7+21) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@13 which was called: # once (7µs+21µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 28µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@13 # spent 21µs making 1 call to Exporter::import
14
15228µs2379µs
# spent 194µs (8+185) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@15 which was called: # once (8µs+185µs) by Module::Pluggable::Object::_require at line 15
use List::MoreUtils qw(all);
# spent 194µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@15 # spent 185µs making 1 call to Exporter::Tiny::import
16
17224µs2779µs
# spent 394µs (8+386) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@17 which was called: # once (8µs+386µs) by Module::Pluggable::Object::_require at line 17
use Perl::Critic::Utils qw{ :characters :severities :data_conversion };
# spent 394µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@17 # spent 386µs making 1 call to Exporter::import
182293µs2121µs
# spent 67µs (13+54) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@18 which was called: # once (13µs+54µs) by Module::Pluggable::Object::_require at line 18
use base 'Perl::Critic::Policy';
# spent 67µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@18 # spent 54µs making 1 call to base::import
19
201600nsour $VERSION = '1.121';
21
22#-----------------------------------------------------------------------------
23
2412µs130µsReadonly::Scalar my $DESC => q{Stricture disabled};
# spent 30µs making 1 call to Readonly::Scalar
2512µs145µsReadonly::Scalar my $EXPL => [ 429 ];
# spent 45µs making 1 call to Readonly::Scalar
26
27#-----------------------------------------------------------------------------
28
29
# spent 16µs (14+2) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::supported_parameters which was called: # once (14µs+2µs) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
30 return (
31 {
32111µs22µs name => 'allow',
# spent 2µs making 2 calls to Readonly::Scalar::FETCH, avg 1µs/call
33 description => 'Allow vars, subs, and/or refs.',
34 default_string => $EMPTY,
35 parser => \&_parse_allow,
36 },
37 );
38}
39
4011µs
# spent 7µs (6+1) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::default_severity which was called: # once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_HIGHEST }
41sub default_themes { return qw( core pbp bugs certrec ) }
42144430µs
# spent 330µs within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::applies_to which was called 144 times, avg 2µs/call: # 144 times (330µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call
sub applies_to { return 'PPI::Statement::Include' }
43
44#-----------------------------------------------------------------------------
45
46
# spent 6µs within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::_parse_allow which was called: # once (6µs+0s) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm
sub _parse_allow {
471700ns my ($self, $parameter, $config_string) = @_;
48
4912µs $self->{_allow} = {};
50
511400ns if( defined $config_string ) {
52 my $allowed = lc $config_string; #String of words
53 my %allowed = hashify( $allowed =~ m/ (\w+) /gxms );
54 $self->{_allow} = \%allowed;
55 }
56
5714µs return;
58}
59
60#-----------------------------------------------------------------------------
61
62
# spent 20.3ms (3.30+17.0) within Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::violates which was called 982 times, avg 21µs/call: # 982 times (3.30ms+17.0ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 21µs/call
sub violates {
63982286µs my ( $self, $elem, undef ) = @_;
64
659822.66ms98217.0ms return if $elem->type() ne 'no';
# spent 17.0ms making 982 calls to PPI::Statement::Include::type, avg 17µs/call
66 return if $elem->pragma() ne 'strict';
67
68 #Arguments to 'no strict' are usually a list of literals or a qw()
69 #list. Rather than trying to parse the various PPI elements, I
70 #just use a regex to split the statement into words. This is
71 #kinda lame, but it does the trick for now.
72
73 # TODO consider: a possible alternate implementation:
74 # my $re = join q{|}, keys %{$self->{allow}};
75 # return if $re && $stmnt =~ m/\b(?:$re)\b/mx;
76 # May need to detaint for that to work... Not sure.
77
78 my $stmnt = $elem->statement();
79 return if !$stmnt;
80 my @words = $stmnt =~ m/ ([[:lower:]]+) /gxms;
81 @words = grep { $_ ne 'qw' && $_ ne 'no' && $_ ne 'strict' } @words;
82 return if @words && all { exists $self->{_allow}->{$_} } @words;
83
84 #If we get here, then it must be a violation
85 return $self->violation( $DESC, $EXPL, $elem );
86}
87
8813µs1;
89
90__END__