← 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:12 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Modules/ProhibitExcessMainComplexity.pm
StatementsExecuted 19 statements in 354µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11118µs18µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@10Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@10
11110µs31µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@16Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@16
1118µs12µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@12Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@12
1118µs64µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@18Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@18
1118µs30µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@13Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@13
1118µs20µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@11Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@11
1117µs155µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::BEGIN@15Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@15
1117µs9µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::default_severityPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::default_severity
1115µs5µsPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::supported_parametersPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::supported_parameters
0000s0sPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::applies_toPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::applies_to
0000s0sPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::default_themesPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::default_themes
0000s0sPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::::violatesPerl::Critic::Policy::Modules::ProhibitExcessMainComplexity::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::Modules::ProhibitExcessMainComplexity;
9
10243µs118µs
# spent 18µs within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@10 which was called: # once (18µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11225µs232µs
# spent 20µs (8+12) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@11 which was called: # once (8µs+12µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 20µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@11 # spent 12µs making 1 call to strict::import
12220µs216µs
# spent 12µs (8+4) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::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::Modules::ProhibitExcessMainComplexity::BEGIN@12 # spent 4µs making 1 call to warnings::import
13223µs251µs
# spent 30µs (8+22) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@13 which was called: # once (8µs+22µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 30µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14
15226µs2303µs
# spent 155µs (7+148) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@15 which was called: # once (7µs+148µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities };
# spent 155µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@15 # spent 148µs making 1 call to Exporter::import
16229µs252µs
# spent 31µs (10+21) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@16 which was called: # once (10µs+21µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils::McCabe qw{ calculate_mccabe_of_main };
# spent 31µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@16 # spent 21µs making 1 call to Exporter::import
17
182173µs2121µs
# spent 64µs (8+56) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@18 which was called: # once (8µs+56µs) by Module::Pluggable::Object::_require at line 18
use base 'Perl::Critic::Policy';
# spent 64µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@18 # spent 56µs making 1 call to base::import
19
20#-----------------------------------------------------------------------------
21
221600nsour $VERSION = '1.121';
23
24#-----------------------------------------------------------------------------
25
2612µs130µsReadonly::Scalar my $EXPL => q{Consider refactoring};
# spent 30µs making 1 call to Readonly::Scalar
27
28#-----------------------------------------------------------------------------
29
30
# spent 5µs within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::supported_parameters which was called: # once (5µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
31 return (
32 {
3318µs name => 'max_mccabe',
34 description => 'The maximum complexity score allowed.',
35 default_string => '20',
36 behavior => 'integer',
37 integer_minimum => 1,
38 },
39 );
40}
41
4212µs
# spent 9µs (7+2) within Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::default_severity which was called: # once (7µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_MEDIUM }
43sub default_themes { return qw(core complexity maintenance) }
44sub applies_to { return 'PPI::Document' }
45
46#-----------------------------------------------------------------------------
47
48sub violates {
49 my ( $self, $doc, undef ) = @_;
50
51 my $score = calculate_mccabe_of_main( $doc );
52
53 # Is it too complex?
54 return if $score <= $self->{_max_mccabe};
55
56 my $desc = qq{Main code has high complexity score ($score)};
57 return $self->violation( $desc, $EXPL, $doc );
58}
59
60
6113µs1;
62
63__END__