← 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/Variables/ProhibitAugmentedAssignmentInDeclaration.pm
StatementsExecuted 21 statements in 397µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11117µs17µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@10Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@10
1118µs168µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@13Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@13
1118µs34µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@14Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@14
1118µs224µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@16Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@16
1118µs11.4msPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@17Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@17
1118µs12µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@12Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@12
1117µs19µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::BEGIN@11Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@11
1116µs7µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::default_severityPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::default_severity
1112µs2µsPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::supported_parametersPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::supported_parameters
0000s0sPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::__ANON__[:45]Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::__ANON__[:45]
0000s0sPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::applies_toPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::applies_to
0000s0sPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::default_themesPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::default_themes
0000s0sPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::::violatesPerl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::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::Variables::ProhibitAugmentedAssignmentInDeclaration;
9
10246µs117µs
# spent 17µs within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@10 which was called: # once (17µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11221µs230µs
# spent 19µs (7+12) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@11 which was called: # once (7µs+12µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 19µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@11 # spent 12µs making 1 call to strict::import
12222µs216µs
# spent 12µs (8+4) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 12µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@12 # spent 4µs making 1 call to warnings::import
13225µs2328µs
# spent 168µs (8+160) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@13 which was called: # once (8µs+160µs) by Module::Pluggable::Object::_require at line 13
use List::MoreUtils qw{ firstval };
14224µs260µs
# spent 34µs (8+26) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@14 which was called: # once (8µs+26µs) by Module::Pluggable::Object::_require at line 14
use Readonly;
# spent 34µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@14 # spent 26µs making 1 call to Exporter::import
15
16225µs2440µs
# spent 224µs (8+216) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@16 which was called: # once (8µs+216µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils qw{ :severities :data_conversion };
# spent 224µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@16 # spent 216µs making 1 call to Exporter::import
172202µs222.7ms
# spent 11.4ms (8µs+11.4) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@17 which was called: # once (8µs+11.4ms) by Module::Pluggable::Object::_require at line 17
use base 'Perl::Critic::Policy';
# spent 11.4ms making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@17 # spent 11.4ms making 1 call to base::import
18
191600nsour $VERSION = '1.121';
20
21#-----------------------------------------------------------------------------
22
2312µs130µsReadonly::Scalar my $DESC => q{Augmented assignment operator '%s' used in declaration};
# spent 30µs making 1 call to Readonly::Scalar
2411µs121µsReadonly::Scalar my $EXPL => q{Use simple assignment when initializing variables};
# spent 21µs making 1 call to Readonly::Scalar
25
26#-----------------------------------------------------------------------------
27
2815µs
# spent 2µs within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::supported_parameters which was called: # once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters { return () }
2912µs
# spent 7µs (6+1) within Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::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 }
30sub default_themes { return qw( core bugs ) }
31sub applies_to { return 'PPI::Statement::Variable' }
32
33#-----------------------------------------------------------------------------
34
35117µs16µsmy %augmented_assignments = hashify( qw( **= += -= .= *= /= %= x= &= |= ^= <<= >>= &&= ||= //= ) );
# spent 6µs making 1 call to Perl::Critic::Utils::hashify
36
37sub violates {
38 my ( $self, $elem, undef ) = @_;
39
40 # The assignment operator associated with a PPI::Statement::Variable
41 # element is assumed to be the first immediate child of that element.
42 # Other operators in the statement, e.g. the ',' in "my ( $a, $b ) = ();",
43 # as assumed to never be immediate children.
44
45 my $found = firstval { $_->isa('PPI::Token::Operator') } $elem->children();
46 if ( $found ) {
47 my $op = $found->content();
48 if ( !exists $augmented_assignments{ $op } ) {
49 # PPI doesn't parse all augmented assignment operators. Detect
50 # the unsupported ones by concatenating two immediately adjacent
51 # operators and trying again.
52 my $immediately_adjacent = $found->next_sibling(); # not snext_sibling()
53 if ( $immediately_adjacent && $immediately_adjacent->isa('PPI::Token::Operator') ) {
54 $op .= $immediately_adjacent->content();
55 }
56 }
57
58 if ( exists $augmented_assignments{ $op } ) {
59 return $self->violation( sprintf( $DESC, $op ), $EXPL, $found );
60 }
61 }
62
63 return;
64}
65
66
6716µs1;
68
69__END__