Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Modules/ProhibitExcessMainComplexity.pm |
Statements | Executed 19 statements in 354µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 18µs | 18µs | BEGIN@10 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 10µs | 31µs | BEGIN@16 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 8µs | 12µs | BEGIN@12 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 8µs | 64µs | BEGIN@18 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 8µs | 30µs | BEGIN@13 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 8µs | 20µs | BEGIN@11 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 7µs | 155µs | BEGIN@15 | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 7µs | 9µs | default_severity | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
1 | 1 | 1 | 5µs | 5µs | supported_parameters | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::
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::Policy::Modules::ProhibitExcessMainComplexity; | ||||
9 | |||||
10 | 2 | 43µs | 1 | 18µ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 # spent 18µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@10 |
11 | 2 | 25µs | 2 | 32µ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 # spent 20µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@11
# spent 12µs making 1 call to strict::import |
12 | 2 | 20µs | 2 | 16µ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 # spent 12µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | 2 | 23µs | 2 | 51µ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 # spent 30µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@13
# spent 22µs making 1 call to Exporter::import |
14 | |||||
15 | 2 | 26µs | 2 | 303µ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 # spent 155µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@15
# spent 148µs making 1 call to Exporter::import |
16 | 2 | 29µs | 2 | 52µ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 # spent 31µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::BEGIN@16
# spent 21µs making 1 call to Exporter::import |
17 | |||||
18 | 2 | 173µs | 2 | 121µ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 # 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 | |||||
22 | 1 | 600ns | our $VERSION = '1.121'; | ||
23 | |||||
24 | #----------------------------------------------------------------------------- | ||||
25 | |||||
26 | 1 | 2µs | 1 | 30µs | Readonly::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 | ||||
31 | return ( | ||||
32 | { | ||||
33 | 1 | 8µ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 | |||||
42 | 1 | 2µ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 | ||
43 | sub default_themes { return qw(core complexity maintenance) } | ||||
44 | sub applies_to { return 'PPI::Document' } | ||||
45 | |||||
46 | #----------------------------------------------------------------------------- | ||||
47 | |||||
48 | sub 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 | |||||
61 | 1 | 3µs | 1; | ||
62 | |||||
63 | __END__ |