Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/ValuesAndExpressions/RequireNumberSeparators.pm |
Statements | Executed 19 statements in 356µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 22µs | 22µs | BEGIN@10 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 14µs | 16µs | supported_parameters | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 9µs | 41µs | BEGIN@13 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 9µs | 16µs | BEGIN@12 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 9µs | 24µs | BEGIN@11 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 9µs | 70µs | BEGIN@16 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 8µs | 186µs | BEGIN@15 | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
1 | 1 | 1 | 6µs | 7µs | default_severity | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::
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::ValuesAndExpressions::RequireNumberSeparators; | ||||
9 | |||||
10 | 2 | 48µs | 1 | 22µs | # spent 22µs within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@10 which was called:
# once (22µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 22µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@10 |
11 | 2 | 23µs | 2 | 40µs | # spent 24µs (9+16) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@11 which was called:
# once (9µs+16µs) by Module::Pluggable::Object::_require at line 11 # spent 24µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@11
# spent 16µs making 1 call to strict::import |
12 | 2 | 21µs | 2 | 23µs | # spent 16µs (9+7) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@12 which was called:
# once (9µs+7µs) by Module::Pluggable::Object::_require at line 12 # spent 16µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@12
# spent 7µs making 1 call to warnings::import |
13 | 2 | 26µs | 2 | 73µs | # spent 41µs (9+32) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@13 which was called:
# once (9µs+32µs) by Module::Pluggable::Object::_require at line 13 # spent 41µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@13
# spent 32µs making 1 call to Exporter::import |
14 | |||||
15 | 2 | 26µs | 2 | 364µs | # spent 186µs (8+178) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@15 which was called:
# once (8µs+178µs) by Module::Pluggable::Object::_require at line 15 # spent 186µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@15
# spent 178µs making 1 call to Exporter::import |
16 | 2 | 190µs | 2 | 132µs | # spent 70µs (9+62) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@16 which was called:
# once (9µs+62µs) by Module::Pluggable::Object::_require at line 16 # spent 70µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::BEGIN@16
# spent 62µs making 1 call to base::import |
17 | |||||
18 | 1 | 600ns | our $VERSION = '1.121'; | ||
19 | |||||
20 | #----------------------------------------------------------------------------- | ||||
21 | |||||
22 | 1 | 2µs | 1 | 38µs | Readonly::Scalar my $DESC => q{Long number not separated with underscores}; # spent 38µs making 1 call to Readonly::Scalar |
23 | 1 | 2µs | 1 | 51µs | Readonly::Scalar my $EXPL => [ 59 ]; # spent 51µs making 1 call to Readonly::Scalar |
24 | |||||
25 | #----------------------------------------------------------------------------- | ||||
26 | |||||
27 | 1 | 1µs | 1 | 21µs | Readonly::Scalar my $MINIMUM_INTEGER_WITH_MULTIPLE_DIGITS => 10; # spent 21µs making 1 call to Readonly::Scalar |
28 | |||||
29 | # spent 16µs (14+2) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::supported_parameters which was called:
# once (14µs+2µs) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||||
30 | return ( | ||||
31 | { | ||||
32 | 1 | 11µs | 2 | 2µs | name => 'min_value', # spent 2µs making 2 calls to Readonly::Scalar::FETCH, avg 1µs/call |
33 | description => 'The minimum absolute value to require separators in.', | ||||
34 | default_string => '10_000', | ||||
35 | behavior => 'integer', | ||||
36 | integer_minimum => $MINIMUM_INTEGER_WITH_MULTIPLE_DIGITS, | ||||
37 | }, | ||||
38 | ); | ||||
39 | } | ||||
40 | |||||
41 | 1 | 2µs | # spent 7µs (6+1) within Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
42 | sub default_themes { return qw( core pbp cosmetic ) } | ||||
43 | sub applies_to { return 'PPI::Token::Number' } | ||||
44 | |||||
45 | #----------------------------------------------------------------------------- | ||||
46 | |||||
47 | sub violates { | ||||
48 | my ( $self, $elem, undef ) = @_; | ||||
49 | my $min = $self->{_min_value}; | ||||
50 | |||||
51 | return if $elem !~ m{ \d{4} }xms; | ||||
52 | return if abs $elem->literal() < $min; | ||||
53 | |||||
54 | return $self->violation( $DESC, $EXPL, $elem ); | ||||
55 | } | ||||
56 | |||||
57 | 1 | 4µs | 1; | ||
58 | |||||
59 | __END__ |