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

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm
StatementsExecuted 20 statements in 529µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11138µs49µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::supported_parametersPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::supported_parameters
11115µs15µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@10Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@10
1117µs57µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@18Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@18
1117µs9µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::default_severityPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::default_severity
1117µs669µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@15Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@15
1117µs10µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@12Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@12
1117µs27µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@13Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@13
1117µs18µsPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::BEGIN@11Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@11
0000s0sPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::applies_toPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::applies_to
0000s0sPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::default_themesPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::default_themes
0000s0sPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::initialize_if_enabledPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::initialize_if_enabled
0000s0sPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::::violatesPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls::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::InputOutput::RequireCheckedSyscalls;
9
10241µs115µs
# spent 15µs within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@10 which was called: # once (15µ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::InputOutput::RequireCheckedSyscalls::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::InputOutput::RequireCheckedSyscalls::BEGIN@11 # spent 11µs making 1 call to strict::import
12218µs214µs
# spent 10µs (7+3) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@12 which was called: # once (7µs+3µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 10µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@12 # spent 4µs making 1 call to warnings::import
13224µs247µs
# spent 27µs (7+20) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::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::InputOutput::RequireCheckedSyscalls::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14
151200ns
# spent 669µs (7+662) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@15 which was called: # once (7µs+662µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils qw{ :booleans :characters :severities :classification
16125µs21.33ms hashify is_perl_bareword };
# spent 669µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@15 # spent 662µs making 1 call to Exporter::import
17
182356µs2107µs
# spent 57µs (7+50) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@18 which was called: # once (7µs+50µs) by Module::Pluggable::Object::_require at line 18
use base 'Perl::Critic::Policy';
# spent 57µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::BEGIN@18 # spent 50µs making 1 call to base::import
19
201500nsour $VERSION = '1.121';
21
22#-----------------------------------------------------------------------------
23
2412µs129µsReadonly::Scalar my $DESC => q{Return value of flagged function ignored};
# spent 29µs making 1 call to Readonly::Scalar
2512µs143µsReadonly::Scalar my $EXPL => [208, 278];
# spent 43µs making 1 call to Readonly::Scalar
26
2711µs120µsReadonly::Array my @DEFAULT_FUNCTIONS => qw(
# spent 20µs making 1 call to Readonly::Array
28 open close print say
29);
30# I created this list by searching for "return" in perlfunc
3112µs161µsReadonly::Array my @BUILTIN_FUNCTIONS => qw(
# spent 61µs making 1 call to Readonly::Array
32 accept bind binmode chdir chmod chown close closedir connect
33 dbmclose dbmopen exec fcntl flock fork ioctl kill link listen
34 mkdir msgctl msgget msgrcv msgsnd open opendir pipe print read
35 readdir readline readlink readpipe recv rename rmdir say seek seekdir
36 semctl semget semop send setpgrp setpriority setsockopt shmctl
37 shmget shmread shutdown sleep socket socketpair symlink syscall
38 sysopen sysread sysseek system syswrite tell telldir truncate
39 umask unlink utime wait waitpid
40);
41
42#-----------------------------------------------------------------------------
43
44
# spent 49µs (38+12) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::supported_parameters which was called: # once (38µs+12µs) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
45 return (
46 {
47125µs812µs name => 'functions',
# spent 6µs making 4 calls to Readonly::Array::FETCH, avg 2µs/call # spent 3µs making 3 calls to Readonly::Scalar::FETCH, avg 1µs/call # spent 2µs making 1 call to Readonly::Array::FETCHSIZE
48 description =>
49 'The set of functions to require checking the return value of.',
50 default_string => join( $SPACE, @DEFAULT_FUNCTIONS ),
51 behavior => 'string list',
52 },
53 {
54 name => 'exclude_functions',
55 description =>
56 'The set of functions to not require checking the return value of.',
57 default_string => $EMPTY,
58 behavior => 'string list',
59 },
60 );
61}
62
6312µs
# spent 9µs (7+2) within Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::default_severity which was called: # once (7µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_LOWEST }
64sub default_themes { return qw( core maintenance certrule ) }
65sub applies_to { return 'PPI::Token::Word' }
66
67#-----------------------------------------------------------------------------
68
69sub initialize_if_enabled {
70 my ($self, $config) = @_;
71
72 my @specified_functions = keys %{ $self->{_functions} };
73 my @resulting_functions;
74
75 foreach my $function (@specified_functions) {
76 if ( $function eq ':defaults' ) {
77 push @resulting_functions, @DEFAULT_FUNCTIONS;
78 }
79 elsif ( $function eq ':builtins' ) {
80 push @resulting_functions, @BUILTIN_FUNCTIONS;
81 }
82 else {
83 push @resulting_functions, $function;
84 }
85 }
86
87 my %functions = hashify(@resulting_functions);
88
89 foreach my $function ( keys %{ $self->{_exclude_functions} } ) {
90 delete $functions{$function};
91 }
92
93 $self->{_functions} = \%functions;
94
95 return $TRUE;
96}
97
98#-----------------------------------------------------------------------------
99
100sub violates {
101 my ( $self, $elem, undef ) = @_;
102
103 if ( $self->{_functions}->{':all'} ) {
104 return if is_perl_bareword($elem);
105 return if $self->{_exclude_functions}->{ $elem->content() };
106 }
107 elsif ( not $self->{_functions}->{ $elem->content() } ) {
108 return;
109 }
110
111 return if not is_unchecked_call( $elem );
112
113 return $self->violation( "$DESC - " . $elem->content(), $EXPL, $elem );
114}
115
116
117111µs1;
118
119__END__