← 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/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm
StatementsExecuted 21 statements in 425µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11116µs16µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@10Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@10
11110µs21µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@11Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@11
1118µs58µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@16Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@16
1117µs28µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@13Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@13
1117µs11µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@12Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@12
1117µs193µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::BEGIN@15Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@15
1116µs7µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::default_severityPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::default_severity
1111µs1µsPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::supported_parametersPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::supported_parameters
0000s0sPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::_high_booleanPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::_high_boolean
0000s0sPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::_low_booleanPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::_low_boolean
0000s0sPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::applies_toPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::applies_to
0000s0sPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::default_themesPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::default_themes
0000s0sPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::::violatesPerl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::violates
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::ValuesAndExpressions::ProhibitMixedBooleanOperators;
9
10239µs116µs
# spent 16µs within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs232µs
# spent 21µs (10+11) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@11 which was called: # once (10µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 21µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@11 # spent 11µs making 1 call to strict::import
12218µs214µs
# spent 11µs (7+4) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@12 which was called: # once (7µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@12 # spent 4µs making 1 call to warnings::import
13223µs248µs
# spent 28µs (7+20) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@13 which was called: # once (7µs+20µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 28µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14
15227µs2379µs
# spent 193µs (7+186) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@15 which was called: # once (7µs+186µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities :data_conversion };
# spent 193µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@15 # spent 186µs making 1 call to Exporter::import
162273µs2108µs
# spent 58µs (8+50) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@16 which was called: # once (8µs+50µs) by Module::Pluggable::Object::_require at line 16
use base 'Perl::Critic::Policy';
# spent 58µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::BEGIN@16 # spent 50µs making 1 call to base::import
17
18
19#-----------------------------------------------------------------------------
20
211500nsour $VERSION = '1.121';
22#-----------------------------------------------------------------------------
23
2413µs231µsReadonly::Hash my %LOW_BOOLEANS => hashify( qw( not or and ) );
# spent 27µs making 1 call to Readonly::Hash # spent 4µs making 1 call to Perl::Critic::Utils::hashify
2512µs224µsReadonly::Hash my %HIGH_BOOLEANS => hashify( qw( ! || && ) );
# spent 22µs making 1 call to Readonly::Hash # spent 2µs making 1 call to Perl::Critic::Utils::hashify
26
2713µs232µsReadonly::Hash my %EXEMPT_TYPES => hashify(
# spent 29µs making 1 call to Readonly::Hash # spent 3µs making 1 call to Perl::Critic::Utils::hashify
28 qw(
29 PPI::Statement::Block
30 PPI::Statement::Scheduled
31 PPI::Statement::Package
32 PPI::Statement::Include
33 PPI::Statement::Sub
34 PPI::Statement::Variable
35 PPI::Statement::Compound
36 PPI::Statement::Data
37 PPI::Statement::End
38 )
39);
40
41#-----------------------------------------------------------------------------
42
4311µs123µsReadonly::Scalar my $DESC => q{Mixed high and low-precedence booleans};
# spent 23µs making 1 call to Readonly::Scalar
4412µs140µsReadonly::Scalar my $EXPL => [ 70 ];
# spent 40µs making 1 call to Readonly::Scalar
45
46#-----------------------------------------------------------------------------
47
4815µs
# spent 1µs within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::supported_parameters which was called: # once (1µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters { return () }
4912µs
# spent 7µs (6+1) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::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_HIGH }
50sub default_themes { return qw( core bugs pbp certrec ) }
51sub applies_to { return 'PPI::Statement' }
52
53#-----------------------------------------------------------------------------
54
55sub violates {
56
57 my ( $self, $elem, undef ) = @_;
58
59 # PPI::Statement is the ancestor of several types of PPI elements.
60 # But for this policy, we only want the ones that generally
61 # represent a single statement or expression. There might be
62 # better ways to do this, such as scanning for a semi-colon or
63 # some other marker.
64
65 return if exists $EXEMPT_TYPES{ ref $elem };
66
67 if ( $elem->find_first(\&_low_boolean)
68 && $elem->find_first(\&_high_boolean) ) {
69
70 return $self->violation( $DESC, $EXPL, $elem );
71 }
72 return; #ok!
73}
74
75#-----------------------------------------------------------------------------
76
77sub _low_boolean {
78 my (undef, $elem) = @_;
79 return if $elem->isa('PPI::Statement');
80 $elem->isa('PPI::Token::Operator') || return 0;
81 return exists $LOW_BOOLEANS{$elem};
82}
83
84#-----------------------------------------------------------------------------
85
86sub _high_boolean {
87 my (undef, $elem) = @_;
88 return if $elem->isa('PPI::Statement');
89 $elem->isa('PPI::Token::Operator') || return 0;
90 return exists $HIGH_BOOLEANS{$elem};
91}
92
9316µs1;
94
95__END__