Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Miscellanea/ProhibitUselessNoCritic.pm |
Statements | Executed 20 statements in 618µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 483µs | BEGIN@18 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 15µs | 15µs | BEGIN@10 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 14µs | 104µs | BEGIN@19 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 8µs | 28µs | BEGIN@14 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 8µs | 9µs | default_severity | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 7µs | 139µs | BEGIN@16 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 7µs | 10µs | BEGIN@12 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 6µs | 17µs | BEGIN@11 | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
0 | 0 | 0 | 0s | 0s | __ANON__[:47] | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
0 | 0 | 0 | 0s | 0s | _annotation_suppresses_violation | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::
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::Miscellanea::ProhibitUselessNoCritic; | ||||
9 | |||||
10 | 2 | 42µs | 1 | 15µs | # spent 15µs within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@10 which was called:
# once (15µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 15µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@10 |
11 | 2 | 20µs | 2 | 28µs | # spent 17µs (6+11) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@11 which was called:
# once (6µs+11µs) by Module::Pluggable::Object::_require at line 11 # spent 17µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 20µs | 2 | 14µs | # spent 10µs (7+4) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@12 which was called:
# once (7µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 10µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 28µs | 2 | 48µs | # spent 28µs (8+20) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@14 which was called:
# once (8µs+20µs) by Module::Pluggable::Object::_require at line 14 # spent 28µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@14
# spent 20µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 24µs | 2 | 271µs | # spent 139µs (7+132) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@16 which was called:
# once (7µs+132µs) by Module::Pluggable::Object::_require at line 16 # spent 139µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@16
# spent 132µs making 1 call to Exporter::Tiny::import |
17 | |||||
18 | 2 | 88µs | 2 | 950µs | # spent 483µs (16+467) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@18 which was called:
# once (16µs+467µs) by Module::Pluggable::Object::_require at line 18 # spent 483µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@18
# spent 467µs making 1 call to Exporter::import |
19 | 2 | 378µs | 2 | 193µs | # spent 104µs (14+90) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@19 which was called:
# once (14µs+90µs) by Module::Pluggable::Object::_require at line 19 # spent 104µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@19
# spent 90µs making 1 call to base::import |
20 | |||||
21 | 1 | 1µs | our $VERSION = '1.121'; | ||
22 | |||||
23 | #----------------------------------------------------------------------------- | ||||
24 | |||||
25 | 1 | 3µs | 1 | 50µs | Readonly::Scalar my $DESC => q{Useless '## no critic' annotation}; # spent 50µs making 1 call to Readonly::Scalar |
26 | 1 | 2µs | 1 | 35µs | Readonly::Scalar my $EXPL => q{This annotation can be removed}; # spent 35µs making 1 call to Readonly::Scalar |
27 | |||||
28 | #----------------------------------------------------------------------------- | ||||
29 | |||||
30 | 1 | 4µs | # spent 2µs within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
31 | 1 | 2µs | # spent 9µs (8+2) within Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::default_severity which was called:
# once (8µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
32 | sub default_themes { return qw(core maintenance) } | ||||
33 | sub applies_to { return 'PPI::Document' } | ||||
34 | |||||
35 | #----------------------------------------------------------------------------- | ||||
36 | |||||
37 | sub violates { | ||||
38 | my ( $self, undef, $doc ) = @_; | ||||
39 | |||||
40 | # If for some reason $doc is not a P::C::Document, then all bets are off | ||||
41 | return if not $doc->isa('Perl::Critic::Document'); | ||||
42 | |||||
43 | my @violations = (); | ||||
44 | my @suppressed_viols = $doc->suppressed_violations(); | ||||
45 | |||||
46 | for my $ann ( $doc->annotations() ) { | ||||
47 | if ( none { _annotation_suppresses_violation($ann, $_) } @suppressed_viols ) { | ||||
48 | push @violations, $self->violation($DESC, $EXPL, $ann->element()); | ||||
49 | } | ||||
50 | } | ||||
51 | |||||
52 | return @violations; | ||||
53 | } | ||||
54 | |||||
55 | #----------------------------------------------------------------------------- | ||||
56 | |||||
57 | sub _annotation_suppresses_violation { | ||||
58 | my ($annotation, $violation) = @_; | ||||
59 | |||||
60 | my $policy_name = $violation->policy(); | ||||
61 | my $line = $violation->location()->[0]; | ||||
62 | |||||
63 | return $annotation->disables_line($line) | ||||
64 | && $annotation->disables_policy($policy_name); | ||||
65 | } | ||||
66 | |||||
67 | #----------------------------------------------------------------------------- | ||||
68 | |||||
69 | 1 | 6µs | 1; | ||
70 | |||||
71 | __END__ |