Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy.pm |
Statements | Executed 22658 statements in 76.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3024 | 1 | 1 | 17.8ms | 20.7ms | get_maximum_violations_per_document | Perl::Critic::Policy::
141 | 1 | 1 | 17.6ms | 227ms | new | Perl::Critic::Policy::
2736 | 1 | 1 | 12.2ms | 16.4ms | prepare_to_scan_document | Perl::Critic::Policy::
141 | 1 | 1 | 10.8ms | 102ms | __set_base_parameters | Perl::Critic::Policy::
445 | 4 | 3 | 10.2ms | 40.6ms | to_string | Perl::Critic::Policy::
282 | 2 | 2 | 5.64ms | 5.64ms | __set_config | Perl::Critic::Policy::
141 | 1 | 1 | 5.32ms | 7.91ms | _set_maximum_violations_per_document | Perl::Critic::Policy::
2880 | 1 | 1 | 2.56ms | 2.56ms | default_maximum_violations_per_document | Perl::Critic::Policy::
586 | 2 | 1 | 1.76ms | 11.8ms | get_short_name | Perl::Critic::Policy::
144 | 2 | 2 | 1.52ms | 2.63ms | get_severity | Perl::Critic::Policy::
445 | 1 | 1 | 1.47ms | 11.2ms | __ANON__[:467] | Perl::Critic::Policy::
1 | 1 | 1 | 1.15ms | 7.57ms | BEGIN@45 | Perl::Critic::Policy::
141 | 1 | 1 | 553µs | 760µs | is_safe | Perl::Critic::Policy::
445 | 1 | 1 | 535µs | 535µs | get_format | Perl::Critic::Policy::
87 | 8 | 7 | 462µs | 882µs | __set_parameter_value | Perl::Critic::Policy::
304 | 3 | 2 | 409µs | 409µs | __get_config | Perl::Critic::Policy::
87 | 1 | 1 | 313µs | 420µs | __get_parameter_name | Perl::Critic::Policy::
1 | 1 | 1 | 286µs | 725µs | BEGIN@33 | Perl::Critic::Policy::
22 | 2 | 1 | 111µs | 139µs | __set_enabled | Perl::Critic::Policy::
19 | 1 | 1 | 78µs | 106µs | initialize_if_enabled | Perl::Critic::Policy::
3 | 1 | 1 | 47µs | 85µs | violation | Perl::Critic::Policy::
1 | 1 | 1 | 17µs | 17µs | BEGIN@10 | Perl::Critic::Policy::
1 | 1 | 1 | 10µs | 20µs | BEGIN@40 | Perl::Critic::Policy::
1 | 1 | 1 | 9µs | 19µs | BEGIN@39 | Perl::Critic::Policy::
1 | 1 | 1 | 9µs | 19µs | BEGIN@38 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 19µs | BEGIN@41 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 19µs | BEGIN@48 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 31µs | BEGIN@34 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 30µs | BEGIN@18 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 25µs | BEGIN@43 | Perl::Critic::Policy::
1 | 1 | 1 | 8µs | 362µs | BEGIN@14 | Perl::Critic::Policy::
1 | 1 | 1 | 7µs | 34µs | BEGIN@20 | Perl::Critic::Policy::
1 | 1 | 1 | 7µs | 26µs | BEGIN@15 | Perl::Critic::Policy::
1 | 1 | 1 | 7µs | 496µs | BEGIN@22 | Perl::Critic::Policy::
1 | 1 | 1 | 6µs | 10µs | BEGIN@12 | Perl::Critic::Policy::
1 | 1 | 1 | 6µs | 17µs | BEGIN@11 | Perl::Critic::Policy::
1 | 1 | 1 | 4µs | 4µs | BEGIN@46 | Perl::Critic::Policy::
1 | 1 | 1 | 3µs | 3µs | BEGIN@17 | Perl::Critic::Policy::
1 | 1 | 1 | 3µs | 3µs | BEGIN@44 | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:466] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:468] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:469] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:470] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:471] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:472] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:473] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:474] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:475] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | __ANON__[:476] | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | _compare | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | _format_lack_of_parameter_metadata | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | _format_parameters | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | add_themes | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | default_severity | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | get_abstract | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | get_long_name | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | get_parameters | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | get_raw_abstract | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | get_themes | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | is_enabled | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | new_parameter_value_exception | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | parameter_metadata_available | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | set_format | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | set_maximum_violations_per_document | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | set_severity | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | set_themes | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | throw_parameter_value_exception | Perl::Critic::Policy::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::
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; | ||||
9 | |||||
10 | 2 | 36µs | 1 | 17µs | # spent 17µs within Perl::Critic::Policy::BEGIN@10 which was called:
# once (17µs+0s) by base::import at line 10 # spent 17µs making 1 call to Perl::Critic::Policy::BEGIN@10 |
11 | 2 | 18µs | 2 | 28µs | # spent 17µs (6+11) within Perl::Critic::Policy::BEGIN@11 which was called:
# once (6µs+11µs) by base::import at line 11 # spent 17µs making 1 call to Perl::Critic::Policy::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 19µs | 2 | 14µs | # spent 10µs (6+4) within Perl::Critic::Policy::BEGIN@12 which was called:
# once (6µs+4µs) by base::import at line 12 # spent 10µs making 1 call to Perl::Critic::Policy::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 22µs | 2 | 716µs | # spent 362µs (8+354) within Perl::Critic::Policy::BEGIN@14 which was called:
# once (8µs+354µs) by base::import at line 14 # spent 362µs making 1 call to Perl::Critic::Policy::BEGIN@14
# spent 354µs making 1 call to English::import |
15 | 2 | 18µs | 2 | 44µs | # spent 26µs (7+19) within Perl::Critic::Policy::BEGIN@15 which was called:
# once (7µs+19µs) by base::import at line 15 # spent 26µs making 1 call to Perl::Critic::Policy::BEGIN@15
# spent 19µs making 1 call to Exporter::import |
16 | |||||
17 | 2 | 18µs | 1 | 3µs | # spent 3µs within Perl::Critic::Policy::BEGIN@17 which was called:
# once (3µs+0s) by base::import at line 17 # spent 3µs making 1 call to Perl::Critic::Policy::BEGIN@17 |
18 | 2 | 24µs | 2 | 52µs | # spent 30µs (8+22) within Perl::Critic::Policy::BEGIN@18 which was called:
# once (8µs+22µs) by base::import at line 18 # spent 30µs making 1 call to Perl::Critic::Policy::BEGIN@18
# spent 22µs making 1 call to Exporter::import |
19 | |||||
20 | 2 | 28µs | 2 | 62µs | # spent 34µs (7+27) within Perl::Critic::Policy::BEGIN@20 which was called:
# once (7µs+27µs) by base::import at line 20 # spent 34µs making 1 call to Perl::Critic::Policy::BEGIN@20
# spent 27µs making 1 call to overload::import |
21 | |||||
22 | 1 | 300ns | # spent 496µs (7+490) within Perl::Critic::Policy::BEGIN@22 which was called:
# once (7µs+490µs) by base::import at line 32 | ||
23 | :characters | ||||
24 | :booleans | ||||
25 | :severities | ||||
26 | :data_conversion | ||||
27 | interpolate | ||||
28 | is_integer | ||||
29 | policy_long_name | ||||
30 | policy_short_name | ||||
31 | severity_to_number | ||||
32 | 1 | 26µs | 2 | 986µs | >; # spent 496µs making 1 call to Perl::Critic::Policy::BEGIN@22
# spent 490µs making 1 call to Exporter::import |
33 | 2 | 90µs | 2 | 774µs | # spent 725µs (286+440) within Perl::Critic::Policy::BEGIN@33 which was called:
# once (286µs+440µs) by base::import at line 33 # spent 725µs making 1 call to Perl::Critic::Policy::BEGIN@33
# spent 49µs making 1 call to Exporter::import |
34 | 1 | 400ns | # spent 31µs (8+23) within Perl::Critic::Policy::BEGIN@34 which was called:
# once (8µs+23µs) by base::import at line 37 | ||
35 | get_module_abstract_for_module | ||||
36 | get_raw_module_abstract_for_module | ||||
37 | 1 | 20µs | 2 | 54µs | >; # spent 31µs making 1 call to Perl::Critic::Policy::BEGIN@34
# spent 23µs making 1 call to Exporter::import |
38 | 2 | 23µs | 2 | 29µs | # spent 19µs (9+10) within Perl::Critic::Policy::BEGIN@38 which was called:
# once (9µs+10µs) by base::import at line 38 # spent 19µs making 1 call to Perl::Critic::Policy::BEGIN@38
# spent 10µs making 1 call to Exporter::import |
39 | 2 | 19µs | 2 | 29µs | # spent 19µs (9+10) within Perl::Critic::Policy::BEGIN@39 which was called:
# once (9µs+10µs) by base::import at line 39 # spent 19µs making 1 call to Perl::Critic::Policy::BEGIN@39
# spent 10µs making 1 call to Exporter::import |
40 | 2 | 19µs | 2 | 31µs | # spent 20µs (10+11) within Perl::Critic::Policy::BEGIN@40 which was called:
# once (10µs+11µs) by base::import at line 40 # spent 20µs making 1 call to Perl::Critic::Policy::BEGIN@40
# spent 11µs making 1 call to Exporter::import |
41 | 2 | 21µs | 2 | 30µs | # spent 19µs (8+11) within Perl::Critic::Policy::BEGIN@41 which was called:
# once (8µs+11µs) by base::import at line 41 # spent 19µs making 1 call to Perl::Critic::Policy::BEGIN@41
# spent 10µs making 1 call to Exporter::import |
42 | use Perl::Critic::Exception::Fatal::PolicyDefinition | ||||
43 | 2 | 20µs | 2 | 42µs | # spent 25µs (8+17) within Perl::Critic::Policy::BEGIN@43 which was called:
# once (8µs+17µs) by base::import at line 43 # spent 25µs making 1 call to Perl::Critic::Policy::BEGIN@43
# spent 17µs making 1 call to Exporter::import |
44 | 2 | 16µs | 1 | 3µs | # spent 3µs within Perl::Critic::Policy::BEGIN@44 which was called:
# once (3µs+0s) by base::import at line 44 # spent 3µs making 1 call to Perl::Critic::Policy::BEGIN@44 |
45 | 2 | 86µs | 1 | 7.57ms | # spent 7.57ms (1.15+6.42) within Perl::Critic::Policy::BEGIN@45 which was called:
# once (1.15ms+6.42ms) by base::import at line 45 # spent 7.57ms making 1 call to Perl::Critic::Policy::BEGIN@45 |
46 | 2 | 18µs | 1 | 4µs | # spent 4µs within Perl::Critic::Policy::BEGIN@46 which was called:
# once (4µs+0s) by base::import at line 46 # spent 4µs making 1 call to Perl::Critic::Policy::BEGIN@46 |
47 | |||||
48 | 2 | 1.44ms | 2 | 29µs | # spent 19µs (8+10) within Perl::Critic::Policy::BEGIN@48 which was called:
# once (8µs+10µs) by base::import at line 48 # spent 19µs making 1 call to Perl::Critic::Policy::BEGIN@48
# spent 10µs making 1 call to Exception::Class::import |
49 | |||||
50 | 1 | 600ns | our $VERSION = '1.121'; | ||
51 | |||||
52 | #----------------------------------------------------------------------------- | ||||
53 | |||||
54 | 1 | 2µs | 1 | 32µs | Readonly::Scalar my $NO_LIMIT => 'no_limit'; # spent 32µs making 1 call to Readonly::Scalar |
55 | |||||
56 | #----------------------------------------------------------------------------- | ||||
57 | |||||
58 | 1 | 300ns | my $format = "%p\n"; #Default stringy format | ||
59 | |||||
60 | #----------------------------------------------------------------------------- | ||||
61 | |||||
62 | # spent 227ms (17.6+209) within Perl::Critic::Policy::new which was called 141 times, avg 1.61ms/call:
# 141 times (17.6ms+209ms) by Perl::Critic::PolicyFactory::_instantiate_policy at line 260 of Perl/Critic/PolicyFactory.pm, avg 1.61ms/call | ||||
63 | 141 | 88µs | my ($class, %config) = @_; | ||
64 | |||||
65 | 141 | 162µs | my $self = bless {}, $class; | ||
66 | |||||
67 | 141 | 14µs | my $config_object; | ||
68 | 141 | 65µs | if ($config{_config_object}) { | ||
69 | $config_object = $config{_config_object}; | ||||
70 | } | ||||
71 | else { | ||||
72 | 141 | 561µs | 282 | 4.32ms | $config_object = # spent 2.21ms making 141 calls to Perl::Critic::PolicyConfig::new, avg 16µs/call
# spent 2.10ms making 141 calls to Perl::Critic::Policy::get_short_name, avg 15µs/call |
73 | Perl::Critic::PolicyConfig->new( | ||||
74 | $self->get_short_name(), | ||||
75 | \%config, | ||||
76 | ); | ||||
77 | } | ||||
78 | |||||
79 | 141 | 396µs | 141 | 5.19ms | $self->__set_config( $config_object ); # spent 5.19ms making 141 calls to Perl::Critic::Policy::__set_config, avg 37µs/call |
80 | |||||
81 | 141 | 16µs | my @parameters; | ||
82 | 141 | 37µs | my $parameter_metadata_available = 0; | ||
83 | |||||
84 | 141 | 967µs | 141 | 293µs | if ( $class->can('supported_parameters') ) { # spent 293µs making 141 calls to UNIVERSAL::can, avg 2µs/call |
85 | 141 | 16µs | $parameter_metadata_available = 1; | ||
86 | 97 | 132µs | 97 | 4.70ms | @parameters = # spent 4.70ms making 97 calls to Perl::Critic::PolicyParameter::new, avg 48µs/call |
87 | map | ||||
88 | 141 | 419µs | 141 | 1.28ms | { Perl::Critic::PolicyParameter->new($_) } # spent 154µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters::supported_parameters
# spent 103µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::supported_parameters
# spent 78µs making 1 call to Perl::Critic::Policy::NamingConventions::Capitalization::supported_parameters
# spent 76µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodSections::supported_parameters
# spent 67µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls::supported_parameters
# spent 49µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::supported_parameters
# spent 29µs making 1 call to Perl::Critic::Policy::Documentation::PodSpelling::supported_parameters
# spent 26µs making 1 call to Perl::Critic::Policy::Modules::ProhibitEvilModules::supported_parameters
# spent 25µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::supported_parameters
# spent 25µs making 1 call to Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::supported_parameters
# spent 22µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals::supported_parameters
# spent 22µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPunctuationVars::supported_parameters
# spent 19µs making 1 call to Perl::Critic::Policy::Subroutines::RequireArgUnpacking::supported_parameters
# spent 19µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitComplexVersion::supported_parameters
# spent 19µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings::supported_parameters
# spent 18µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion::supported_parameters
# spent 18µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars::supported_parameters
# spent 18µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::Subroutines::RequireFinalReturn::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPackageVars::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames::supported_parameters
# spent 16µs making 1 call to Perl::Critic::Policy::Variables::RequireLocalizedPunctuationVars::supported_parameters
# spent 15µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings::supported_parameters
# spent 15µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers::supported_parameters
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedClose::supported_parameters
# spent 9µs making 1 call to Perl::Critic::Policy::ErrorHandling::RequireCarping::supported_parameters
# spent 8µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodLinksIncludeText::supported_parameters
# spent 8µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::supported_parameters
# spent 8µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitHardTabs::supported_parameters
# spent 8µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists::supported_parameters
# spent 7µs making 1 call to Perl::Critic::Policy::Modules::RequireExplicitPackage::supported_parameters
# spent 6µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::supported_parameters
# spent 6µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest::supported_parameters
# spent 6µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes::supported_parameters
# spent 6µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::supported_parameters
# spent 6µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitLongChainsOfMethodCalls::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBriefOpen::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitDeepNests::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::Variables::ProhibitReusedNames::supported_parameters
# spent 5µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireTidyCode::supported_parameters
# spent 4µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::supported_parameters
# spent 4µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitManyArgs::supported_parameters
# spent 3µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils::supported_parameters
# spent 3µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines::supported_parameters
# spent 3µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::RequireEndWithOne::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitReturnSort::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitFormats::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::RequireBarewordIncludes::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitLocalVars::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitUnusedVariables::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::ProhibitAutomaticExportation::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedOpen::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUnrestrictedNoCritic::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitNestedSubs::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPerl4PackageNames::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::RequireInitializationForLocalVars::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireTrailingCommas::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Modules::RequireVersionVar::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::References::ProhibitDoubleSigils::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::supported_parameters
# spent 2µs making 1 call to Perl::Critic::Policy::Variables::ProtectPrivateVars::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitTies::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::Modules::ProhibitMultiplePackages::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::Variables::RequireNegativeIndices::supported_parameters
# spent 1µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks::supported_parameters |
89 | $class->supported_parameters(); | ||||
90 | } | ||||
91 | 141 | 67µs | $self->{_parameter_metadata_available} = $parameter_metadata_available; | ||
92 | 141 | 48µs | $self->{_parameters} = \@parameters; | ||
93 | |||||
94 | 141 | 242µs | 141 | 87.0ms | my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); # spent 87.0ms making 141 calls to Perl::Critic::Exception::AggregateConfiguration::new, avg 617µs/call |
95 | 141 | 83µs | foreach my $parameter ( @parameters ) { | ||
96 | eval { | ||||
97 | 97 | 140µs | 97 | 3.94ms | $parameter->parse_and_validate_config_value( $self, $config_object ); # spent 3.94ms making 97 calls to Perl::Critic::PolicyParameter::parse_and_validate_config_value, avg 41µs/call |
98 | } | ||||
99 | 97 | 37µs | or do { | ||
100 | 97 | 107µs | 97 | 119µs | $errors->add_exception_or_rethrow($EVAL_ERROR); # spent 119µs making 97 calls to Perl::Critic::Exception::AggregateConfiguration::add_exception_or_rethrow, avg 1µs/call |
101 | }; | ||||
102 | |||||
103 | 97 | 239µs | 194 | 745µs | $config_object->remove( $parameter->get_name() ); # spent 614µs making 97 calls to Perl::Critic::PolicyConfig::remove, avg 6µs/call
# spent 132µs making 97 calls to Perl::Critic::PolicyParameter::get_name, avg 1µs/call |
104 | } | ||||
105 | |||||
106 | 141 | 203µs | 141 | 101ms | if ($parameter_metadata_available) { # spent 101ms making 141 calls to Perl::Critic::PolicyConfig::handle_extra_parameters, avg 716µs/call |
107 | $config_object->handle_extra_parameters( $self, $errors ); | ||||
108 | } | ||||
109 | |||||
110 | 141 | 180µs | 141 | 680µs | if ( $errors->has_exceptions() ) { # spent 680µs making 141 calls to Perl::Critic::Exception::AggregateConfiguration::has_exceptions, avg 5µs/call |
111 | $errors->rethrow(); | ||||
112 | } | ||||
113 | |||||
114 | 141 | 4.86ms | return $self; | ||
115 | } | ||||
116 | |||||
117 | #----------------------------------------------------------------------------- | ||||
118 | |||||
119 | # spent 760µs (553+207) within Perl::Critic::Policy::is_safe which was called 141 times, avg 5µs/call:
# 141 times (553µs+207µs) by Perl::Critic::Config::_load_policies at line 234 of Perl/Critic/Config.pm, avg 5µs/call | ||||
120 | 141 | 234µs | return $TRUE; | ||
121 | } | ||||
122 | |||||
123 | #----------------------------------------------------------------------------- | ||||
124 | |||||
125 | # spent 106µs (78+28) within Perl::Critic::Policy::initialize_if_enabled which was called 19 times, avg 6µs/call:
# 19 times (78µs+28µs) by Perl::Critic::Config::_add_policy_if_enabled at line 202 of Perl/Critic/Config.pm, avg 6µs/call | ||||
126 | 19 | 31µs | return $TRUE; | ||
127 | } | ||||
128 | |||||
129 | #----------------------------------------------------------------------------- | ||||
130 | |||||
131 | # spent 16.4ms (12.2+4.22) within Perl::Critic::Policy::prepare_to_scan_document which was called 2736 times, avg 6µs/call:
# 2736 times (12.2ms+4.22ms) by Perl::Critic::_critique at line 157 of Perl/Critic.pm, avg 6µs/call | ||||
132 | 2736 | 5.45ms | return $TRUE; | ||
133 | } | ||||
134 | |||||
135 | #----------------------------------------------------------------------------- | ||||
136 | |||||
137 | # spent 420µs (313+106) within Perl::Critic::Policy::__get_parameter_name which was called 87 times, avg 5µs/call:
# 87 times (313µs+106µs) by Perl::Critic::Policy::__set_parameter_value at line 148, avg 5µs/call | ||||
138 | 87 | 17µs | my ( $self, $parameter ) = @_; | ||
139 | |||||
140 | 87 | 248µs | 87 | 106µs | return '_' . $parameter->get_name(); # spent 106µs making 87 calls to Perl::Critic::PolicyParameter::get_name, avg 1µs/call |
141 | } | ||||
142 | |||||
143 | #----------------------------------------------------------------------------- | ||||
144 | |||||
145 | # spent 882µs (462+420) within Perl::Critic::Policy::__set_parameter_value which was called 87 times, avg 10µs/call:
# 32 times (153µs+147µs) by Perl::Critic::PolicyParameter::Behavior::StringList::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/StringList.pm:60] at line 57 of Perl/Critic/PolicyParameter/Behavior/StringList.pm, avg 9µs/call
# 20 times (122µs+99µs) by Perl::Critic::PolicyParameter::Behavior::Boolean::_parse at line 37 of Perl/Critic/PolicyParameter/Behavior/Boolean.pm, avg 11µs/call
# 14 times (86µs+72µs) by Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Integer.pm:82] at line 80 of Perl/Critic/PolicyParameter/Behavior/Integer.pm, avg 11µs/call
# 11 times (51µs+57µs) by Perl::Critic::PolicyParameter::Behavior::String::_parse at line 31 of Perl/Critic/PolicyParameter/Behavior/String.pm, avg 10µs/call
# 5 times (24µs+22µs) by Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:93] at line 90 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 9µs/call
# 3 times (14µs+13µs) by Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:127] at line 124 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 9µs/call
# once (6µs+5µs) by Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::_parse_private_name_regex at line 75 of Perl/Critic/Policy/Subroutines/ProhibitUnusedPrivateSubroutines.pm
# once (6µs+5µs) by Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::_parse_private_name_regex at line 114 of Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm | ||||
146 | 87 | 25µs | my ( $self, $parameter, $value ) = @_; | ||
147 | |||||
148 | 87 | 252µs | 87 | 420µs | $self->{ $self->__get_parameter_name($parameter) } = $value; # spent 420µs making 87 calls to Perl::Critic::Policy::__get_parameter_name, avg 5µs/call |
149 | |||||
150 | 87 | 175µs | return; | ||
151 | } | ||||
152 | |||||
153 | #----------------------------------------------------------------------------- | ||||
154 | |||||
155 | # spent 102ms (10.8+91.6) within Perl::Critic::Policy::__set_base_parameters which was called 141 times, avg 726µs/call:
# 141 times (10.8ms+91.6ms) by Perl::Critic::PolicyFactory::_instantiate_policy at line 269 of Perl/Critic/PolicyFactory.pm, avg 726µs/call | ||||
156 | 141 | 28µs | my ($self) = @_; | ||
157 | |||||
158 | 141 | 342µs | 141 | 194µs | my $config = $self->__get_config(); # spent 194µs making 141 calls to Perl::Critic::Policy::__get_config, avg 1µs/call |
159 | 141 | 228µs | 141 | 79.6ms | my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); # spent 79.6ms making 141 calls to Perl::Critic::Exception::AggregateConfiguration::new, avg 565µs/call |
160 | |||||
161 | 141 | 580µs | 141 | 7.91ms | $self->_set_maximum_violations_per_document($errors); # spent 7.91ms making 141 calls to Perl::Critic::Policy::_set_maximum_violations_per_document, avg 56µs/call |
162 | |||||
163 | 141 | 187µs | 141 | 1.12ms | my $user_severity = $config->get_severity(); # spent 1.12ms making 141 calls to Perl::Critic::PolicyConfig::get_severity, avg 8µs/call |
164 | 141 | 15µs | if ( defined $user_severity ) { | ||
165 | my $normalized_severity = severity_to_number( $user_severity ); | ||||
166 | $self->set_severity( $normalized_severity ); | ||||
167 | } | ||||
168 | |||||
169 | 141 | 178µs | 141 | 1.07ms | my $user_set_themes = $config->get_set_themes(); # spent 1.07ms making 141 calls to Perl::Critic::PolicyConfig::get_set_themes, avg 8µs/call |
170 | 141 | 14µs | if ( defined $user_set_themes ) { | ||
171 | my @set_themes = words_from_string( $user_set_themes ); | ||||
172 | $self->set_themes( @set_themes ); | ||||
173 | } | ||||
174 | |||||
175 | 141 | 174µs | 141 | 1.03ms | my $user_add_themes = $config->get_add_themes(); # spent 1.03ms making 141 calls to Perl::Critic::PolicyConfig::get_add_themes, avg 7µs/call |
176 | 141 | 15µs | if ( defined $user_add_themes ) { | ||
177 | my @add_themes = words_from_string( $user_add_themes ); | ||||
178 | $self->add_themes( @add_themes ); | ||||
179 | } | ||||
180 | |||||
181 | 141 | 156µs | 141 | 640µs | if ( $errors->has_exceptions() ) { # spent 640µs making 141 calls to Perl::Critic::Exception::AggregateConfiguration::has_exceptions, avg 5µs/call |
182 | $errors->rethrow(); | ||||
183 | } | ||||
184 | |||||
185 | 141 | 4.85ms | return; | ||
186 | } | ||||
187 | |||||
188 | #----------------------------------------------------------------------------- | ||||
189 | |||||
190 | # spent 7.91ms (5.32+2.59) within Perl::Critic::Policy::_set_maximum_violations_per_document which was called 141 times, avg 56µs/call:
# 141 times (5.32ms+2.59ms) by Perl::Critic::Policy::__set_base_parameters at line 161, avg 56µs/call | ||||
191 | 141 | 30µs | my ($self, $errors) = @_; | ||
192 | |||||
193 | 141 | 139µs | 141 | 180µs | my $config = $self->__get_config(); # spent 180µs making 141 calls to Perl::Critic::Policy::__get_config, avg 1µs/call |
194 | |||||
195 | 141 | 694µs | 282 | 2.60ms | if ( $config->is_maximum_violations_per_document_unlimited() ) { # spent 2.40ms making 141 calls to Perl::Critic::PolicyConfig::is_maximum_violations_per_document_unlimited, avg 17µs/call
# spent 198µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
196 | return; | ||||
197 | } | ||||
198 | |||||
199 | my $user_maximum_violations = | ||||
200 | $config->get_maximum_violations_per_document(); | ||||
201 | |||||
202 | if ( not is_integer($user_maximum_violations) ) { | ||||
203 | $errors->add_exception( | ||||
204 | new_parameter_value_exception( | ||||
205 | 'maximum_violations_per_document', | ||||
206 | $user_maximum_violations, | ||||
207 | undef, | ||||
208 | "does not look like an integer.\n" | ||||
209 | ) | ||||
210 | ); | ||||
211 | |||||
212 | return; | ||||
213 | } | ||||
214 | elsif ( $user_maximum_violations < 0 ) { | ||||
215 | $errors->add_exception( | ||||
216 | new_parameter_value_exception( | ||||
217 | 'maximum_violations_per_document', | ||||
218 | $user_maximum_violations, | ||||
219 | undef, | ||||
220 | "is not greater than or equal to zero.\n" | ||||
221 | ) | ||||
222 | ); | ||||
223 | |||||
224 | return; | ||||
225 | } | ||||
226 | |||||
227 | $self->set_maximum_violations_per_document( | ||||
228 | $user_maximum_violations | ||||
229 | ); | ||||
230 | |||||
231 | return; | ||||
232 | } | ||||
233 | |||||
234 | #----------------------------------------------------------------------------- | ||||
235 | |||||
236 | # Unparsed configuration, P::C::PolicyConfig. Compare with get_parameters(). | ||||
237 | # spent 409µs within Perl::Critic::Policy::__get_config which was called 304 times, avg 1µs/call:
# 141 times (194µs+0s) by Perl::Critic::Policy::__set_base_parameters at line 158, avg 1µs/call
# 141 times (180µs+0s) by Perl::Critic::Policy::_set_maximum_violations_per_document at line 193, avg 1µs/call
# 22 times (34µs+0s) by Perl::Critic::Config::_add_policy_if_enabled at line 196 of Perl/Critic/Config.pm, avg 2µs/call | ||||
238 | 304 | 36µs | my ($self) = @_; | ||
239 | |||||
240 | 304 | 5.15ms | return $self->{_config}; | ||
241 | } | ||||
242 | |||||
243 | # spent 5.64ms within Perl::Critic::Policy::__set_config which was called 282 times, avg 20µs/call:
# 141 times (5.19ms+0s) by Perl::Critic::Policy::new at line 79, avg 37µs/call
# 141 times (447µs+0s) by Perl::Critic::PolicyFactory::_instantiate_policy at line 267 of Perl/Critic/PolicyFactory.pm, avg 3µs/call | ||||
244 | 282 | 71µs | my ($self, $config) = @_; | ||
245 | |||||
246 | 282 | 5.23ms | $self->{_config} = $config; | ||
247 | |||||
248 | 282 | 540µs | return; | ||
249 | } | ||||
250 | |||||
251 | #----------------------------------------------------------------------------- | ||||
252 | |||||
253 | sub get_long_name { | ||||
254 | my ($self) = @_; | ||||
255 | |||||
256 | return policy_long_name(ref $self); | ||||
257 | } | ||||
258 | |||||
259 | #----------------------------------------------------------------------------- | ||||
260 | |||||
261 | # spent 11.8ms (1.76+10.1) within Perl::Critic::Policy::get_short_name which was called 586 times, avg 20µs/call:
# 445 times (1.34ms+8.39ms) by Perl::Critic::Policy::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy.pm:467] at line 467, avg 22µs/call
# 141 times (421µs+1.68ms) by Perl::Critic::Policy::new at line 72, avg 15µs/call | ||||
262 | 586 | 111µs | my ($self) = @_; | ||
263 | |||||
264 | 586 | 1.63ms | 586 | 10.1ms | return policy_short_name(ref $self); # spent 10.1ms making 586 calls to Perl::Critic::Utils::policy_short_name, avg 17µs/call |
265 | } | ||||
266 | |||||
267 | #----------------------------------------------------------------------------- | ||||
268 | |||||
269 | sub is_enabled { | ||||
270 | my ($self) = @_; | ||||
271 | |||||
272 | return $self->{_enabled}; | ||||
273 | } | ||||
274 | |||||
275 | #----------------------------------------------------------------------------- | ||||
276 | |||||
277 | # spent 139µs (111+28) within Perl::Critic::Policy::__set_enabled which was called 22 times, avg 6µs/call:
# 21 times (106µs+27µs) by Perl::Critic::Config::_add_policy_if_enabled at line 203 of Perl/Critic/Config.pm, avg 6µs/call
# once (5µs+1µs) by Perl::Critic::Config::_add_policy_if_enabled at line 207 of Perl/Critic/Config.pm | ||||
278 | 22 | 39µs | 22 | 28µs | my ($self, $new_value) = @_; # spent 28µs making 22 calls to Readonly::Scalar::FETCH, avg 1µs/call |
279 | |||||
280 | 22 | 13µs | $self->{_enabled} = $new_value; | ||
281 | |||||
282 | 22 | 42µs | return; | ||
283 | } | ||||
284 | |||||
285 | #----------------------------------------------------------------------------- | ||||
286 | |||||
287 | sub applies_to { | ||||
288 | return qw(PPI::Element); | ||||
289 | } | ||||
290 | |||||
291 | #----------------------------------------------------------------------------- | ||||
292 | |||||
293 | sub set_maximum_violations_per_document { | ||||
294 | my ($self, $maximum_violations_per_document) = @_; | ||||
295 | |||||
296 | $self->{_maximum_violations_per_document} = | ||||
297 | $maximum_violations_per_document; | ||||
298 | |||||
299 | return $self; | ||||
300 | } | ||||
301 | |||||
302 | #----------------------------------------------------------------------------- | ||||
303 | |||||
304 | # spent 20.7ms (17.8+2.84) within Perl::Critic::Policy::get_maximum_violations_per_document which was called 3024 times, avg 7µs/call:
# 3024 times (17.8ms+2.84ms) by Perl::Critic::_critique at line 159 of Perl/Critic.pm, avg 7µs/call | ||||
305 | 3024 | 667µs | my ($self) = @_; | ||
306 | |||||
307 | return | ||||
308 | 3024 | 13.1ms | 3024 | 2.84ms | exists $self->{_maximum_violations_per_document} # spent 2.56ms making 2880 calls to Perl::Critic::Policy::default_maximum_violations_per_document, avg 888ns/call
# spent 279µs making 144 calls to Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict::default_maximum_violations_per_document, avg 2µs/call |
309 | ? $self->{_maximum_violations_per_document} | ||||
310 | : $self->default_maximum_violations_per_document(); | ||||
311 | } | ||||
312 | |||||
313 | #----------------------------------------------------------------------------- | ||||
314 | |||||
315 | # spent 2.56ms within Perl::Critic::Policy::default_maximum_violations_per_document which was called 2880 times, avg 888ns/call:
# 2880 times (2.56ms+0s) by Perl::Critic::Policy::get_maximum_violations_per_document at line 308, avg 888ns/call | ||||
316 | 2880 | 7.60ms | return; | ||
317 | } | ||||
318 | |||||
319 | #----------------------------------------------------------------------------- | ||||
320 | |||||
321 | sub set_severity { | ||||
322 | my ($self, $severity) = @_; | ||||
323 | $self->{_severity} = $severity; | ||||
324 | return $self; | ||||
325 | } | ||||
326 | |||||
327 | #----------------------------------------------------------------------------- | ||||
328 | |||||
329 | # spent 2.63ms (1.52+1.11) within Perl::Critic::Policy::get_severity which was called 144 times, avg 18µs/call:
# 141 times (1.51ms+1.09ms) by Perl::Critic::Config::_policy_is_unimportant at line 288 of Perl/Critic/Config.pm, avg 18µs/call
# 3 times (13µs+17µs) by Perl::Critic::Policy::violation at line 419, avg 10µs/call | ||||
330 | 144 | 18µs | my ($self) = @_; | ||
331 | 144 | 1.84ms | 288 | 1.30ms | return $self->{_severity} || $self->default_severity(); # spent 191µs making 144 calls to Readonly::Scalar::FETCH, avg 1µs/call
# spent 24µs making 4 calls to Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef::default_severity, avg 6µs/call
# spent 19µs making 1 call to Perl::Critic::Policy::Variables::ProhibitUnusedVariables::default_severity
# spent 17µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa::default_severity
# spent 12µs making 1 call to Perl::Critic::Policy::ErrorHandling::RequireCarping::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::Subroutines::RequireArgUnpacking::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodLinksIncludeText::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest::default_severity
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline::default_severity
# spent 10µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators::default_severity
# spent 10µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodSections::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedOpen::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitTies::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitUnrestrictedNoCritic::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireCheckedClose::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Modules::ProhibitMultiplePackages::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBriefOpen::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Miscellanea::ProhibitFormats::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Modules::ProhibitAutomaticExportation::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Modules::ProhibitEvilModules::default_severity
# spent 9µs making 1 call to Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::Modules::RequireBarewordIncludes::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::Documentation::PodSpelling::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::Modules::RequireExplicitPackage::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros::default_severity
# spent 8µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireTrailingCommas::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::RequireFinalReturn::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitLongChainsOfMethodCalls::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitDeepNests::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Modules::RequireEndWithOne::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitLocalVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPackageVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::RequireInitializationForLocalVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitHardTabs::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireTidyCode::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitComplexVersion::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitReusedNames::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProtectPrivateVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::RequireLocalizedPunctuationVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPerl4PackageNames::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Modules::RequireVersionVar::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::NamingConventions::Capitalization::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::References::ProhibitDoubleSigils::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitManyArgs::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitReturnSort::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitNestedSubs::default_severity
# spent 7µs making 1 call to Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::default_severity
# spent 6µs making 1 call to Perl::Critic::Policy::Variables::ProhibitPunctuationVars::default_severity
# spent 6µs making 1 call to Perl::Critic::Policy::Variables::RequireNegativeIndices::default_severity |
332 | } | ||||
333 | |||||
334 | #----------------------------------------------------------------------------- | ||||
335 | |||||
336 | sub default_severity { | ||||
337 | return $SEVERITY_LOWEST; | ||||
338 | } | ||||
339 | |||||
340 | #----------------------------------------------------------------------------- | ||||
341 | |||||
342 | sub set_themes { | ||||
343 | my ($self, @themes) = @_; | ||||
344 | $self->{_themes} = [ sort @themes ]; | ||||
345 | return $self; | ||||
346 | } | ||||
347 | |||||
348 | #----------------------------------------------------------------------------- | ||||
349 | |||||
350 | sub get_themes { | ||||
351 | my ($self) = @_; | ||||
352 | my @themes = defined $self->{_themes} ? @{ $self->{_themes} } : $self->default_themes(); | ||||
353 | my @sorted_themes = sort @themes; | ||||
354 | return @sorted_themes; | ||||
355 | } | ||||
356 | |||||
357 | #----------------------------------------------------------------------------- | ||||
358 | |||||
359 | sub add_themes { | ||||
360 | my ($self, @additional_themes) = @_; | ||||
361 | #By hashifying the themes, we squish duplicates | ||||
362 | my %merged = hashify( $self->get_themes(), @additional_themes); | ||||
363 | $self->{_themes} = [ keys %merged]; | ||||
364 | return $self; | ||||
365 | } | ||||
366 | |||||
367 | #----------------------------------------------------------------------------- | ||||
368 | |||||
369 | sub default_themes { | ||||
370 | return (); | ||||
371 | } | ||||
372 | |||||
373 | #----------------------------------------------------------------------------- | ||||
374 | |||||
375 | sub get_abstract { | ||||
376 | my ($self) = @_; | ||||
377 | |||||
378 | return get_module_abstract_for_module( ref $self ); | ||||
379 | } | ||||
380 | |||||
381 | #----------------------------------------------------------------------------- | ||||
382 | |||||
383 | sub get_raw_abstract { | ||||
384 | my ($self) = @_; | ||||
385 | |||||
386 | return get_raw_module_abstract_for_module( ref $self ); | ||||
387 | } | ||||
388 | |||||
389 | #----------------------------------------------------------------------------- | ||||
390 | |||||
391 | sub parameter_metadata_available { | ||||
392 | my ($self) = @_; | ||||
393 | |||||
394 | return $self->{_parameter_metadata_available}; | ||||
395 | } | ||||
396 | |||||
397 | #----------------------------------------------------------------------------- | ||||
398 | |||||
399 | sub get_parameters { | ||||
400 | my ($self) = @_; | ||||
401 | |||||
402 | return $self->{_parameters}; | ||||
403 | } | ||||
404 | |||||
405 | #----------------------------------------------------------------------------- | ||||
406 | |||||
407 | sub violates { | ||||
408 | my ($self) = @_; | ||||
409 | |||||
410 | return throw_policy_definition | ||||
411 | $self->get_short_name() . q/ does not implement violates()./; | ||||
412 | } | ||||
413 | |||||
414 | #----------------------------------------------------------------------------- | ||||
415 | |||||
416 | # spent 85µs (47+38) within Perl::Critic::Policy::violation which was called 3 times, avg 28µs/call:
# 3 times (47µs+38µs) by Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef::violates at line 45 of Perl/Critic/Policy/Subroutines/ProhibitExplicitReturnUndef.pm, avg 28µs/call | ||||
417 | 3 | 13µs | 6 | 7µs | my ( $self, $desc, $expl, $elem ) = @_; # spent 7µs making 6 calls to Readonly::Scalar::FETCH, avg 1µs/call |
418 | # HACK!! Use goto instead of an explicit call because P::C::V::new() uses caller() | ||||
419 | 3 | 6µs | 3 | 30µs | my $sev = $self->get_severity(); # spent 30µs making 3 calls to Perl::Critic::Policy::get_severity, avg 10µs/call |
420 | 3 | 7µs | @_ = ('Perl::Critic::Violation', $desc, $expl, $elem, $sev ); | ||
421 | 3 | 14µs | 3 | 817µs | goto &Perl::Critic::Violation::new; # spent 817µs making 3 calls to Perl::Critic::Violation::new, avg 272µs/call |
422 | } | ||||
423 | |||||
424 | #----------------------------------------------------------------------------- | ||||
425 | |||||
426 | sub new_parameter_value_exception { | ||||
427 | my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_; | ||||
428 | |||||
429 | return Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue->new( | ||||
430 | policy => $self->get_short_name(), | ||||
431 | option_name => $option_name, | ||||
432 | option_value => $option_value, | ||||
433 | source => $source, | ||||
434 | message_suffix => $message_suffix | ||||
435 | ); | ||||
436 | } | ||||
437 | |||||
438 | #----------------------------------------------------------------------------- | ||||
439 | |||||
440 | ## no critic (Subroutines::RequireFinalReturn) | ||||
441 | sub throw_parameter_value_exception { | ||||
442 | my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_; | ||||
443 | |||||
444 | $self->new_parameter_value_exception( | ||||
445 | $option_name, $option_value, $source, $message_suffix | ||||
446 | ) | ||||
447 | ->throw(); | ||||
448 | } | ||||
449 | ## use critic | ||||
450 | |||||
451 | |||||
452 | #----------------------------------------------------------------------------- | ||||
453 | |||||
454 | # Static methods. | ||||
455 | |||||
456 | sub set_format { return $format = $_[0] } ## no critic(ArgUnpacking) | ||||
457 | 445 | 995µs | # spent 535µs within Perl::Critic::Policy::get_format which was called 445 times, avg 1µs/call:
# 445 times (535µs+0s) by Perl::Critic::Policy::to_string at line 478, avg 1µs/call | ||
458 | |||||
459 | #----------------------------------------------------------------------------- | ||||
460 | |||||
461 | # spent 40.6ms (10.2+30.4) within Perl::Critic::Policy::to_string which was called 445 times, avg 91µs/call:
# 141 times (3.21ms+13.2ms) by Perl::Critic::PolicyFactory::create_all_policies at line 224 of Perl/Critic/PolicyFactory.pm, avg 117µs/call
# 141 times (3.33ms+8.07ms) by Perl::Critic::PolicyFactory::_handle_policy_instantiation_exception at line 280 of Perl/Critic/PolicyFactory.pm, avg 81µs/call
# 141 times (3.15ms+7.84ms) by Perl::Critic::Theme::policy_is_thematic at line 86 of Perl/Critic/Theme.pm, avg 78µs/call
# 22 times (488µs+1.23ms) by Perl::Critic::Config::add_policy at line 168 of Perl/Critic/Config.pm, avg 78µs/call | ||||
462 | 445 | 295µs | my ($self, @args) = @_; | ||
463 | |||||
464 | # Wrap the more expensive ones in sub{} to postpone evaluation | ||||
465 | my %fspec = ( | ||||
466 | 'P' => sub { $self->get_long_name() }, | ||||
467 | 445 | 4.20ms | 445 | 9.72ms | # spent 11.2ms (1.47+9.72) within Perl::Critic::Policy::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy.pm:467] which was called 445 times, avg 25µs/call:
# 445 times (1.47ms+9.72ms) by String::Format::_replace at line 43 of String/Format.pm, avg 25µs/call # spent 9.72ms making 445 calls to Perl::Critic::Policy::get_short_name, avg 22µs/call |
468 | 'a' => sub { dor($self->get_abstract(), $EMPTY) }, | ||||
469 | 'O' => sub { $self->_format_parameters(@_) }, | ||||
470 | 'U' => sub { $self->_format_lack_of_parameter_metadata(@_) }, | ||||
471 | 'S' => sub { $self->default_severity() }, | ||||
472 | 's' => sub { $self->get_severity() }, | ||||
473 | 'T' => sub { join $SPACE, $self->default_themes() }, | ||||
474 | 't' => sub { join $SPACE, $self->get_themes() }, | ||||
475 | 'V' => sub { dor( $self->default_maximum_violations_per_document(), $NO_LIMIT ) }, | ||||
476 | 'v' => sub { dor( $self->get_maximum_violations_per_document(), $NO_LIMIT ) }, | ||||
477 | 445 | 3.79ms | ); | ||
478 | 445 | 5.51ms | 890 | 30.4ms | return stringf(get_format(), %fspec); # spent 29.9ms making 445 calls to String::Format::stringf, avg 67µs/call
# spent 535µs making 445 calls to Perl::Critic::Policy::get_format, avg 1µs/call |
479 | } | ||||
480 | |||||
481 | sub _format_parameters { | ||||
482 | my ($self, $parameter_format) = @_; | ||||
483 | |||||
484 | return $EMPTY if not $self->parameter_metadata_available(); | ||||
485 | |||||
486 | my $separator; | ||||
487 | if ($parameter_format) { | ||||
488 | $separator = $EMPTY; | ||||
489 | } else { | ||||
490 | $separator = $SPACE; | ||||
491 | $parameter_format = '%n'; | ||||
492 | } | ||||
493 | |||||
494 | return | ||||
495 | join | ||||
496 | $separator, | ||||
497 | map { $_->to_formatted_string($parameter_format) } @{ $self->get_parameters() }; | ||||
498 | } | ||||
499 | |||||
500 | sub _format_lack_of_parameter_metadata { | ||||
501 | my ($self, $message) = @_; | ||||
502 | |||||
503 | return $EMPTY if $self->parameter_metadata_available(); | ||||
504 | return interpolate($message) if $message; | ||||
505 | |||||
506 | return | ||||
507 | 'Cannot programmatically discover what parameters this policy takes.'; | ||||
508 | } | ||||
509 | |||||
510 | #----------------------------------------------------------------------------- | ||||
511 | # Apparently, some perls do not implicitly stringify overloading | ||||
512 | # objects before doing a comparison. This causes a couple of our | ||||
513 | # sorting tests to fail. To work around this, we overload C<cmp> to | ||||
514 | # do it explicitly. | ||||
515 | # | ||||
516 | # 20060503 - More information: This problem has been traced to | ||||
517 | # Test::Simple versions <= 0.60, not perl itself. Upgrading to | ||||
518 | # Test::Simple v0.62 will fix the problem. But rather than forcing | ||||
519 | # everyone to upgrade, I have decided to leave this workaround in | ||||
520 | # place. | ||||
521 | |||||
522 | sub _compare { return "$_[0]" cmp "$_[1]" } | ||||
523 | |||||
524 | 1 | 3µs | 1; | ||
525 | |||||
526 | __END__ |