| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic.pm |
| Statements | Executed 180470 statements in 364ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 3024 | 1 | 1 | 639ms | 7.77s | Perl::Critic::_critique |
| 144 | 1 | 1 | 22.6ms | 32.4s | Perl::Critic::critique |
| 144 | 1 | 1 | 16.9ms | 14.9s | Perl::Critic::_gather_violations |
| 1 | 1 | 1 | 3.15ms | 1.33s | Perl::Critic::BEGIN@24 |
| 1 | 1 | 1 | 2.27ms | 44.2ms | Perl::Critic::BEGIN@26 |
| 144 | 1 | 1 | 1.74ms | 4.52ms | Perl::Critic::_futz_with_policy_order |
| 145 | 2 | 2 | 1.33ms | 2.12ms | Perl::Critic::policies |
| 578 | 5 | 2 | 1.21ms | 1.21ms | Perl::Critic::config |
| 1 | 1 | 1 | 917µs | 1.41ms | Perl::Critic::BEGIN@27 |
| 144 | 1 | 1 | 419µs | 419µs | Perl::Critic::statistics |
| 1 | 1 | 1 | 214µs | 966µs | Perl::Critic::BEGIN@23 |
| 1 | 1 | 1 | 22µs | 426ms | Perl::Critic::new |
| 1 | 1 | 1 | 17µs | 17µs | Perl::Critic::BEGIN@10 |
| 1 | 1 | 1 | 14µs | 2.71ms | Perl::Critic::BEGIN@20 |
| 1 | 1 | 1 | 10µs | 33µs | Perl::Critic::BEGIN@21 |
| 1 | 1 | 1 | 9µs | 9µs | Perl::Critic::BEGIN@25 |
| 1 | 1 | 1 | 8µs | 316µs | Perl::Critic::BEGIN@28 |
| 1 | 1 | 1 | 8µs | 13µs | Perl::Critic::BEGIN@12 |
| 1 | 1 | 1 | 8µs | 28µs | Perl::Critic::BEGIN@15 |
| 1 | 1 | 1 | 8µs | 20µs | Perl::Critic::BEGIN@11 |
| 1 | 1 | 1 | 8µs | 382µs | Perl::Critic::BEGIN@14 |
| 1 | 1 | 1 | 7µs | 16µs | Perl::Critic::BEGIN@17 |
| 1 | 1 | 1 | 4µs | 4µs | Perl::Critic::BEGIN@19 |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::__ANON__[:210] |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::add_policy |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ############################################################################## | ||||
| 2 | # $URL$ | ||||
| 3 | # $Date$ | ||||
| 4 | # $Author$ | ||||
| 5 | # $Revision$ | ||||
| 6 | ############################################################################## | ||||
| 7 | |||||
| 8 | package Perl::Critic; | ||||
| 9 | |||||
| 10 | 2 | 40µs | 1 | 17µs | # spent 17µs within Perl::Critic::BEGIN@10 which was called:
# once (17µs+0s) by Perl::Critic::Command::_critique at line 10 # spent 17µs making 1 call to Perl::Critic::BEGIN@10 |
| 11 | 2 | 24µs | 2 | 33µs | # spent 20µs (8+12) within Perl::Critic::BEGIN@11 which was called:
# once (8µs+12µs) by Perl::Critic::Command::_critique at line 11 # spent 20µs making 1 call to Perl::Critic::BEGIN@11
# spent 12µs making 1 call to strict::import |
| 12 | 2 | 22µs | 2 | 18µs | # spent 13µs (8+5) within Perl::Critic::BEGIN@12 which was called:
# once (8µs+5µs) by Perl::Critic::Command::_critique at line 12 # spent 13µs making 1 call to Perl::Critic::BEGIN@12
# spent 5µs making 1 call to warnings::import |
| 13 | |||||
| 14 | 2 | 23µs | 2 | 757µs | # spent 382µs (8+375) within Perl::Critic::BEGIN@14 which was called:
# once (8µs+375µs) by Perl::Critic::Command::_critique at line 14 # spent 382µs making 1 call to Perl::Critic::BEGIN@14
# spent 375µs making 1 call to English::import |
| 15 | 2 | 22µs | 2 | 49µs | # spent 28µs (8+20) within Perl::Critic::BEGIN@15 which was called:
# once (8µs+20µs) by Perl::Critic::Command::_critique at line 15 # spent 28µs making 1 call to Perl::Critic::BEGIN@15
# spent 20µs making 1 call to Exporter::import |
| 16 | |||||
| 17 | 2 | 20µs | 2 | 25µs | # spent 16µs (7+9) within Perl::Critic::BEGIN@17 which was called:
# once (7µs+9µs) by Perl::Critic::Command::_critique at line 17 # spent 16µs making 1 call to Perl::Critic::BEGIN@17
# spent 9µs making 1 call to Exporter::import |
| 18 | |||||
| 19 | 2 | 20µs | 1 | 4µs | # spent 4µs within Perl::Critic::BEGIN@19 which was called:
# once (4µs+0s) by Perl::Critic::Command::_critique at line 19 # spent 4µs making 1 call to Perl::Critic::BEGIN@19 |
| 20 | 2 | 33µs | 2 | 5.40ms | # spent 2.71ms (14µs+2.69) within Perl::Critic::BEGIN@20 which was called:
# once (14µs+2.69ms) by Perl::Critic::Command::_critique at line 20 # spent 2.71ms making 1 call to Perl::Critic::BEGIN@20
# spent 2.69ms making 1 call to Exporter::Tiny::import |
| 21 | 2 | 24µs | 2 | 56µs | # spent 33µs (10+23) within Perl::Critic::BEGIN@21 which was called:
# once (10µs+23µs) by Perl::Critic::Command::_critique at line 21 # spent 33µs making 1 call to Perl::Critic::BEGIN@21
# spent 23µs making 1 call to Exporter::import |
| 22 | |||||
| 23 | 2 | 98µs | 2 | 980µs | # spent 966µs (214+752) within Perl::Critic::BEGIN@23 which was called:
# once (214µs+752µs) by Perl::Critic::Command::_critique at line 23 # spent 966µs making 1 call to Perl::Critic::BEGIN@23
# spent 14µs making 1 call to Exporter::import |
| 24 | 2 | 90µs | 1 | 1.33s | # spent 1.33s (3.15ms+1.33) within Perl::Critic::BEGIN@24 which was called:
# once (3.15ms+1.33s) by Perl::Critic::Command::_critique at line 24 # spent 1.33s making 1 call to Perl::Critic::BEGIN@24 |
| 25 | 2 | 23µs | 1 | 9µs | # spent 9µs within Perl::Critic::BEGIN@25 which was called:
# once (9µs+0s) by Perl::Critic::Command::_critique at line 25 # spent 9µs making 1 call to Perl::Critic::BEGIN@25 |
| 26 | 2 | 110µs | 1 | 44.2ms | # spent 44.2ms (2.27+41.9) within Perl::Critic::BEGIN@26 which was called:
# once (2.27ms+41.9ms) by Perl::Critic::Command::_critique at line 26 # spent 44.2ms making 1 call to Perl::Critic::BEGIN@26 |
| 27 | 2 | 101µs | 1 | 1.41ms | # spent 1.41ms (917µs+489µs) within Perl::Critic::BEGIN@27 which was called:
# once (917µs+489µs) by Perl::Critic::Command::_critique at line 27 # spent 1.41ms making 1 call to Perl::Critic::BEGIN@27 |
| 28 | 2 | 612µs | 2 | 624µs | # spent 316µs (8+308) within Perl::Critic::BEGIN@28 which was called:
# once (8µs+308µs) by Perl::Critic::Command::_critique at line 28 # spent 316µs making 1 call to Perl::Critic::BEGIN@28
# spent 308µs making 1 call to Exporter::import |
| 29 | |||||
| 30 | #----------------------------------------------------------------------------- | ||||
| 31 | |||||
| 32 | 1 | 700ns | our $VERSION = '1.121'; | ||
| 33 | |||||
| 34 | 1 | 3µs | 1 | 37µs | Readonly::Array our @EXPORT_OK => qw(critique); # spent 37µs making 1 call to Readonly::Array |
| 35 | |||||
| 36 | #============================================================================= | ||||
| 37 | # PUBLIC methods | ||||
| 38 | |||||
| 39 | # spent 426ms (22µs+426) within Perl::Critic::new which was called:
# once (22µs+426ms) by Perl::Critic::Command::_critique at line 238 of Perl/Critic/Command.pm | ||||
| 40 | 1 | 1µs | my ( $class, %args ) = @_; | ||
| 41 | 1 | 800ns | my $self = bless {}, $class; | ||
| 42 | 1 | 7µs | 1 | 426ms | $self->{_config} = $args{-config} || Perl::Critic::Config->new( %args ); # spent 426ms making 1 call to Perl::Critic::Config::new |
| 43 | 1 | 6µs | 1 | 17µs | $self->{_stats} = Perl::Critic::Statistics->new(); # spent 17µs making 1 call to Perl::Critic::Statistics::new |
| 44 | 1 | 5µs | return $self; | ||
| 45 | } | ||||
| 46 | |||||
| 47 | #----------------------------------------------------------------------------- | ||||
| 48 | |||||
| 49 | # spent 1.21ms within Perl::Critic::config which was called 578 times, avg 2µs/call:
# 145 times (364µs+0s) by Perl::Critic::policies at line 68, avg 3µs/call
# 144 times (366µs+0s) by Perl::Critic::critique at line 103, avg 3µs/call
# 144 times (315µs+0s) by Perl::Critic::_gather_violations at line 133, avg 2µs/call
# 144 times (167µs+0s) by Perl::Critic::_gather_violations at line 128, avg 1µs/call
# once (1µs+0s) by Perl::Critic::Command::_critique at line 241 of Perl/Critic/Command.pm | ||||
| 50 | 578 | 192µs | my $self = shift; | ||
| 51 | 578 | 1.69ms | return $self->{_config}; | ||
| 52 | } | ||||
| 53 | |||||
| 54 | #----------------------------------------------------------------------------- | ||||
| 55 | |||||
| 56 | sub add_policy { | ||||
| 57 | my ( $self, @args ) = @_; | ||||
| 58 | #Delegate to Perl::Critic::Config | ||||
| 59 | return $self->config()->add_policy( @args ); | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | #----------------------------------------------------------------------------- | ||||
| 63 | |||||
| 64 | # spent 2.12ms (1.33+794µs) within Perl::Critic::policies which was called 145 times, avg 15µs/call:
# 144 times (1.32ms+789µs) by Perl::Critic::critique at line 112, avg 15µs/call
# once (10µs+5µs) by Perl::Critic::Command::_critique at line 239 of Perl/Critic/Command.pm | ||||
| 65 | 145 | 46µs | my $self = shift; | ||
| 66 | |||||
| 67 | #Delegate to Perl::Critic::Config | ||||
| 68 | 145 | 1.06ms | 290 | 794µs | return $self->config()->policies(); # spent 430µs making 145 calls to Perl::Critic::Config::policies, avg 3µs/call
# spent 364µs making 145 calls to Perl::Critic::config, avg 3µs/call |
| 69 | } | ||||
| 70 | |||||
| 71 | #----------------------------------------------------------------------------- | ||||
| 72 | |||||
| 73 | # spent 419µs within Perl::Critic::statistics which was called 144 times, avg 3µs/call:
# 144 times (419µs+0s) by Perl::Critic::_gather_violations at line 138, avg 3µs/call | ||||
| 74 | 144 | 76µs | my $self = shift; | ||
| 75 | 144 | 425µs | return $self->{_stats}; | ||
| 76 | } | ||||
| 77 | |||||
| 78 | #----------------------------------------------------------------------------- | ||||
| 79 | |||||
| 80 | # spent 32.4s (22.6ms+32.4) within Perl::Critic::critique which was called 144 times, avg 225ms/call:
# 144 times (22.6ms+32.4s) by Perl::Critic::Command::_critique at line 249 of Perl/Critic/Command.pm, avg 225ms/call | ||||
| 81 | |||||
| 82 | #------------------------------------------------------------------- | ||||
| 83 | # This subroutine can be called as an object method or as a static | ||||
| 84 | # function. In the latter case, the first argument can be a | ||||
| 85 | # hashref of configuration parameters that shall be used to create | ||||
| 86 | # an object behind the scenes. Note that this object does not | ||||
| 87 | # persist. In other words, it is not a singleton. Here are some | ||||
| 88 | # of the ways this subroutine might get called: | ||||
| 89 | # | ||||
| 90 | # #Object style... | ||||
| 91 | # $critic->critique( $code ); | ||||
| 92 | # | ||||
| 93 | # #Functional style... | ||||
| 94 | # critique( $code ); | ||||
| 95 | # critique( {}, $code ); | ||||
| 96 | # critique( {-foo => bar}, $code ); | ||||
| 97 | #------------------------------------------------------------------ | ||||
| 98 | |||||
| 99 | 144 | 226µs | my ( $self, $source_code ) = @_ >= 2 ? @_ : ( {}, $_[0] ); | ||
| 100 | 144 | 180µs | $self = ref $self eq 'HASH' ? __PACKAGE__->new(%{ $self }) : $self; | ||
| 101 | 144 | 36µs | return if not defined $source_code; # If no code, then nothing to do. | ||
| 102 | |||||
| 103 | 144 | 344µs | 144 | 366µs | my $config = $self->config(); # spent 366µs making 144 calls to Perl::Critic::config, avg 3µs/call |
| 104 | 144 | 2.10ms | 432 | 16.5s | my $doc = # spent 16.5s making 144 calls to Perl::Critic::Document::new, avg 115ms/call
# spent 549µs making 144 calls to Perl::Critic::Config::program_extensions_as_regexes, avg 4µs/call
# spent 212µs making 144 calls to Scalar::Util::blessed, avg 1µs/call |
| 105 | blessed($source_code) && $source_code->isa('Perl::Critic::Document') | ||||
| 106 | ? $source_code | ||||
| 107 | : Perl::Critic::Document->new( | ||||
| 108 | '-source' => $source_code, | ||||
| 109 | '-program-extensions' => [$config->program_extensions_as_regexes()], | ||||
| 110 | ); | ||||
| 111 | |||||
| 112 | 144 | 417µs | 144 | 2.10ms | if ( 0 == $self->policies() ) { # spent 2.10ms making 144 calls to Perl::Critic::policies, avg 15µs/call |
| 113 | Perl::Critic::Exception::Configuration::Generic->throw( | ||||
| 114 | message => 'There are no enabled policies.', | ||||
| 115 | ) | ||||
| 116 | } | ||||
| 117 | |||||
| 118 | 144 | 16.1ms | 144 | 14.9s | return $self->_gather_violations($doc); # spent 14.9s making 144 calls to Perl::Critic::_gather_violations, avg 103ms/call |
| 119 | } | ||||
| 120 | |||||
| 121 | #============================================================================= | ||||
| 122 | # PRIVATE methods | ||||
| 123 | |||||
| 124 | # spent 14.9s (16.9ms+14.9) within Perl::Critic::_gather_violations which was called 144 times, avg 103ms/call:
# 144 times (16.9ms+14.9s) by Perl::Critic::critique at line 118, avg 103ms/call | ||||
| 125 | 144 | 62µs | my ($self, $doc) = @_; | ||
| 126 | |||||
| 127 | # Disable exempt code lines, if desired | ||||
| 128 | 144 | 3.68ms | 432 | 1.78s | if ( not $self->config->force() ) { # spent 1.78s making 144 calls to Perl::Critic::Document::process_annotations, avg 12.4ms/call
# spent 342µs making 144 calls to Perl::Critic::Config::force, avg 2µs/call
# spent 167µs making 144 calls to Perl::Critic::config, avg 1µs/call |
| 129 | $doc->process_annotations(); | ||||
| 130 | } | ||||
| 131 | |||||
| 132 | # Evaluate each policy | ||||
| 133 | 144 | 796µs | 288 | 957µs | my @policies = $self->config->policies(); # spent 643µs making 144 calls to Perl::Critic::Config::policies, avg 4µs/call
# spent 315µs making 144 calls to Perl::Critic::config, avg 2µs/call |
| 134 | 144 | 482µs | 144 | 4.52ms | my @ordered_policies = _futz_with_policy_order(@policies); # spent 4.52ms making 144 calls to Perl::Critic::_futz_with_policy_order, avg 31µs/call |
| 135 | 3168 | 4.75ms | 3024 | 7.77s | my @violations = map { _critique($_, $doc) } @ordered_policies; # spent 7.77s making 3024 calls to Perl::Critic::_critique, avg 2.57ms/call |
| 136 | |||||
| 137 | # Accumulate statistics | ||||
| 138 | 144 | 773µs | 288 | 5.32s | $self->statistics->accumulate( $doc, \@violations ); # spent 5.32s making 144 calls to Perl::Critic::Statistics::accumulate, avg 36.9ms/call
# spent 419µs making 144 calls to Perl::Critic::statistics, avg 3µs/call |
| 139 | |||||
| 140 | # If requested, rank violations by their severity and return the top N. | ||||
| 141 | 144 | 72µs | if ( @violations && (my $top = $self->config->top()) ) { | ||
| 142 | my $limit = @violations < $top ? $#violations : $top-1; | ||||
| 143 | @violations = Perl::Critic::Violation::sort_by_severity(@violations); | ||||
| 144 | @violations = ( reverse @violations )[ 0 .. $limit ]; #Slicing... | ||||
| 145 | } | ||||
| 146 | |||||
| 147 | # Always return violations sorted by location | ||||
| 148 | 144 | 1.88ms | 144 | 1.07ms | return Perl::Critic::Violation->sort_by_location(@violations); # spent 1.07ms making 144 calls to Perl::Critic::Violation::sort_by_location, avg 7µs/call |
| 149 | } | ||||
| 150 | |||||
| 151 | #============================================================================= | ||||
| 152 | # PRIVATE functions | ||||
| 153 | |||||
| 154 | # spent 7.77s (639ms+7.14) within Perl::Critic::_critique which was called 3024 times, avg 2.57ms/call:
# 3024 times (639ms+7.14s) by Perl::Critic::_gather_violations at line 135, avg 2.57ms/call | ||||
| 155 | 3024 | 948µs | my ($policy, $doc) = @_; | ||
| 156 | |||||
| 157 | 3024 | 11.1ms | 5760 | 1.45s | return if not $policy->prepare_to_scan_document($doc); # spent 1.43s making 144 calls to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::prepare_to_scan_document, avg 9.92ms/call
# spent 16.4ms making 2736 calls to Perl::Critic::Policy::prepare_to_scan_document, avg 6µs/call
# spent 4.22ms making 2736 calls to Readonly::Scalar::FETCH, avg 2µs/call
# spent 1.12ms making 144 calls to Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage::prepare_to_scan_document, avg 8µs/call |
| 158 | |||||
| 159 | 3024 | 4.79ms | 3024 | 20.7ms | my $maximum_violations = $policy->get_maximum_violations_per_document(); # spent 20.7ms making 3024 calls to Perl::Critic::Policy::get_maximum_violations_per_document, avg 7µs/call |
| 160 | 3024 | 500µs | return if defined $maximum_violations && $maximum_violations == 0; | ||
| 161 | |||||
| 162 | 3024 | 817µs | my @violations = (); | ||
| 163 | |||||
| 164 | TYPE: | ||||
| 165 | 3024 | 7.33ms | 3024 | 5.99ms | for my $type ( $policy->applies_to() ) { # spent 330µs making 144 calls to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::applies_to, avg 2µs/call
# spent 320µs making 144 calls to Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect::applies_to, avg 2µs/call
# spent 309µs making 144 calls to Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef::applies_to, avg 2µs/call
# spent 305µs making 144 calls to Perl::Critic::Policy::Modules::ProhibitEvilModules::applies_to, avg 2µs/call
# spent 303µs making 144 calls to Perl::Critic::Policy::Subroutines::ProhibitReturnSort::applies_to, avg 2µs/call
# spent 298µs making 144 calls to Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles::applies_to, avg 2µs/call
# spent 291µs making 144 calls to Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::applies_to, avg 2µs/call
# spent 290µs making 144 calls to Perl::Critic::Policy::Subroutines::ProhibitNestedSubs::applies_to, avg 2µs/call
# spent 284µs making 144 calls to Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros::applies_to, avg 2µs/call
# spent 283µs making 144 calls to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::applies_to, avg 2µs/call
# spent 282µs making 144 calls to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::applies_to, avg 2µs/call
# spent 281µs making 144 calls to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::applies_to, avg 2µs/call
# spent 280µs making 144 calls to Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless::applies_to, avg 2µs/call
# spent 276µs making 144 calls to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval::applies_to, avg 2µs/call
# spent 276µs making 144 calls to Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction::applies_to, avg 2µs/call
# spent 272µs making 144 calls to Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes::applies_to, avg 2µs/call
# spent 267µs making 144 calls to Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict::applies_to, avg 2µs/call
# spent 263µs making 144 calls to Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest::applies_to, avg 2µs/call
# spent 262µs making 144 calls to Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage::applies_to, avg 2µs/call
# spent 259µs making 144 calls to Perl::Critic::Policy::Modules::RequireBarewordIncludes::applies_to, avg 2µs/call
# spent 258µs making 144 calls to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::applies_to, avg 2µs/call |
| 166 | 3024 | 316µs | my @elements; | ||
| 167 | 3024 | 1.36ms | if ($type eq 'PPI::Document') { | ||
| 168 | @elements = ($doc); | ||||
| 169 | } | ||||
| 170 | else { | ||||
| 171 | 2736 | 12.3ms | 2736 | 17.3ms | @elements = @{ $doc->find($type) || [] }; # spent 17.3ms making 2736 calls to Perl::Critic::Document::find, avg 6µs/call |
| 172 | } | ||||
| 173 | |||||
| 174 | ELEMENT: | ||||
| 175 | 3024 | 5.54ms | for my $element (@elements) { | ||
| 176 | |||||
| 177 | # Evaluate the policy on this $element. A policy may | ||||
| 178 | # return zero or more violations. We only want the | ||||
| 179 | # violations that occur on lines that have not been | ||||
| 180 | # disabled. | ||||
| 181 | |||||
| 182 | VIOLATION: | ||||
| 183 | 136782 | 272ms | 136782 | 5.65s | for my $violation ( $policy->violates( $element, $doc ) ) { # spent 1.34s making 1016 calls to Perl::Critic::Policy::Subroutines::ProhibitNestedSubs::violates, avg 1.32ms/call
# spent 630ms making 13481 calls to Perl::Critic::Policy::Subroutines::ProhibitReturnSort::violates, avg 47µs/call
# spent 620ms making 13481 calls to Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef::violates, avg 46µs/call
# spent 431ms making 144 calls to Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict::violates, avg 3.00ms/call
# spent 413ms making 13481 calls to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::violates, avg 31µs/call
# spent 322ms making 13481 calls to Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles::violates, avg 24µs/call
# spent 315ms making 13481 calls to Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless::violates, avg 23µs/call
# spent 305ms making 13481 calls to Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect::violates, avg 23µs/call
# spent 293ms making 13481 calls to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval::violates, avg 22µs/call
# spent 277ms making 1299 calls to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::violates, avg 213µs/call
# spent 195ms making 8379 calls to Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest::violates, avg 23µs/call
# spent 167ms making 13481 calls to Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::violates, avg 12µs/call
# spent 151ms making 13481 calls to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates, avg 11µs/call
# spent 51.3ms making 1016 calls to Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes::violates, avg 50µs/call
# spent 37.1ms making 982 calls to Perl::Critic::Policy::Modules::ProhibitEvilModules::violates, avg 38µs/call
# spent 33.5ms making 504 calls to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::violates, avg 66µs/call
# spent 27.1ms making 144 calls to Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage::violates, avg 188µs/call
# spent 20.9ms making 982 calls to Perl::Critic::Policy::Modules::RequireBarewordIncludes::violates, avg 21µs/call
# spent 20.3ms making 982 calls to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::violates, avg 21µs/call
# spent 104µs making 5 calls to Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction::violates, avg 21µs/call |
| 184 | |||||
| 185 | 3 | 6µs | 3 | 6µs | my $line = $violation->location()->[0]; # spent 6µs making 3 calls to Perl::Critic::Violation::location, avg 2µs/call |
| 186 | 3 | 5µs | 3 | 12µs | if ( $doc->line_is_disabled_for_policy($line, $policy) ) { # spent 12µs making 3 calls to Perl::Critic::Document::line_is_disabled_for_policy, avg 4µs/call |
| 187 | 3 | 5µs | 3 | 8µs | $doc->add_suppressed_violation($violation); # spent 8µs making 3 calls to Perl::Critic::Document::add_suppressed_violation, avg 3µs/call |
| 188 | 3 | 2µs | next VIOLATION; | ||
| 189 | } | ||||
| 190 | |||||
| 191 | push @violations, $violation; | ||||
| 192 | last TYPE if defined $maximum_violations and @violations >= $maximum_violations; | ||||
| 193 | } | ||||
| 194 | } | ||||
| 195 | } | ||||
| 196 | |||||
| 197 | 3024 | 6.52ms | return @violations; | ||
| 198 | } | ||||
| 199 | |||||
| 200 | #----------------------------------------------------------------------------- | ||||
| 201 | |||||
| 202 | # spent 4.52ms (1.74+2.77) within Perl::Critic::_futz_with_policy_order which was called 144 times, avg 31µs/call:
# 144 times (1.74ms+2.77ms) by Perl::Critic::_gather_violations at line 134, avg 31µs/call | ||||
| 203 | # The ProhibitUselessNoCritic policy is another special policy. It | ||||
| 204 | # deals with the violations that *other* Policies produce. Therefore | ||||
| 205 | # it needs to be run *after* all the other Policies. TODO: find | ||||
| 206 | # a way for Policies to express an ordering preference somehow. | ||||
| 207 | |||||
| 208 | 144 | 165µs | my @policy_objects = @_; | ||
| 209 | 144 | 72µs | my $magical_policy_name = 'Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic'; | ||
| 210 | 3168 | 3.16ms | 144 | 2.77ms | my $idx = firstidx {ref $_ eq $magical_policy_name} @policy_objects; # spent 2.77ms making 144 calls to List::MoreUtils::firstidx, avg 19µs/call |
| 211 | 144 | 165µs | push @policy_objects, splice @policy_objects, $idx, 1; | ||
| 212 | 144 | 552µs | return @policy_objects; | ||
| 213 | } | ||||
| 214 | |||||
| 215 | #----------------------------------------------------------------------------- | ||||
| 216 | |||||
| 217 | 1 | 4µs | 1; | ||
| 218 | |||||
| - - | |||||
| 221 | __END__ |