Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm |
Statements | Executed 23 statements in 431µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 19µs | 19µs | BEGIN@10 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 8µs | 35µs | BEGIN@16 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 8µs | 11µs | BEGIN@12 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 7µs | 28µs | BEGIN@13 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 7µs | 61µs | BEGIN@20 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 7µs | 183µs | BEGIN@18 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 7µs | 371µs | BEGIN@15 | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 6µs | 7µs | default_severity | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
1 | 1 | 1 | 4µs | 4µs | supported_parameters | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
0 | 0 | 0 | 0s | 0s | initialize_if_enabled | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::
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::RegularExpressions::RequireBracesForMultiline; | ||||
9 | |||||
10 | 2 | 45µs | 1 | 19µ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 # spent 19µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@10 |
11 | 2 | 20µs | 2 | 30µ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 # spent 18µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@11
# spent 12µs making 1 call to strict::import |
12 | 2 | 18µs | 2 | 15µ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 # spent 11µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | 2 | 21µs | 2 | 48µ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 # spent 28µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@13
# spent 20µs making 1 call to Exporter::import |
14 | |||||
15 | 2 | 22µs | 2 | 735µ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 # spent 371µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@15
# spent 364µs making 1 call to English::import |
16 | 2 | 26µs | 2 | 63µ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 # spent 35µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@16
# spent 28µs making 1 call to Exporter::import |
17 | |||||
18 | 2 | 24µs | 2 | 359µ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 # spent 183µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@18
# spent 176µs making 1 call to Exporter::import |
19 | |||||
20 | 2 | 236µs | 2 | 114µ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 # spent 61µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@20
# spent 54µs making 1 call to base::import |
21 | |||||
22 | 1 | 500ns | our $VERSION = '1.121'; | ||
23 | |||||
24 | #----------------------------------------------------------------------------- | ||||
25 | |||||
26 | 1 | 2µs | 1 | 29µs | Readonly::Scalar my $DESC => q<Use '{' and '}' to delimit multi-line regexps>; # spent 29µs making 1 call to Readonly::Scalar |
27 | 1 | 2µs | 1 | 42µs | Readonly::Scalar my $EXPL => [242]; # spent 42µs making 1 call to Readonly::Scalar |
28 | |||||
29 | 1 | 1µs | 1 | 18µs | Readonly::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 | ||||
34 | return ( | ||||
35 | { | ||||
36 | 1 | 8µs | name => 'allow_all_brackets', | ||
37 | description => | ||||
38 | q[In addition to allowing '{}', allow '()', '[]', and '{}'.], | ||||
39 | behavior => 'boolean', | ||||
40 | }, | ||||
41 | ); | ||||
42 | } | ||||
43 | |||||
44 | 1 | 2µ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 | ||
45 | sub default_themes { return qw( core pbp cosmetic ) } | ||||
46 | sub applies_to { return qw(PPI::Token::Regexp::Match | ||||
47 | PPI::Token::Regexp::Substitute | ||||
48 | PPI::Token::QuoteLike::Regexp) } | ||||
49 | |||||
50 | #----------------------------------------------------------------------------- | ||||
51 | |||||
52 | sub 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 | |||||
67 | sub 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 | |||||
79 | 1 | 4µs | 1; | ||
80 | |||||
81 | __END__ |