← 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/RequireBracesForMultiline.pm
StatementsExecuted 23 statements in 431µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs19µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@10Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@10
1118µs35µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@16Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@16
1118µs11µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@12Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@12
1117µs28µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@13Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@13
1117µs61µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@20Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@20
1117µs183µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@18Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@18
1117µs18µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@11Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@11
1117µs371µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::BEGIN@15Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@15
1116µs7µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::default_severityPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::default_severity
1114µs4µsPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::supported_parametersPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::supported_parameters
0000s0sPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::applies_toPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::applies_to
0000s0sPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::default_themesPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::default_themes
0000s0sPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::initialize_if_enabledPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::initialize_if_enabled
0000s0sPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::::violatesPerl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::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::RequireBracesForMultiline;
9
10245µs119µs
# spent 19µs within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@10 which was called: # once (19µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs230µs
# spent 18µs (7+12) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@11 which was called: # once (7µs+12µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@11 # spent 12µs making 1 call to strict::import
12218µs215µs
# spent 11µs (8+4) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@12 # spent 4µs making 1 call to warnings::import
13221µs248µs
# spent 28µs (7+20) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@13 which was called: # once (7µs+20µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 28µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14
15222µs2735µs
# spent 371µs (7+364) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@15 which was called: # once (7µs+364µs) by Module::Pluggable::Object::_require at line 15
use English qw(-no_match_vars);
# spent 371µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@15 # spent 364µs making 1 call to English::import
16226µs263µs
# spent 35µs (8+28) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@16 which was called: # once (8µs+28µs) by Module::Pluggable::Object::_require at line 16
use Carp;
# spent 35µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@16 # spent 28µs making 1 call to Exporter::import
17
18224µs2359µs
# spent 183µs (7+176) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@18 which was called: # once (7µs+176µs) by Module::Pluggable::Object::_require at line 18
use Perl::Critic::Utils qw{ :booleans :severities };
# spent 183µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@18 # spent 176µs making 1 call to Exporter::import
19
202236µs2114µs
# spent 61µs (7+54) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@20 which was called: # once (7µs+54µs) by Module::Pluggable::Object::_require at line 20
use base 'Perl::Critic::Policy';
# spent 61µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@20 # spent 54µs making 1 call to base::import
21
221500nsour $VERSION = '1.121';
23
24#-----------------------------------------------------------------------------
25
2612µs129µsReadonly::Scalar my $DESC => q<Use '{' and '}' to delimit multi-line regexps>;
# spent 29µs making 1 call to Readonly::Scalar
2712µs142µsReadonly::Scalar my $EXPL => [242];
# spent 42µs making 1 call to Readonly::Scalar
28
2911µs118µsReadonly::Array my @EXTRA_BRACKETS => qw{ () [] <> };
# spent 18µs making 1 call to Readonly::Array
30
31#-----------------------------------------------------------------------------
32
33
# spent 4µs within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::supported_parameters which was called: # once (4µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
34 return (
35 {
3618µs name => 'allow_all_brackets',
37 description =>
38 q[In addition to allowing '{}', allow '()', '[]', and '{}'.],
39 behavior => 'boolean',
40 },
41 );
42}
43
4412µs
# spent 7µs (6+1) within Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::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 }
45sub default_themes { return qw( core pbp cosmetic ) }
46sub applies_to { return qw(PPI::Token::Regexp::Match
47 PPI::Token::Regexp::Substitute
48 PPI::Token::QuoteLike::Regexp) }
49
50#-----------------------------------------------------------------------------
51
52sub initialize_if_enabled {
53 my ( $self, $config ) = @_;
54
55 my %delimiters = ( q<{}> => 1 );
56 if ( $self->{_allow_all_brackets} ) {
57 @delimiters{ @EXTRA_BRACKETS } = (1) x @EXTRA_BRACKETS;
58 }
59
60 $self->{_allowed_delimiters} = \%delimiters;
61
62 return $TRUE;
63}
64
65#-----------------------------------------------------------------------------
66
67sub violates {
68 my ( $self, $elem, undef ) = @_;
69
70 my $re = $elem->get_match_string();
71 return if $re !~ m/\n/xms;
72
73 my ($match_delim) = $elem->get_delimiters();
74 return if $self->{_allowed_delimiters}{$match_delim};
75
76 return $self->violation( $DESC, $EXPL, $elem );
77}
78
7914µs1;
80
81__END__