← 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/Subroutines/ProhibitExcessComplexity.pm
StatementsExecuted 19 statements in 406µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111546µs1.10msPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@16Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@16
11116µs16µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@10Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@10
1117µs11µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@12Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@12
1117µs434µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@15Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@15
1117µs61µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@18Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@18
1117µs27µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@13Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@13
1117µs17µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::BEGIN@11Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@11
1116µs7µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::default_severityPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::default_severity
1116µs6µsPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::supported_parametersPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::supported_parameters
0000s0sPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::applies_toPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::applies_to
0000s0sPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::default_themesPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::default_themes
0000s0sPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::::violatesPerl::Critic::Policy::Subroutines::ProhibitExcessComplexity::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::Subroutines::ProhibitExcessComplexity;
9
10239µs116µs
# spent 16µs within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11219µs228µs
# spent 17µs (7+11) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 17µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@11 # spent 11µs making 1 call to strict::import
12218µs214µs
# spent 11µs (7+4) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::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::Subroutines::ProhibitExcessComplexity::BEGIN@12 # spent 4µs making 1 call to warnings::import
13226µs247µs
# spent 27µs (7+20) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@13 which was called: # once (7µs+20µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 27µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14
15225µs2862µs
# spent 434µs (7+427) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@15 which was called: # once (7µs+427µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities :data_conversion :classification };
# spent 434µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@15 # spent 427µs making 1 call to Exporter::import
16293µs21.15ms
# spent 1.10ms (546µs+559µs) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@16 which was called: # once (546µs+559µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils::McCabe qw{ calculate_mccabe_of_sub };
# spent 1.10ms making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@16 # spent 42µs making 1 call to Exporter::import
17
182172µs2115µs
# spent 61µs (7+54) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@18 which was called: # once (7µs+54µs) by Module::Pluggable::Object::_require at line 18
use base 'Perl::Critic::Policy';
# spent 61µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::BEGIN@18 # spent 54µs making 1 call to base::import
19
201600nsour $VERSION = '1.121';
21
22#-----------------------------------------------------------------------------
23
2412µs128µsReadonly::Scalar my $EXPL => q{Consider refactoring};
# spent 28µs making 1 call to Readonly::Scalar
25
26#-----------------------------------------------------------------------------
27
28
# spent 6µs within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::supported_parameters which was called: # once (6µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
29 return (
30 {
3118µs name => 'max_mccabe',
32 description => 'The maximum complexity score allowed.',
33 default_string => '20',
34 behavior => 'integer',
35 integer_minimum => 1,
36 },
37 );
38}
39
4012µs
# spent 7µs (6+1) within Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::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_MEDIUM }
41sub default_themes { return qw(core complexity maintenance) }
42sub applies_to { return 'PPI::Statement::Sub' }
43
44#-----------------------------------------------------------------------------
45
46sub violates {
47 my ( $self, $elem, undef ) = @_;
48
49 my $score = calculate_mccabe_of_sub( $elem );
50
51 # Is it too complex?
52 return if $score <= $self->{_max_mccabe};
53
54 my $desc;
55 if ( my $name = $elem->name() ) {
56 $desc = qq<Subroutine "$name" with high complexity score ($score)>;
57 }
58 else {
59 $desc = qq<Anonymous subroutine with high complexity score ($score)>;
60 }
61
62 return $self->violation( $desc, $EXPL, $elem );
63}
64
65
6613µs1;
67
68__END__