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

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm
StatementsExecuted 24 statements in 573µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111427µs6.05msPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@16Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16
11116µs351µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@19Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@19
11116µs16µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@10Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@10
11111µs11µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@18Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@18
1118µs28µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@14Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@14
1118µs68µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@21Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@21
1117µs378µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@13Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@13
1117µs11µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@12Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@12
1117µs18µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::BEGIN@11Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@11
1116µs7µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::default_severityPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::default_severity
1112µs2µsPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::supported_parametersPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::supported_parameters
0000s0sPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::_escapePerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::_escape
0000s0sPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::applies_toPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::applies_to
0000s0sPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::default_themesPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::default_themes
0000s0sPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::::violatesPerl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::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::CodeLayout::ProhibitTrailingWhitespace;
9
10243µs116µs
# spent 16µs within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs229µs
# spent 18µs (7+11) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@11 # spent 11µs making 1 call to strict::import
12220µs215µs
# spent 11µs (7+4) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::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::CodeLayout::ProhibitTrailingWhitespace::BEGIN@12 # spent 4µs making 1 call to warnings::import
13223µs2749µs
# spent 378µs (7+371) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@13 which was called: # once (7µs+371µs) by Module::Pluggable::Object::_require at line 13
use English qw(-no_match_vars);
# spent 378µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@13 # spent 371µs making 1 call to English::import
14221µs247µs
# spent 28µs (8+19) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@14 which was called: # once (8µs+19µs) by Module::Pluggable::Object::_require at line 14
use Readonly;
# spent 28µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@14 # spent 19µs making 1 call to Exporter::import
15
16291µs16.05ms
# spent 6.05ms (427µs+5.62) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 which was called: # once (427µs+5.62ms) by Module::Pluggable::Object::_require at line 16
use charnames qw{};
17
18229µs111µs
# spent 11µs within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@18 which was called: # once (11µs+0s) by Module::Pluggable::Object::_require at line 18
use PPI::Token::Whitespace;
19227µs2686µs
# spent 351µs (16+335) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@19 which was called: # once (16µs+335µs) by Module::Pluggable::Object::_require at line 19
use Perl::Critic::Utils qw{ :characters :severities };
# spent 351µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@19 # spent 335µs making 1 call to Exporter::import
20
212284µs2127µs
# spent 68µs (8+60) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@21 which was called: # once (8µs+60µs) by Module::Pluggable::Object::_require at line 21
use base 'Perl::Critic::Policy';
# spent 68µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@21 # spent 60µs making 1 call to base::import
22
231600nsour $VERSION = '1.121';
24
25#-----------------------------------------------------------------------------
26
2712µs134µsReadonly::Scalar my $EXPL => q{Don't use whitespace at the end of lines};
# spent 34µs making 1 call to Readonly::Scalar
28
29## no critic (RequireInterpolationOfMetachars)
3012µs136µsReadonly::Hash my %C_STYLE_ESCAPES =>
# spent 36µs making 1 call to Readonly::Hash
31 (
32 ord "\t" => q{\t},
33 ord "\n" => q{\n},
34 ord "\r" => q{\r},
35 ord "\f" => q{\f},
36 ord "\b" => q{\b},
37 ord "\a" => q{\a},
38 ord "\e" => q{\e},
39 );
40## use critic
41
42#-----------------------------------------------------------------------------
43
4415µs
# spent 2µs within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::supported_parameters which was called: # once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters { return qw{ } }
4512µs
# spent 7µs (6+1) within Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::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_LOWEST }
46sub default_themes { return qw( core maintenance ) }
47sub applies_to { return 'PPI::Token::Whitespace' }
48
49#-----------------------------------------------------------------------------
50
51sub violates {
52 my ( $self, $token, undef ) = @_;
53
54 if ( $token->content() =~ m< ( (?! \n) \s )+ \n >xms ) {
55 my $extra_whitespace = $1;
56
57 my $description = q{Found "};
58 $description .=
59 join
60 $EMPTY,
61 map { _escape($_) } split $EMPTY, $extra_whitespace;
62 $description .= q{" at the end of the line};
63
64 return $self->violation( $description, $EXPL, $token );
65 }
66
67 return;
68}
69
70sub _escape {
71 my $character = shift;
72 my $ordinal = ord $character;
73
74 if (my $c_escape = $C_STYLE_ESCAPES{$ordinal}) {
75 return $c_escape;
76 }
77
78
79 # Apparently, the charnames.pm that ships with older perls does not
80 # support the C<viacode> function, and newer versions of the module are
81 # not distributed separately from perl itself So if the C<viacode> method
82 # is not supported, then just substitute something.
83
84
85 ## no critic (RequireInterpolationOfMetachars)
86 if ( charnames->can( 'viacode' ) ) {
87 return q/\N{/ . charnames::viacode($ordinal) . q/}/;
88 }
89 else {
90 return '\N{WHITESPACE CHAR}';
91 }
92}
93
9414µs1;
95
96#-----------------------------------------------------------------------------
97
98__END__