← 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/RegularExpressions/RequireExtendedFormatting.pm
StatementsExecuted 18 statements in 375µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11116µs16µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@10Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@10
1118µs8µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::supported_parametersPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::supported_parameters
1118µs61µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@17Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@17
1118µs144µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@15Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@15
1117µs11µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@12Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@12
1117µs18µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@11Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@11
1117µs27µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::BEGIN@13Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@13
1116µs7µsPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::default_severityPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::default_severity
0000s0sPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::applies_toPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::applies_to
0000s0sPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::default_themesPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::default_themes
0000s0sPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::::violatesPerl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::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::RegularExpressions::RequireExtendedFormatting;
9
10238µs116µs
# spent 16µs within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11225µs229µs
# spent 18µs (7+11) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::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::RegularExpressions::RequireExtendedFormatting::BEGIN@11 # spent 11µs making 1 call to strict::import
12218µs215µs
# spent 11µs (7+4) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::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::RegularExpressions::RequireExtendedFormatting::BEGIN@12 # spent 4µs making 1 call to warnings::import
13226µs247µs
# spent 27µs (7+20) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::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::RegularExpressions::RequireExtendedFormatting::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14
15224µs2281µs
# spent 144µs (8+137) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@15 which was called: # once (8µs+137µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities };
# spent 144µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@15 # spent 137µs making 1 call to Exporter::import
16
172226µs2115µs
# spent 61µs (8+54) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@17 which was called: # once (8µs+54µs) by Module::Pluggable::Object::_require at line 17
use base 'Perl::Critic::Policy';
# spent 61µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::BEGIN@17 # spent 54µs making 1 call to base::import
18
191600nsour $VERSION = '1.121';
20
21#-----------------------------------------------------------------------------
22
2312µs128µsReadonly::Scalar my $DESC => q{Regular expression without "/x" flag};
# spent 28µs making 1 call to Readonly::Scalar
2412µs142µsReadonly::Scalar my $EXPL => [ 236 ];
# spent 42µs making 1 call to Readonly::Scalar
25
26#-----------------------------------------------------------------------------
27
28
# spent 8µs within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::supported_parameters which was called: # once (8µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
29 return (
30 {
31110µs name => 'minimum_regex_length_to_complain_about',
32 description =>
33 q<The number of characters that a regular expression must contain before this policy will complain.>,
34 behavior => 'integer',
35 default_string => '0',
36 integer_minimum => 0,
37 },
38 {
39 name => 'strict',
40 description =>
41 q<Should regexes that only contain whitespace and word characters be complained about?>,
42 behavior => 'boolean',
43 default_string => '0',
44 },
45 );
46}
47
4812µs
# spent 7µs (6+1) within Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::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 }
49sub default_themes { return qw< core pbp maintenance > }
50sub applies_to {
51 return qw<
52 PPI::Token::Regexp::Match
53 PPI::Token::Regexp::Substitute
54 PPI::Token::QuoteLike::Regexp
55 >;
56}
57
58#-----------------------------------------------------------------------------
59
60sub violates {
61 my ( $self, $elem, $doc ) = @_;
62
63 my $match = $elem->get_match_string();
64 return if length $match <= $self->{_minimum_regex_length_to_complain_about};
65 return if not $self->{_strict} and $match =~ m< \A [\s\w]* \z >xms;
66
67 my $re = $doc->ppix_regexp_from_element( $elem )
68 or return;
69 $re->modifier_asserted( 'x' )
70 or return $self->violation( $DESC, $EXPL, $elem );
71
72 return; # ok!;
73}
74
7513µs1;
76
77__END__