← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Config.pm
StatementsExecuted 8168 statements in 23.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118.59ms418msPerl::Critic::Config::::_load_policiesPerl::Critic::Config::_load_policies
5515.33ms6.17msPerl::Critic::Config::::_validate_and_save_color_severityPerl::Critic::Config::_validate_and_save_color_severity
1111.65ms1.31sPerl::Critic::Config::::BEGIN@24Perl::Critic::Config::BEGIN@24
1111.19ms8.20msPerl::Critic::Config::::BEGIN@26Perl::Critic::Config::BEGIN@26
289211.07ms1.07msPerl::Critic::Config::::policiesPerl::Critic::Config::policies
141111.07ms1.37msPerl::Critic::Config::::_policy_is_includedPerl::Critic::Config::_policy_is_included
14111944┬Ás1.21msPerl::Critic::Config::::_policy_is_excludedPerl::Critic::Config::_policy_is_excluded
14111898┬Ás3.50msPerl::Critic::Config::::_policy_is_unimportantPerl::Critic::Config::_policy_is_unimportant
14111817┬Ás12.9msPerl::Critic::Config::::_policy_is_thematicPerl::Critic::Config::_policy_is_thematic
14111781┬Ás3.23msPerl::Critic::Config::::_policy_is_enabledPerl::Critic::Config::_policy_is_enabled
14111778┬Ás3.49msPerl::Critic::Config::::_policy_is_disabledPerl::Critic::Config::_policy_is_disabled
111709┬Ás1.96msPerl::Critic::Config::::BEGIN@25Perl::Critic::Config::BEGIN@25
14411530┬Ás549┬ÁsPerl::Critic::Config::::program_extensions_as_regexesPerl::Critic::Config::program_extensions_as_regexes
111514┬Ás1.57msPerl::Critic::Config::::BEGIN@20Perl::Critic::Config::BEGIN@20
14411342┬Ás342┬ÁsPerl::Critic::Config::::forcePerl::Critic::Config::force
2211331┬Ás654┬ÁsPerl::Critic::Config::::_add_policy_if_enabledPerl::Critic::Config::_add_policy_if_enabled
297111317┬Ás317┬ÁsPerl::Critic::Config::::_profilePerl::Critic::Config::_profile
111310┬Ás1.82msPerl::Critic::Config::::BEGIN@22Perl::Critic::Config::BEGIN@22
111258┬Ás426msPerl::Critic::Config::::_initPerl::Critic::Config::_init
2211243┬Ás2.64msPerl::Critic::Config::::add_policyPerl::Critic::Config::add_policy
14221211┬Ás211┬ÁsPerl::Critic::Config::::single_policyPerl::Critic::Config::single_policy
14111193┬Ás193┬ÁsPerl::Critic::Config::::onlyPerl::Critic::Config::only
14111184┬Ás184┬ÁsPerl::Critic::Config::::includePerl::Critic::Config::include
14111171┬Ás171┬ÁsPerl::Critic::Config::::excludePerl::Critic::Config::exclude
14111154┬Ás154┬ÁsPerl::Critic::Config::::themePerl::Critic::Config::theme
11166┬Ás161┬ÁsPerl::Critic::Config::::_validate_and_save_themePerl::Critic::Config::_validate_and_save_theme
33158┬Ás71┬ÁsPerl::Critic::Config::::_validate_and_save_regexPerl::Critic::Config::_validate_and_save_regex
11130┬Ás42┬ÁsPerl::Critic::Config::::_validate_and_save_severityPerl::Critic::Config::_validate_and_save_severity
11129┬Ás40┬ÁsPerl::Critic::Config::::_validate_and_save_profile_strictnessPerl::Critic::Config::_validate_and_save_profile_strictness
11128┬Ás56┬ÁsPerl::Critic::Config::::_validate_and_save_verbosityPerl::Critic::Config::_validate_and_save_verbosity
297127┬Ás27┬ÁsPerl::Critic::Config::::CORE:substPerl::Critic::Config::CORE:subst (opcode)
11124┬Ás30┬ÁsPerl::Critic::Config::::_validate_and_save_pagerPerl::Critic::Config::_validate_and_save_pager
11124┬Ás31┬ÁsPerl::Critic::Config::::_validate_and_save_program_extensionsPerl::Critic::Config::_validate_and_save_program_extensions
11122┬Ás32┬ÁsPerl::Critic::Config::::_validate_and_save_topPerl::Critic::Config::_validate_and_save_top
22118┬Ás19┬ÁsPerl::Critic::Config::::CORE:regcompPerl::Critic::Config::CORE:regcomp (opcode)
11114┬Ás14┬ÁsPerl::Critic::Config::::BEGIN@10Perl::Critic::Config::BEGIN@10
11111┬Ás426msPerl::Critic::Config::::newPerl::Critic::Config::new
1119┬Ás21┬ÁsPerl::Critic::Config::::BEGIN@21Perl::Critic::Config::BEGIN@21
1118┬Ás12┬ÁsPerl::Critic::Config::::BEGIN@12Perl::Critic::Config::BEGIN@12
1118┬Ás120┬ÁsPerl::Critic::Config::::BEGIN@31Perl::Critic::Config::BEGIN@31
1118┬Ás32┬ÁsPerl::Critic::Config::::BEGIN@35Perl::Critic::Config::BEGIN@35
1117┬Ás680┬ÁsPerl::Critic::Config::::BEGIN@27Perl::Critic::Config::BEGIN@27
1117┬Ás359┬ÁsPerl::Critic::Config::::BEGIN@14Perl::Critic::Config::BEGIN@14
1117┬Ás26┬ÁsPerl::Critic::Config::::BEGIN@23Perl::Critic::Config::BEGIN@23
1117┬Ás26┬ÁsPerl::Critic::Config::::BEGIN@15Perl::Critic::Config::BEGIN@15
1117┬Ás27┬ÁsPerl::Critic::Config::::BEGIN@18Perl::Critic::Config::BEGIN@18
1116┬Ás17┬ÁsPerl::Critic::Config::::BEGIN@11Perl::Critic::Config::BEGIN@11
1116┬Ás231┬ÁsPerl::Critic::Config::::BEGIN@17Perl::Critic::Config::BEGIN@17
1113┬Ás3┬ÁsPerl::Critic::Config::::pagerPerl::Critic::Config::pager
1113┬Ás3┬ÁsPerl::Critic::Config::::program_extensionsPerl::Critic::Config::program_extensions
1112┬Ás2┬ÁsPerl::Critic::Config::::profile_strictnessPerl::Critic::Config::profile_strictness
1112┬Ás2┬ÁsPerl::Critic::Config::::CORE:qrPerl::Critic::Config::CORE:qr (opcode)
1111┬Ás1┬ÁsPerl::Critic::Config::::CORE:sortPerl::Critic::Config::CORE:sort (opcode)
111300ns300nsPerl::Critic::Config::::CORE:matchPerl::Critic::Config::CORE:match (opcode)
0000s0sPerl::Critic::Config::::__ANON__[:299]Perl::Critic::Config::__ANON__[:299]
0000s0sPerl::Critic::Config::::__ANON__[:308]Perl::Critic::Config::__ANON__[:308]
0000s0sPerl::Critic::Config::::__ANON__[:320]Perl::Critic::Config::__ANON__[:320]
0000s0sPerl::Critic::Config::::__ANON__[:348]Perl::Critic::Config::__ANON__[:348]
0000s0sPerl::Critic::Config::::__ANON__[:547]Perl::Critic::Config::__ANON__[:547]
0000s0sPerl::Critic::Config::::_add_single_policy_exception_toPerl::Critic::Config::_add_single_policy_exception_to
0000s0sPerl::Critic::Config::::_new_global_value_exceptionPerl::Critic::Config::_new_global_value_exception
0000s0sPerl::Critic::Config::::_policy_is_single_policyPerl::Critic::Config::_policy_is_single_policy
0000s0sPerl::Critic::Config::::all_policies_enabled_or_notPerl::Critic::Config::all_policies_enabled_or_not
0000s0sPerl::Critic::Config::::colorPerl::Critic::Config::color
0000s0sPerl::Critic::Config::::color_severity_highPerl::Critic::Config::color_severity_high
0000s0sPerl::Critic::Config::::color_severity_highestPerl::Critic::Config::color_severity_highest
0000s0sPerl::Critic::Config::::color_severity_lowPerl::Critic::Config::color_severity_low
0000s0sPerl::Critic::Config::::color_severity_lowestPerl::Critic::Config::color_severity_lowest
0000s0sPerl::Critic::Config::::color_severity_mediumPerl::Critic::Config::color_severity_medium
0000s0sPerl::Critic::Config::::criticism_fatalPerl::Critic::Config::criticism_fatal
0000s0sPerl::Critic::Config::::severityPerl::Critic::Config::severity
0000s0sPerl::Critic::Config::::site_policy_namesPerl::Critic::Config::site_policy_names
0000s0sPerl::Critic::Config::::topPerl::Critic::Config::top
0000s0sPerl::Critic::Config::::unsafe_allowedPerl::Critic::Config::unsafe_allowed
0000s0sPerl::Critic::Config::::verbosePerl::Critic::Config::verbose
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::Config;
9
10235┬Ás114┬Ás
# spent 14┬Ás within Perl::Critic::Config::BEGIN@10 which was called: # once (14┬Ás+0s) by Perl::Critic::BEGIN@24 at line 10
use 5.006001;
# spent 14┬Ás making 1 call to Perl::Critic::Config::BEGIN@10
11218┬Ás228┬Ás
# spent 17┬Ás (6+11) within Perl::Critic::Config::BEGIN@11 which was called: # once (6┬Ás+11┬Ás) by Perl::Critic::BEGIN@24 at line 11
use strict;
# spent 17┬Ás making 1 call to Perl::Critic::Config::BEGIN@11 # spent 11┬Ás making 1 call to strict::import
12219┬Ás216┬Ás
# spent 12┬Ás (8+4) within Perl::Critic::Config::BEGIN@12 which was called: # once (8┬Ás+4┬Ás) by Perl::Critic::BEGIN@24 at line 12
use warnings;
# spent 12┬Ás making 1 call to Perl::Critic::Config::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13
14220┬Ás2711┬Ás
# spent 359┬Ás (7+352) within Perl::Critic::Config::BEGIN@14 which was called: # once (7┬Ás+352┬Ás) by Perl::Critic::BEGIN@24 at line 14
use English qw(-no_match_vars);
# spent 359┬Ás making 1 call to Perl::Critic::Config::BEGIN@14 # spent 352┬Ás making 1 call to English::import
15221┬Ás244┬Ás
# spent 26┬Ás (7+19) within Perl::Critic::Config::BEGIN@15 which was called: # once (7┬Ás+19┬Ás) by Perl::Critic::BEGIN@24 at line 15
use Readonly;
# spent 26┬Ás making 1 call to Perl::Critic::Config::BEGIN@15 # spent 19┬Ás making 1 call to Exporter::import
16
17223┬Ás2455┬Ás
# spent 231┬Ás (6+224) within Perl::Critic::Config::BEGIN@17 which was called: # once (6┬Ás+224┬Ás) by Perl::Critic::BEGIN@24 at line 17
use List::MoreUtils qw(any none apply);
# spent 231┬Ás making 1 call to Perl::Critic::Config::BEGIN@17 # spent 224┬Ás making 1 call to Exporter::Tiny::import
18219┬Ás247┬Ás
# spent 27┬Ás (7+20) within Perl::Critic::Config::BEGIN@18 which was called: # once (7┬Ás+20┬Ás) by Perl::Critic::BEGIN@24 at line 18
use Scalar::Util qw(blessed);
# spent 27┬Ás making 1 call to Perl::Critic::Config::BEGIN@18 # spent 20┬Ás making 1 call to Exporter::import
19
20289┬Ás21.59ms
# spent 1.57ms (514┬Ás+1.06) within Perl::Critic::Config::BEGIN@20 which was called: # once (514┬Ás+1.06ms) by Perl::Critic::BEGIN@24 at line 20
use Perl::Critic::Exception::AggregateConfiguration;
# spent 1.57ms making 1 call to Perl::Critic::Config::BEGIN@20 # spent 17┬Ás making 1 call to Exporter::import
21220┬Ás233┬Ás
# spent 21┬Ás (9+12) within Perl::Critic::Config::BEGIN@21 which was called: # once (9┬Ás+12┬Ás) by Perl::Critic::BEGIN@24 at line 21
use Perl::Critic::Exception::Configuration;
# spent 21┬Ás making 1 call to Perl::Critic::Config::BEGIN@21 # spent 12┬Ás making 1 call to Exporter::import
22295┬Ás21.83ms
# spent 1.82ms (310┬Ás+1.51) within Perl::Critic::Config::BEGIN@22 which was called: # once (310┬Ás+1.51ms) by Perl::Critic::BEGIN@24 at line 22
use Perl::Critic::Exception::Configuration::Option::Global::ParameterValue;
# spent 1.82ms making 1 call to Perl::Critic::Config::BEGIN@22 # spent 15┬Ás making 1 call to Exporter::import
23219┬Ás246┬Ás
# spent 26┬Ás (7+19) within Perl::Critic::Config::BEGIN@23 which was called: # once (7┬Ás+19┬Ás) by Perl::Critic::BEGIN@24 at line 23
use Perl::Critic::Exception::Fatal::Internal qw{ throw_internal };
# spent 26┬Ás making 1 call to Perl::Critic::Config::BEGIN@23 # spent 19┬Ás making 1 call to Exporter::import
24295┬Ás22.62s
# spent 1.31s (1.65ms+1.31) within Perl::Critic::Config::BEGIN@24 which was called: # once (1.65ms+1.31s) by Perl::Critic::BEGIN@24 at line 24
use Perl::Critic::PolicyFactory;
# spent 1.31s making 1 call to Perl::Critic::Config::BEGIN@24 # spent 1.30s making 1 call to Perl::Critic::PolicyFactory::import
25291┬Ás22.04ms
# spent 1.96ms (709┬Ás+1.25) within Perl::Critic::Config::BEGIN@25 which was called: # once (709┬Ás+1.25ms) by Perl::Critic::BEGIN@24 at line 25
use Perl::Critic::Theme qw( $RULE_INVALID_CHARACTER_REGEX cook_rule );
# spent 1.96ms making 1 call to Perl::Critic::Config::BEGIN@25 # spent 84┬Ás making 1 call to Exporter::import
26292┬Ás18.20ms
# spent 8.20ms (1.19+7.00) within Perl::Critic::Config::BEGIN@26 which was called: # once (1.19ms+7.00ms) by Perl::Critic::BEGIN@24 at line 26
use Perl::Critic::UserProfile qw();
# spent 8.20ms making 1 call to Perl::Critic::Config::BEGIN@26
271200ns
# spent 680┬Ás (7+673) within Perl::Critic::Config::BEGIN@27 which was called: # once (7┬Ás+673┬Ás) by Perl::Critic::BEGIN@24 at line 30
use Perl::Critic::Utils qw{
28 :booleans :characters :severities :internal_lookup :classification
29 :data_conversion
30128┬Ás21.35ms};
# spent 680┬Ás making 1 call to Perl::Critic::Config::BEGIN@27 # spent 673┬Ás making 1 call to Exporter::import
311400ns
# spent 120┬Ás (8+112) within Perl::Critic::Config::BEGIN@31 which was called: # once (8┬Ás+112┬Ás) by Perl::Critic::BEGIN@24 at line 34
use Perl::Critic::Utils::Constants qw<
32 :profile_strictness
33 $_MODULE_VERSION_TERM_ANSICOLOR
34125┬Ás2232┬Ás>;
# spent 120┬Ás making 1 call to Perl::Critic::Config::BEGIN@31 # spent 112┬Ás making 1 call to Exporter::import
3522.79ms256┬Ás
# spent 32┬Ás (8+24) within Perl::Critic::Config::BEGIN@35 which was called: # once (8┬Ás+24┬Ás) by Perl::Critic::BEGIN@24 at line 35
use Perl::Critic::Utils::DataConversion qw< boolean_to_number dor >;
# spent 32┬Ás making 1 call to Perl::Critic::Config::BEGIN@35 # spent 24┬Ás making 1 call to Exporter::import
36
37#-----------------------------------------------------------------------------
38
391700nsour $VERSION = '1.121';
40
41#-----------------------------------------------------------------------------
42
4312┬Ás135┬ÁsReadonly::Scalar my $SINGLE_POLICY_CONFIG_KEY => 'single-policy';
# spent 35┬Ás making 1 call to Readonly::Scalar
44
45#-----------------------------------------------------------------------------
46# Constructor
47
48
# spent 426ms (11┬Ás+426) within Perl::Critic::Config::new which was called: # once (11┬Ás+426ms) by Perl::Critic::new at line 42 of Perl/Critic.pm
sub new {
49
501900ns my ( $class, %args ) = @_;
5111┬Ás my $self = bless {}, $class;
5213┬Ás1426ms $self->_init( %args );
# spent 426ms making 1 call to Perl::Critic::Config::_init
5314┬Ás return $self;
54}
55
56#-----------------------------------------------------------------------------
57
58
# spent 426ms (258┬Ás+426) within Perl::Critic::Config::_init which was called: # once (258┬Ás+426ms) by Perl::Critic::Config::new at line 52
sub _init {
591700ns my ( $self, %args ) = @_;
60
61 # -top or -theme imply that -severity is 1, unless it is already defined
6212┬Ás if ( defined $args{-top} || defined $args{-theme} ) {
63 $args{-severity} ||= $SEVERITY_LOWEST;
64 }
65
6613┬Ás1601┬Ás my $errors = Perl::Critic::Exception::AggregateConfiguration->new();
# spent 601┬Ás making 1 call to Perl::Critic::Exception::AggregateConfiguration::new
67
68 # Construct the UserProfile to get default options.
6911┬Ás my $profile_source = $args{-profile}; # Can be file path or data struct
7015┬Ás1635┬Ás my $profile = Perl::Critic::UserProfile->new( -profile => $profile_source );
# spent 635┬Ás making 1 call to Perl::Critic::UserProfile::new
7112┬Ás12┬Ás my $options_processor = $profile->options_processor();
# spent 2┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
7212┬Ás $self->{_profile} = $profile;
73
7413┬Ás140┬Ás $self->_validate_and_save_profile_strictness(
75 $args{'-profile-strictness'},
76 $errors,
77 );
78
79 # If given, these options should always have a true value.
8016┬Ás236┬Ás $self->_validate_and_save_regex(
# spent 34┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_regex # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::include
81 'include', $args{-include}, $options_processor->include(), $errors
82 );
8315┬Ás217┬Ás $self->_validate_and_save_regex(
# spent 14┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_regex # spent 3┬Ás making 1 call to Perl::Critic::OptionsProcessor::exclude
84 'exclude', $args{-exclude}, $options_processor->exclude(), $errors
85 );
8617┬Ás326┬Ás $self->_validate_and_save_regex(
# spent 22┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_regex # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::single_policy # spent 2┬Ás making 1 call to Readonly::Scalar::FETCH
87 $SINGLE_POLICY_CONFIG_KEY,
88 $args{ qq/-$SINGLE_POLICY_CONFIG_KEY/ },
89 $options_processor->single_policy(),
90 $errors,
91 );
9216┬Ás25.96ms $self->_validate_and_save_color_severity(
93 'color_severity_highest', $args{'-color-severity-highest'},
94 $options_processor->color_severity_highest(), $errors
95 );
9616┬Ás269┬Ás $self->_validate_and_save_color_severity(
97 'color_severity_high', $args{'-color-severity-high'},
98 $options_processor->color_severity_high(), $errors
99 );
10014┬Ás251┬Ás $self->_validate_and_save_color_severity(
101 'color_severity_medium', $args{'-color-severity-medium'},
102 $options_processor->color_severity_medium(), $errors
103 );
10414┬Ás250┬Ás $self->_validate_and_save_color_severity(
105 'color_severity_low', $args{'-color-severity-low'},
106 $options_processor->color_severity_low(), $errors
107 );
10814┬Ás248┬Ás $self->_validate_and_save_color_severity(
109 'color_severity_lowest', $args{'-color-severity-lowest'},
110 $options_processor->color_severity_lowest(), $errors
111 );
112
11314┬Ás156┬Ás $self->_validate_and_save_verbosity($args{-verbose}, $errors);
# spent 56┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_verbosity
11413┬Ás142┬Ás $self->_validate_and_save_severity($args{-severity}, $errors);
# spent 42┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_severity
11513┬Ás132┬Ás $self->_validate_and_save_top($args{-top}, $errors);
# spent 32┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_top
11613┬Ás1161┬Ás $self->_validate_and_save_theme($args{-theme}, $errors);
# spent 161┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_theme
11713┬Ás130┬Ás $self->_validate_and_save_pager($args{-pager}, $errors);
# spent 30┬Ás making 1 call to Perl::Critic::Config::_validate_and_save_pager
11813┬Ás131┬Ás $self->_validate_and_save_program_extensions(
119 $args{'-program-extensions'}, $errors);
120
121 # If given, these options can be true or false (but defined)
122 # We normalize these to numeric values by multiplying them by 1;
123111┬Ás416┬Ás $self->{_force} = boolean_to_number( dor( $args{-force}, $options_processor->force() ) );
# spent 8┬Ás making 1 call to Perl::Critic::Utils::DataConversion::boolean_to_number # spent 4┬Ás making 1 call to Perl::Critic::Utils::DataConversion::dor # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::force # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
12418┬Ás411┬Ás $self->{_only} = boolean_to_number( dor( $args{-only}, $options_processor->only() ) );
# spent 6┬Ás making 1 call to Perl::Critic::Utils::DataConversion::boolean_to_number # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::only # spent 2┬Ás making 1 call to Perl::Critic::Utils::DataConversion::dor # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
12517┬Ás411┬Ás $self->{_color} = boolean_to_number( dor( $args{-color}, $options_processor->color() ) );
# spent 6┬Ás making 1 call to Perl::Critic::Utils::DataConversion::boolean_to_number # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::color # spent 2┬Ás making 1 call to Perl::Critic::Utils::DataConversion::dor # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
12617┬Ás413┬Ás $self->{_unsafe_allowed} =
# spent 8┬Ás making 1 call to Perl::Critic::Utils::DataConversion::boolean_to_number # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::allow_unsafe # spent 2┬Ás making 1 call to Perl::Critic::Utils::DataConversion::dor # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
127 boolean_to_number(
128 dor( $args{'-allow-unsafe'}, $options_processor->allow_unsafe()
129 ) );
13017┬Ás410┬Ás $self->{_criticism_fatal} =
# spent 5┬Ás making 1 call to Perl::Critic::Utils::DataConversion::boolean_to_number # spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::criticism_fatal # spent 2┬Ás making 1 call to Perl::Critic::Utils::DataConversion::dor # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
131 boolean_to_number(
132 dor( $args{'-criticism-fatal'}, $options_processor->criticism_fatal() )
133 );
134
135
136 # Construct a Factory with the Profile
13716┬Ás2190┬Ás my $factory =
# spent 188┬Ás making 1 call to Perl::Critic::PolicyFactory::new # spent 2┬Ás making 1 call to Perl::Critic::Config::profile_strictness
138 Perl::Critic::PolicyFactory->new(
139 -profile => $profile,
140 -errors => $errors,
141 '-profile-strictness' => $self->profile_strictness(),
142 );
1431500ns $self->{_factory} = $factory;
144
145 # Initialize internal storage for Policies
1461400ns $self->{_all_policies_enabled_or_not} = [];
1471500ns $self->{_policies} = [];
148
149 # "NONE" means don't load any policies
15013┬Ás1418ms if ( not defined $profile_source or $profile_source ne 'NONE' ) {
# spent 418ms making 1 call to Perl::Critic::Config::_load_policies
151 # Heavy lifting here...
152 $self->_load_policies($errors);
153 }
154
15513┬Ás17┬Ás if ( $errors->has_exceptions() ) {
156 $errors->rethrow();
157 }
158
159144┬Ás return $self;
160}
161
162#-----------------------------------------------------------------------------
163
164
# spent 2.64ms (243┬Ás+2.40) within Perl::Critic::Config::add_policy which was called 22 times, avg 120┬Ás/call: # 22 times (243┬Ás+2.40ms) by Perl::Critic::Config::_load_policies at line 249, avg 120┬Ás/call
sub add_policy {
165
1662216┬Ás my ( $self, %args ) = @_;
167
1682254┬Ás221.71ms if ( not $args{-policy} ) {
# spent 1.71ms making 22 calls to Perl::Critic::Policy::to_string, avg 78┬Ás/call
169 throw_internal q{The -policy argument is required};
170 }
171
1722212┬Ás my $policy = $args{-policy};
173
174 # If the -policy is already a blessed object, then just add it directly.
1752278┬Ás2232┬Ás if ( blessed $policy ) {
# spent 32┬Ás making 22 calls to Scalar::Util::blessed, avg 1┬Ás/call
1762225┬Ás22654┬Ás $self->_add_policy_if_enabled($policy);
# spent 654┬Ás making 22 calls to Perl::Critic::Config::_add_policy_if_enabled, avg 30┬Ás/call
1772252┬Ás return $self;
178 }
179
180 # NOTE: The "-config" option is supported for backward compatibility.
181 my $params = $args{-params} || $args{-config};
182
183 my $factory = $self->{_factory};
184 my $policy_object =
185 $factory->create_policy(-name=>$policy, -params=>$params);
186 $self->_add_policy_if_enabled($policy_object);
187
188 return $self;
189}
190
191#-----------------------------------------------------------------------------
192
193
# spent 654┬Ás (331+322) within Perl::Critic::Config::_add_policy_if_enabled which was called 22 times, avg 30┬Ás/call: # 22 times (331┬Ás+322┬Ás) by Perl::Critic::Config::add_policy at line 176, avg 30┬Ás/call
sub _add_policy_if_enabled {
194226┬Ás my ( $self, $policy_object ) = @_;
195
1962234┬Ás2234┬Ás my $config = $policy_object->__get_config()
# spent 34┬Ás making 22 calls to Perl::Critic::Policy::__get_config, avg 2┬Ás/call
197 or throw_internal
198 q{Policy was not set up properly because it does not have }
199 . q{a value for its config attribute.};
200
2012217┬Ás push @{ $self->{_all_policies_enabled_or_not} }, $policy_object;
20222126┬Ás42178┬Ás if ( $policy_object->initialize_if_enabled( $config ) ) {
# spent 106┬Ás making 19 calls to Perl::Critic::Policy::initialize_if_enabled, avg 6┬Ás/call # spent 35┬Ás making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::initialize_if_enabled # spent 29┬Ás making 20 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call # spent 4┬Ás making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::initialize_if_enabled # spent 4┬Ás making 1 call to Perl::Critic::Policy::Modules::ProhibitEvilModules::initialize_if_enabled
2032155┬Ás21133┬Ás $policy_object->__set_enabled($TRUE);
# spent 133┬Ás making 21 calls to Perl::Critic::Policy::__set_enabled, avg 6┬Ás/call
2042117┬Ás push @{ $self->{_policies} }, $policy_object;
205 }
206 else {
20713┬Ás16┬Ás $policy_object->__set_enabled($FALSE);
# spent 6┬Ás making 1 call to Perl::Critic::Policy::__set_enabled
208 }
209
2102241┬Ás return;
211}
212
213#-----------------------------------------------------------------------------
214
215
# spent 418ms (8.59+409) within Perl::Critic::Config::_load_policies which was called: # once (8.59ms+409ms) by Perl::Critic::Config::_init at line 150
sub _load_policies {
216
2171400ns my ( $self, $errors ) = @_;
2181400ns my $factory = $self->{_factory};
21919┬Ás1379ms my @policies = $factory->create_all_policies( $errors );
# spent 379ms making 1 call to Perl::Critic::PolicyFactory::create_all_policies
220
22112┬Ás15┬Ás return if $errors->has_exceptions();
222
223124┬Ás for my $policy ( @policies ) {
224
225 # If -single-policy is true, only load policies that match it
226141160┬Ás141210┬Ás if ( $self->single_policy() ) {
# spent 210┬Ás making 141 calls to Perl::Critic::Config::single_policy, avg 1┬Ás/call
227 if ( $self->_policy_is_single_policy( $policy ) ) {
228 $self->add_policy( -policy => $policy );
229 }
230 next;
231 }
232
233 # Always exclude unsafe policies, unless instructed not to
234141853┬Ás282967┬Ás next if not ( $policy->is_safe() or $self->unsafe_allowed() );
# spent 760┬Ás making 141 calls to Perl::Critic::Policy::is_safe, avg 5┬Ás/call # spent 207┬Ás making 141 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
235
236 # To load, or not to load -- that is the question.
237141408┬Ás282352┬Ás my $load_me = $self->only() ? $FALSE : $TRUE;
# spent 193┬Ás making 141 calls to Perl::Critic::Config::only, avg 1┬Ás/call # spent 158┬Ás making 141 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
238
239 ## no critic (ProhibitPostfixControls)
240141170┬Ás1413.49ms $load_me = $FALSE if $self->_policy_is_disabled( $policy );
# spent 3.49ms making 141 calls to Perl::Critic::Config::_policy_is_disabled, avg 25┬Ás/call
241141188┬Ás1413.23ms $load_me = $TRUE if $self->_policy_is_enabled( $policy );
# spent 3.23ms making 141 calls to Perl::Critic::Config::_policy_is_enabled, avg 23┬Ás/call
242141408┬Ás2603.64ms $load_me = $FALSE if $self->_policy_is_unimportant( $policy );
# spent 3.50ms making 141 calls to Perl::Critic::Config::_policy_is_unimportant, avg 25┬Ás/call # spent 136┬Ás making 119 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
243141155┬Ás14112.9ms $load_me = $FALSE if not $self->_policy_is_thematic( $policy );
# spent 12.9ms making 141 calls to Perl::Critic::Config::_policy_is_thematic, avg 91┬Ás/call
244141324┬Ás1411.37ms $load_me = $TRUE if $self->_policy_is_included( $policy );
# spent 1.37ms making 141 calls to Perl::Critic::Config::_policy_is_included, avg 10┬Ás/call
245141264┬Ás1411.21ms $load_me = $FALSE if $self->_policy_is_excluded( $policy );
# spent 1.21ms making 141 calls to Perl::Critic::Config::_policy_is_excluded, avg 9┬Ás/call
246
247
24814178┬Ás next if not $load_me;
2492248┬Ás222.64ms $self->add_policy( -policy => $policy );
# spent 2.64ms making 22 calls to Perl::Critic::Config::add_policy, avg 120┬Ás/call
250 }
251
252 # When using -single-policy, only one policy should ever be loaded.
25311┬Ás11┬Ás if ($self->single_policy() && scalar $self->policies() != 1) {
# spent 1┬Ás making 1 call to Perl::Critic::Config::single_policy
254 $self->_add_single_policy_exception_to($errors);
255 }
256
2571771┬Ás return;
258}
259
260#-----------------------------------------------------------------------------
261
262
# spent 3.49ms (778┬Ás+2.71) within Perl::Critic::Config::_policy_is_disabled which was called 141 times, avg 25┬Ás/call: # 141 times (778┬Ás+2.71ms) by Perl::Critic::Config::_load_policies at line 240, avg 25┬Ás/call
sub _policy_is_disabled {
26314130┬Ás my ($self, $policy) = @_;
264141139┬Ás141151┬Ás my $profile = $self->_profile();
# spent 151┬Ás making 141 calls to Perl::Critic::Config::_profile, avg 1┬Ás/call
265141359┬Ás1412.56ms return $profile->policy_is_disabled( $policy );
# spent 2.56ms making 141 calls to Perl::Critic::UserProfile::policy_is_disabled, avg 18┬Ás/call
266}
267
268#-----------------------------------------------------------------------------
269
270
# spent 3.23ms (781┬Ás+2.44) within Perl::Critic::Config::_policy_is_enabled which was called 141 times, avg 23┬Ás/call: # 141 times (781┬Ás+2.44ms) by Perl::Critic::Config::_load_policies at line 241, avg 23┬Ás/call
sub _policy_is_enabled {
27114132┬Ás my ($self, $policy) = @_;
272141126┬Ás141148┬Ás my $profile = $self->_profile();
# spent 148┬Ás making 141 calls to Perl::Critic::Config::_profile, avg 1┬Ás/call
273141362┬Ás1412.30ms return $profile->policy_is_enabled( $policy );
# spent 2.30ms making 141 calls to Perl::Critic::UserProfile::policy_is_enabled, avg 16┬Ás/call
274}
275
276#-----------------------------------------------------------------------------
277
278
# spent 12.9ms (817┬Ás+12.1) within Perl::Critic::Config::_policy_is_thematic which was called 141 times, avg 91┬Ás/call: # 141 times (817┬Ás+12.1ms) by Perl::Critic::Config::_load_policies at line 243, avg 91┬Ás/call
sub _policy_is_thematic {
27914131┬Ás my ($self, $policy) = @_;
280141138┬Ás141154┬Ás my $theme = $self->theme();
# spent 154┬Ás making 141 calls to Perl::Critic::Config::theme, avg 1┬Ás/call
281141401┬Ás14111.9ms return $theme->policy_is_thematic( -policy => $policy );
# spent 11.9ms making 141 calls to Perl::Critic::Theme::policy_is_thematic, avg 85┬Ás/call
282}
283
284#-----------------------------------------------------------------------------
285
286
# spent 3.50ms (898┬Ás+2.60) within Perl::Critic::Config::_policy_is_unimportant which was called 141 times, avg 25┬Ás/call: # 141 times (898┬Ás+2.60ms) by Perl::Critic::Config::_load_policies at line 242, avg 25┬Ás/call
sub _policy_is_unimportant {
28714140┬Ás my ($self, $policy) = @_;
288141442┬Ás1412.60ms my $policy_severity = $policy->get_severity();
# spent 2.60ms making 141 calls to Perl::Critic::Policy::get_severity, avg 18┬Ás/call
28914143┬Ás my $min_severity = $self->{_severity};
290141290┬Ás return $policy_severity < $min_severity;
291}
292
293#-----------------------------------------------------------------------------
294
295
# spent 1.37ms (1.07+302┬Ás) within Perl::Critic::Config::_policy_is_included which was called 141 times, avg 10┬Ás/call: # 141 times (1.07ms+302┬Ás) by Perl::Critic::Config::_load_policies at line 244, avg 10┬Ás/call
sub _policy_is_included {
29614135┬Ás my ($self, $policy) = @_;
29714142┬Ás my $policy_long_name = ref $policy;
298141162┬Ás141184┬Ás my @inclusions = $self->include();
# spent 184┬Ás making 141 calls to Perl::Critic::Config::include, avg 1┬Ás/call
299141808┬Ás141118┬Ás return any { $policy_long_name =~ m/$_/ixms } @inclusions;
# spent 118┬Ás making 141 calls to List::MoreUtils::any, avg 835ns/call
300}
301
302#-----------------------------------------------------------------------------
303
304
# spent 1.21ms (944┬Ás+264┬Ás) within Perl::Critic::Config::_policy_is_excluded which was called 141 times, avg 9┬Ás/call: # 141 times (944┬Ás+264┬Ás) by Perl::Critic::Config::_load_policies at line 245, avg 9┬Ás/call
sub _policy_is_excluded {
30514131┬Ás my ($self, $policy) = @_;
30614144┬Ás my $policy_long_name = ref $policy;
307141146┬Ás141171┬Ás my @exclusions = $self->exclude();
# spent 171┬Ás making 141 calls to Perl::Critic::Config::exclude, avg 1┬Ás/call
308141714┬Ás14193┬Ás return any { $policy_long_name =~ m/$_/ixms } @exclusions;
# spent 93┬Ás making 141 calls to List::MoreUtils::any, avg 658ns/call
309}
310
311#-----------------------------------------------------------------------------
312
313sub _policy_is_single_policy {
314 my ($self, $policy) = @_;
315
316 my @patterns = $self->single_policy();
317 return if not @patterns;
318
319 my $policy_long_name = ref $policy;
320 return any { $policy_long_name =~ m/$_/ixms } @patterns;
321}
322
323#-----------------------------------------------------------------------------
324
325sub _new_global_value_exception {
326 my ($self, @args) = @_;
327
328 return
329 Perl::Critic::Exception::Configuration::Option::Global::ParameterValue
330 ->new(@args);
331}
332
333#-----------------------------------------------------------------------------
334
335sub _add_single_policy_exception_to {
336 my ($self, $errors) = @_;
337
338 my $message_suffix = $EMPTY;
339 my $patterns = join q{", "}, $self->single_policy();
340
341 if (scalar $self->policies() == 0) {
342 $message_suffix =
343 q{did not match any policies (in combination with }
344 . q{other policy restrictions).};
345 }
346 else {
347 $message_suffix = qq{matched multiple policies:\n\t};
348 $message_suffix .= join qq{,\n\t}, apply { chomp } sort $self->policies();
349 }
350
351 $errors->add_exception(
352 $self->_new_global_value_exception(
353 option_name => $SINGLE_POLICY_CONFIG_KEY,
354 option_value => $patterns,
355 message_suffix => $message_suffix,
356 )
357 );
358
359 return;
360}
361
362#-----------------------------------------------------------------------------
363
364
# spent 71┬Ás (58+13) within Perl::Critic::Config::_validate_and_save_regex which was called 3 times, avg 24┬Ás/call: # once (31┬Ás+4┬Ás) by Perl::Critic::Config::_init at line 80 # once (16┬Ás+6┬Ás) by Perl::Critic::Config::_init at line 86 # once (12┬Ás+3┬Ás) by Perl::Critic::Config::_init at line 83
sub _validate_and_save_regex {
36534┬Ás11┬Ás my ($self, $option_name, $args_value, $default_value, $errors) = @_;
# spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
366
3673300ns my $full_option_name;
3683100ns my $source;
3693400ns my @regexes;
370
3713400ns if ($args_value) {
372 $full_option_name = "-$option_name";
373
374 if (ref $args_value) {
375 @regexes = @{ $args_value };
376 }
377 else {
378 @regexes = ( $args_value );
379 }
380 }
381
382310┬Ás if (not @regexes) {
3833900ns $full_option_name = $option_name;
38436┬Ás68┬Ás $source = $self->_profile()->source();
# spent 4┬Ás making 3 calls to Perl::Critic::UserProfile::source, avg 1┬Ás/call # spent 4┬Ás making 3 calls to Perl::Critic::Config::_profile, avg 1┬Ás/call
385
38632┬Ás if (ref $default_value) {
387 @regexes = @{ $default_value };
388 }
389 elsif ($default_value) {
390 @regexes = ( $default_value );
391 }
392 }
393
3943200ns my $found_errors;
39532┬Ás foreach my $regex (@regexes) {
396 eval { qr/$regex/ixms }
397 or do {
398 my $cleaned_error = $EVAL_ERROR || '<unknown reason>';
399 $cleaned_error =~
400 s/ [ ] at [ ] .* Config [.] pm [ ] line [ ] \d+ [.] \n? \z/./xms;
401
402 $errors->add_exception(
403 $self->_new_global_value_exception(
404 option_name => $option_name,
405 option_value => $regex,
406 source => $source,
407 message_suffix => qq{is not valid: $cleaned_error},
408 )
409 );
410
411 $found_errors = 1;
412 }
413 }
414
4153900ns if (not $found_errors) {
4163700ns my $option_key = $option_name;
417311┬Ás33┬Ás $option_key =~ s/ - /_/xmsg;
# spent 3┬Ás making 3 calls to Perl::Critic::Config::CORE:subst, avg 1┬Ás/call
418
41933┬Ás $self->{"_$option_key"} = \@regexes;
420 }
421
42238┬Ás return;
423}
424
425#-----------------------------------------------------------------------------
426
427
# spent 40┬Ás (29+11) within Perl::Critic::Config::_validate_and_save_profile_strictness which was called: # once (29┬Ás+11┬Ás) by Perl::Critic::Config::_init at line 74
sub _validate_and_save_profile_strictness {
4281900ns my ($self, $args_value, $errors) = @_;
429
4301200ns my $option_name;
4311100ns my $source;
4321200ns my $profile_strictness;
433
4341500ns if ($args_value) {
435 $option_name = '-profile-strictness';
436 $profile_strictness = $args_value;
437 }
438 else {
4391500ns $option_name = 'profile-strictness';
440
44113┬Ás12┬Ás my $profile = $self->_profile();
# spent 2┬Ás making 1 call to Perl::Critic::Config::_profile
44212┬Ás12┬Ás $source = $profile->source();
# spent 2┬Ás making 1 call to Perl::Critic::UserProfile::source
44314┬Ás24┬Ás $profile_strictness = $profile->options_processor()->profile_strictness();
# spent 3┬Ás making 1 call to Perl::Critic::OptionsProcessor::profile_strictness # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
444 }
445
44614┬Ás12┬Ás if ( not $PROFILE_STRICTNESSES{$profile_strictness} ) {
# spent 2┬Ás making 1 call to Readonly::Hash::FETCH
447 $errors->add_exception(
448 $self->_new_global_value_exception(
449 option_name => $option_name,
450 option_value => $profile_strictness,
451 source => $source,
452 message_suffix => q{is not one of "}
453 . join ( q{", "}, (sort keys %PROFILE_STRICTNESSES) )
454 . q{".},
455 )
456 );
457
458 $profile_strictness = $PROFILE_STRICTNESS_FATAL;
459 }
460
4611800ns $self->{_profile_strictness} = $profile_strictness;
462
46314┬Ás return;
464}
465
466#-----------------------------------------------------------------------------
467
468
# spent 56┬Ás (28+27) within Perl::Critic::Config::_validate_and_save_verbosity which was called: # once (28┬Ás+27┬Ás) by Perl::Critic::Config::_init at line 113
sub _validate_and_save_verbosity {
4691800ns my ($self, $args_value, $errors) = @_;
470
4711200ns my $option_name;
4721100ns my $source;
4731200ns my $verbosity;
474
4751600ns if ($args_value) {
476 $option_name = '-verbose';
477 $verbosity = $args_value;
478 }
479 else {
4801500ns $option_name = 'verbose';
481
48211┬Ás11┬Ás my $profile = $self->_profile();
# spent 1┬Ás making 1 call to Perl::Critic::Config::_profile
48312┬Ás11┬Ás $source = $profile->source();
# spent 1┬Ás making 1 call to Perl::Critic::UserProfile::source
48414┬Ás24┬Ás $verbosity = $profile->options_processor()->verbose();
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::verbose # spent 2┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
485 }
486
48716┬Ás221┬Ás if (
# spent 11┬Ás making 1 call to Perl::Critic::Utils::is_valid_numeric_verbosity # spent 10┬Ás making 1 call to Perl::Critic::Utils::is_integer
488 is_integer($verbosity)
489 and not is_valid_numeric_verbosity($verbosity)
490 ) {
491 $errors->add_exception(
492 $self->_new_global_value_exception(
493 option_name => $option_name,
494 option_value => $verbosity,
495 source => $source,
496 message_suffix =>
497 'is not the number of one of the pre-defined verbosity formats.',
498 )
499 );
500 }
501 else {
5021700ns $self->{_verbose} = $verbosity;
503 }
504
50514┬Ás return;
506}
507
508#-----------------------------------------------------------------------------
509
510
# spent 42┬Ás (30+13) within Perl::Critic::Config::_validate_and_save_severity which was called: # once (30┬Ás+13┬Ás) by Perl::Critic::Config::_init at line 114
sub _validate_and_save_severity {
5111400ns my ($self, $args_value, $errors) = @_;
512
5131100ns my $option_name;
5141100ns my $source;
5151100ns my $severity;
516
5171600ns if ($args_value) {
518 $option_name = '-severity';
519 $severity = $args_value;
520 }
521 else {
5221400ns $option_name = 'severity';
523
52411┬Ás11┬Ás my $profile = $self->_profile();
# spent 1┬Ás making 1 call to Perl::Critic::Config::_profile
52511┬Ás11┬Ás $source = $profile->source();
# spent 1┬Ás making 1 call to Perl::Critic::UserProfile::source
52614┬Ás24┬Ás $severity = $profile->options_processor()->severity();
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::severity # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
527 }
528
52917┬Ás37┬Ás if ( is_integer($severity) ) {
# spent 4┬Ás making 1 call to Perl::Critic::Utils::is_integer # spent 2┬Ás making 2 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
530 if (
531 $severity >= $SEVERITY_LOWEST and $severity <= $SEVERITY_HIGHEST
532 ) {
533 $self->{_severity} = $severity;
534 }
535 else {
536 $errors->add_exception(
537 $self->_new_global_value_exception(
538 option_name => $option_name,
539 option_value => $severity,
540 source => $source,
541 message_suffix =>
542 "is not between $SEVERITY_LOWEST (low) and $SEVERITY_HIGHEST (high).",
543 )
544 );
545 }
546 }
547 elsif ( not any { $_ eq lc $severity } @SEVERITY_NAMES ) {
548 $errors->add_exception(
549 $self->_new_global_value_exception(
550 option_name => $option_name,
551 option_value => $severity,
552 source => $source,
553 message_suffix =>
554 q{is not one of the valid severity names: "}
555 . join (q{", "}, @SEVERITY_NAMES)
556 . q{".},
557 )
558 );
559 }
560 else {
561 $self->{_severity} = severity_to_number($severity);
562 }
563
56413┬Ás return;
565}
566
567#-----------------------------------------------------------------------------
568
569
# spent 32┬Ás (22+10) within Perl::Critic::Config::_validate_and_save_top which was called: # once (22┬Ás+10┬Ás) by Perl::Critic::Config::_init at line 115
sub _validate_and_save_top {
5701800ns my ($self, $args_value, $errors) = @_;
571
5721200ns my $option_name;
57310s my $source;
5741200ns my $top;
575
5761700ns if (defined $args_value and $args_value ne q{}) {
577 $option_name = '-top';
578 $top = $args_value;
579 }
580 else {
5811500ns $option_name = 'top';
582
58311┬Ás11┬Ás my $profile = $self->_profile();
# spent 1┬Ás making 1 call to Perl::Critic::Config::_profile
58411┬Ás11┬Ás $source = $profile->source();
# spent 1┬Ás making 1 call to Perl::Critic::UserProfile::source
58514┬Ás24┬Ás $top = $profile->options_processor()->top();
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::top # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
586 }
587
58812┬Ás14┬Ás if ( is_integer($top) and $top >= 0 ) {
# spent 4┬Ás making 1 call to Perl::Critic::Utils::is_integer
589 $self->{_top} = $top;
590 }
591 else {
592 $errors->add_exception(
593 $self->_new_global_value_exception(
594 option_name => $option_name,
595 option_value => $top,
596 source => $source,
597 message_suffix => q{is not a non-negative integer.},
598 )
599 );
600 }
601
60213┬Ás return;
603}
604
605#-----------------------------------------------------------------------------
606
607
# spent 161┬Ás (66+96) within Perl::Critic::Config::_validate_and_save_theme which was called: # once (66┬Ás+96┬Ás) by Perl::Critic::Config::_init at line 116
sub _validate_and_save_theme {
6081700ns my ($self, $args_value, $errors) = @_;
609
6101200ns my $option_name;
6111100ns my $source;
6121100ns my $theme_rule;
613
6141500ns if ($args_value) {
615 $option_name = '-theme';
616 $theme_rule = $args_value;
617 }
618 else {
6191500ns $option_name = 'theme';
620
62111┬Ás11┬Ás my $profile = $self->_profile();
# spent 1┬Ás making 1 call to Perl::Critic::Config::_profile
62211┬Ás11┬Ás $source = $profile->source();
# spent 1┬Ás making 1 call to Perl::Critic::UserProfile::source
62313┬Ás24┬Ás $theme_rule = $profile->options_processor()->theme();
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::theme # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
624 }
625
626113┬Ás310┬Ás if ( $theme_rule =~ m/$RULE_INVALID_CHARACTER_REGEX/xms ) {
# spent 8┬Ás making 1 call to Perl::Critic::Config::CORE:regcomp # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH # spent 300ns making 1 call to Perl::Critic::Config::CORE:match
627 my $bad_character = $1;
628
629 $errors->add_exception(
630 $self->_new_global_value_exception(
631 option_name => $option_name,
632 option_value => $theme_rule,
633 source => $source,
634 message_suffix =>
635 qq{contains an illegal character ("$bad_character").},
636 )
637 );
638 }
639 else {
64012┬Ás128┬Ás my $rule_as_code = cook_rule($theme_rule);
# spent 28┬Ás making 1 call to Perl::Critic::Theme::cook_rule
64113┬Ás1300ns $rule_as_code =~ s/ [\w\d]+ / 1 /gxms;
# spent 300ns making 1 call to Perl::Critic::Config::CORE:subst
642
643 # eval of an empty string does not reset $@ in Perl 5.6.
64413┬Ás11┬Ás local $EVAL_ERROR = $EMPTY;
# spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
645119┬Ás eval $rule_as_code; ## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval)
646
6471700ns if ($EVAL_ERROR) {
648 $errors->add_exception(
649 $self->_new_global_value_exception(
650 option_name => $option_name,
651 option_value => $theme_rule,
652 source => $source,
653 message_suffix => q{is not syntactically valid.},
654 )
655 );
656 }
657 else {
658 eval {
65916┬Ás152┬Ás $self->{_theme} =
# spent 52┬Ás making 1 call to Perl::Critic::Theme::new
660 Perl::Critic::Theme->new( -rule => $theme_rule );
661 }
6621700ns or do {
663 $errors->add_exception_or_rethrow( $EVAL_ERROR );
664 };
665 }
666 }
667
66813┬Ás return;
669}
670
671#-----------------------------------------------------------------------------
672
673
# spent 30┬Ás (24+6) within Perl::Critic::Config::_validate_and_save_pager which was called: # once (24┬Ás+6┬Ás) by Perl::Critic::Config::_init at line 117
sub _validate_and_save_pager {
6741800ns my ($self, $args_value, $errors) = @_;
675
6761200ns my $pager;
67711┬Ás if ( $args_value ) {
678 $pager = defined $args_value ? $args_value : $EMPTY;
679 }
680 elsif ( $ENV{PERLCRITIC_PAGER} ) {
681 $pager = $ENV{PERLCRITIC_PAGER};
682 }
683 else {
68411┬Ás11┬Ás my $profile = $self->_profile();
# spent 1┬Ás making 1 call to Perl::Critic::Config::_profile
68513┬Ás24┬Ás $pager = $profile->options_processor()->pager();
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::pager # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
686 }
687
6881600ns if ($pager eq '$PAGER') { ## no critic (RequireInterpolationOfMetachars)
689 $pager = $ENV{PAGER};
690 }
69112┬Ás11┬Ás $pager ||= $EMPTY;
# spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
692
6931800ns $self->{_pager} = $pager;
694
69513┬Ás return;
696}
697
698#-----------------------------------------------------------------------------
699
700
# spent 6.17ms (5.33+840┬Ás) within Perl::Critic::Config::_validate_and_save_color_severity which was called 5 times, avg 1.23ms/call: # once (5.23ms+731┬Ás) by Perl::Critic::Config::_init at line 92 # once (30┬Ás+36┬Ás) by Perl::Critic::Config::_init at line 96 # once (24┬Ás+25┬Ás) by Perl::Critic::Config::_init at line 100 # once (23┬Ás+24┬Ás) by Perl::Critic::Config::_init at line 104 # once (22┬Ás+24┬Ás) by Perl::Critic::Config::_init at line 108
sub _validate_and_save_color_severity {
70155┬Ás my ($self, $option_name, $args_value, $default_value, $errors) = @_;
702
7035300ns my $source;
7045200ns my $color_severity;
7055200ns my $full_option_name;
706
70751┬Ás if (defined $args_value) {
708 $full_option_name = "-$option_name";
709 $color_severity = lc $args_value;
710 }
711 else {
7125800ns $full_option_name = $option_name;
713512┬Ás1014┬Ás $source = $self->_profile()->source();
# spent 8┬Ás making 5 calls to Perl::Critic::UserProfile::source, avg 2┬Ás/call # spent 6┬Ás making 5 calls to Perl::Critic::Config::_profile, avg 1┬Ás/call
71453┬Ás $color_severity = lc $default_value;
715 }
716512┬Ás54┬Ás $color_severity =~ s/ \s+ / /xmsg;
# spent 4┬Ás making 5 calls to Perl::Critic::Config::CORE:subst, avg 760ns/call
717511┬Ás54┬Ás $color_severity =~ s/ \A\s+ //xms;
# spent 4┬Ás making 5 calls to Perl::Critic::Config::CORE:subst, avg 720ns/call
718510┬Ás53┬Ás $color_severity =~ s/ \s+\z //xms;
# spent 3┬Ás making 5 calls to Perl::Critic::Config::CORE:subst, avg 680ns/call
719517┬Ás59┬Ás $full_option_name =~ s/ _ /-/xmsg;
# spent 9┬Ás making 5 calls to Perl::Critic::Config::CORE:subst, avg 2┬Ás/call
720
721 # Should we really be validating this?
7225500ns my $found_errors;
723515┬Ás1035┬Ás if (
# spent 23┬Ás making 5 calls to Term::ANSIColor::colorvalid, avg 5┬Ás/call # spent 12┬Ás making 5 calls to Perl::Critic::Utils::words_from_string, avg 2┬Ás/call
724 eval {
7255110┬Ás require Term::ANSIColor;
726588┬Ás20119┬Ás Term::ANSIColor->VERSION( $_MODULE_VERSION_TERM_ANSICOLOR );
# spent 101┬Ás making 5 calls to UNIVERSAL::VERSION, avg 20┬Ás/call # spent 18┬Ás making 15 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
72752┬Ás 1;
728 }
729 ) {
730 $found_errors =
731 not Term::ANSIColor::colorvalid( words_from_string($color_severity) );
732 }
733
734 # If we do not have Term::ANSIColor we can not validate, but we store the
735 # values anyway for the benefit of Perl::Critic::ProfilePrototype.
736
7375800ns if ($found_errors) {
738 $errors->add_exception(
739 $self->_new_global_value_exception(
740 option_name => $full_option_name,
741 option_value => $color_severity,
742 source => $source,
743 message_suffix => 'is not valid.',
744 )
745 );
746 }
747 else {
74851┬Ás my $option_key = $option_name;
749512┬Ás54┬Ás $option_key =~ s/ - /_/xmsg;
# spent 4┬Ás making 5 calls to Perl::Critic::Config::CORE:subst, avg 720ns/call
750
75157┬Ás $self->{"_$option_key"} = $color_severity;
752 }
753
754515┬Ás return;
755}
756
757#-----------------------------------------------------------------------------
758
759
# spent 31┬Ás (24+7) within Perl::Critic::Config::_validate_and_save_program_extensions which was called: # once (24┬Ás+7┬Ás) by Perl::Critic::Config::_init at line 118
sub _validate_and_save_program_extensions {
7601800ns my ($self, $args_value, $errors) = @_;
761
7621900ns delete $self->{_program_extensions_as_regexes};
763
764 my $extension_list = q{ARRAY} eq ref $args_value ?
76515┬Ás34┬Ás [map {words_from_string($_)} @{ $args_value }] :
# spent 2┬Ás making 1 call to Perl::Critic::OptionsProcessor::program_extensions # spent 1┬Ás making 1 call to Perl::Critic::Config::_profile # spent 1┬Ás making 1 call to Perl::Critic::UserProfile::options_processor
766 $self->_profile()->options_processor()->program_extensions();
767
76813┬Ás12┬Ás my %program_extensions = hashify( @{ $extension_list } );
# spent 2┬Ás making 1 call to Perl::Critic::Utils::hashify
769
77012┬Ás $self->{_program_extensions} = [keys %program_extensions];
771
77213┬Ás return;
773
774}
775
776#-----------------------------------------------------------------------------
777# Begin ACCESSSOR methods
778
779
# spent 317┬Ás within Perl::Critic::Config::_profile which was called 297 times, avg 1┬Ás/call: # 141 times (151┬Ás+0s) by Perl::Critic::Config::_policy_is_disabled at line 264, avg 1┬Ás/call # 141 times (148┬Ás+0s) by Perl::Critic::Config::_policy_is_enabled at line 272, avg 1┬Ás/call # 5 times (6┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 713, avg 1┬Ás/call # 3 times (4┬Ás+0s) by Perl::Critic::Config::_validate_and_save_regex at line 384, avg 1┬Ás/call # once (2┬Ás+0s) by Perl::Critic::Config::_validate_and_save_profile_strictness at line 441 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_top at line 583 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_program_extensions at line 765 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_severity at line 524 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_verbosity at line 482 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_theme at line 621 # once (1┬Ás+0s) by Perl::Critic::Config::_validate_and_save_pager at line 684
sub _profile {
78029733┬Ás my ($self) = @_;
781297590┬Ás return $self->{_profile};
782}
783
784#-----------------------------------------------------------------------------
785
786sub all_policies_enabled_or_not {
787 my ($self) = @_;
788 return @{ $self->{_all_policies_enabled_or_not} };
789}
790
791#-----------------------------------------------------------------------------
792
793
# spent 1.07ms within Perl::Critic::Config::policies which was called 289 times, avg 4┬Ás/call: # 145 times (430┬Ás+0s) by Perl::Critic::policies at line 68 of Perl/Critic.pm, avg 3┬Ás/call # 144 times (643┬Ás+0s) by Perl::Critic::_gather_violations at line 133 of Perl/Critic.pm, avg 4┬Ás/call
sub policies {
794289106┬Ás my ($self) = @_;
7952891.19ms return @{ $self->{_policies} };
796}
797
798#-----------------------------------------------------------------------------
799
800
# spent 171┬Ás within Perl::Critic::Config::exclude which was called 141 times, avg 1┬Ás/call: # 141 times (171┬Ás+0s) by Perl::Critic::Config::_policy_is_excluded at line 307, avg 1┬Ás/call
sub exclude {
80114123┬Ás my ($self) = @_;
802141274┬Ás return @{ $self->{_exclude} };
803}
804
805#-----------------------------------------------------------------------------
806
807
# spent 342┬Ás within Perl::Critic::Config::force which was called 144 times, avg 2┬Ás/call: # 144 times (342┬Ás+0s) by Perl::Critic::_gather_violations at line 128 of Perl/Critic.pm, avg 2┬Ás/call
sub force {
80814453┬Ás my ($self) = @_;
809144392┬Ás return $self->{_force};
810}
811
812#-----------------------------------------------------------------------------
813
814
# spent 184┬Ás within Perl::Critic::Config::include which was called 141 times, avg 1┬Ás/call: # 141 times (184┬Ás+0s) by Perl::Critic::Config::_policy_is_included at line 298, avg 1┬Ás/call
sub include {
81514120┬Ás my ($self) = @_;
816141287┬Ás return @{ $self->{_include} };
817}
818
819#-----------------------------------------------------------------------------
820
821
# spent 193┬Ás within Perl::Critic::Config::only which was called 141 times, avg 1┬Ás/call: # 141 times (193┬Ás+0s) by Perl::Critic::Config::_load_policies at line 237, avg 1┬Ás/call
sub only {
82214125┬Ás my ($self) = @_;
823141267┬Ás return $self->{_only};
824}
825
826#-----------------------------------------------------------------------------
827
828
# spent 2┬Ás within Perl::Critic::Config::profile_strictness which was called: # once (2┬Ás+0s) by Perl::Critic::Config::_init at line 137
sub profile_strictness {
8291400ns my ($self) = @_;
83013┬Ás return $self->{_profile_strictness};
831}
832
833#-----------------------------------------------------------------------------
834
835sub severity {
836 my ($self) = @_;
837 return $self->{_severity};
838}
839
840#-----------------------------------------------------------------------------
841
842
# spent 211┬Ás within Perl::Critic::Config::single_policy which was called 142 times, avg 1┬Ás/call: # 141 times (210┬Ás+0s) by Perl::Critic::Config::_load_policies at line 226, avg 1┬Ás/call # once (1┬Ás+0s) by Perl::Critic::Config::_load_policies at line 253
sub single_policy {
84314227┬Ás my ($self) = @_;
8441423.82ms return @{ $self->{_single_policy} };
845}
846
847#-----------------------------------------------------------------------------
848
849
# spent 154┬Ás within Perl::Critic::Config::theme which was called 141 times, avg 1┬Ás/call: # 141 times (154┬Ás+0s) by Perl::Critic::Config::_policy_is_thematic at line 280, avg 1┬Ás/call
sub theme {
85014116┬Ás my ($self) = @_;
851141272┬Ás return $self->{_theme};
852}
853
854#-----------------------------------------------------------------------------
855
856sub top {
857 my ($self) = @_;
858 return $self->{_top};
859}
860
861#-----------------------------------------------------------------------------
862
863sub verbose {
864 my ($self) = @_;
865 return $self->{_verbose};
866}
867
868#-----------------------------------------------------------------------------
869
870sub color {
871 my ($self) = @_;
872 return $self->{_color};
873}
874
875#-----------------------------------------------------------------------------
876
877
# spent 3┬Ás within Perl::Critic::Config::pager which was called: # once (3┬Ás+0s) by Perl::Critic::Command::_critique at line 241 of Perl/Critic/Command.pm
sub pager {
8781400ns my ($self) = @_;
87914┬Ás return $self->{_pager};
880}
881
882#-----------------------------------------------------------------------------
883
884sub unsafe_allowed {
885 my ($self) = @_;
886 return $self->{_unsafe_allowed};
887}
888
889#-----------------------------------------------------------------------------
890
891sub criticism_fatal {
892 my ($self) = @_;
893 return $self->{_criticism_fatal};
894}
895
896#-----------------------------------------------------------------------------
897
898sub site_policy_names {
899 return Perl::Critic::PolicyFactory::site_policy_names();
900}
901
902#-----------------------------------------------------------------------------
903
904sub color_severity_highest {
905 my ($self) = @_;
906 return $self->{_color_severity_highest};
907}
908
909#-----------------------------------------------------------------------------
910
911sub color_severity_high {
912 my ($self) = @_;
913 return $self->{_color_severity_high};
914}
915
916#-----------------------------------------------------------------------------
917
918sub color_severity_medium {
919 my ($self) = @_;
920 return $self->{_color_severity_medium};
921}
922
923#-----------------------------------------------------------------------------
924
925sub color_severity_low {
926 my ($self) = @_;
927 return $self->{_color_severity_low};
928}
929
930#-----------------------------------------------------------------------------
931
932sub color_severity_lowest {
933 my ($self) = @_;
934 return $self->{_color_severity_lowest};
935}
936
937#-----------------------------------------------------------------------------
938
939
# spent 3┬Ás within Perl::Critic::Config::program_extensions which was called: # once (3┬Ás+0s) by Perl::Critic::Config::program_extensions_as_regexes at line 952
sub program_extensions {
9401400ns my ($self) = @_;
94114┬Ás return @{ $self->{_program_extensions} };
942}
943
944#-----------------------------------------------------------------------------
945
946
# spent 549┬Ás (530+18) within Perl::Critic::Config::program_extensions_as_regexes which was called 144 times, avg 4┬Ás/call: # 144 times (530┬Ás+18┬Ás) by Perl::Critic::critique at line 104 of Perl/Critic.pm, avg 4┬Ás/call
sub program_extensions_as_regexes {
94714450┬Ás my ($self) = @_;
948
9491442.63ms return @{ $self->{_program_extensions_as_regexes} }
950 if $self->{_program_extensions_as_regexes};
951
95214┬Ás24┬Ás my %program_extensions = hashify( $self->program_extensions() );
# spent 3┬Ás making 1 call to Perl::Critic::Config::program_extensions # spent 2┬Ás making 1 call to Perl::Critic::Utils::hashify
9531800ns $program_extensions{'.PL'} = 1;
954 return @{
95514┬Ás $self->{_program_extensions_as_regexes} = [
956232┬Ás314┬Ás map { qr< @{[quotemeta $_]} \z >smx } sort keys %program_extensions
# spent 11┬Ás making 1 call to Perl::Critic::Config::CORE:regcomp # spent 2┬Ás making 1 call to Perl::Critic::Config::CORE:qr # spent 1┬Ás making 1 call to Perl::Critic::Config::CORE:sort
957 ]
958 };
959}
960
96113┬Ás1;
962
963#-----------------------------------------------------------------------------
964
965__END__
 
# spent 300ns within Perl::Critic::Config::CORE:match which was called: # once (300ns+0s) by Perl::Critic::Config::_validate_and_save_theme at line 626
sub Perl::Critic::Config::CORE:match; # opcode
# spent 2┬Ás within Perl::Critic::Config::CORE:qr which was called: # once (2┬Ás+0s) by Perl::Critic::Config::program_extensions_as_regexes at line 956
sub Perl::Critic::Config::CORE:qr; # opcode
# spent 19┬Ás (18+1) within Perl::Critic::Config::CORE:regcomp which was called 2 times, avg 9┬Ás/call: # once (11┬Ás+0s) by Perl::Critic::Config::program_extensions_as_regexes at line 956 # once (7┬Ás+1┬Ás) by Perl::Critic::Config::_validate_and_save_theme at line 626
sub Perl::Critic::Config::CORE:regcomp; # opcode
# spent 1┬Ás within Perl::Critic::Config::CORE:sort which was called: # once (1┬Ás+0s) by Perl::Critic::Config::program_extensions_as_regexes at line 956
sub Perl::Critic::Config::CORE:sort; # opcode
# spent 27┬Ás within Perl::Critic::Config::CORE:subst which was called 29 times, avg 934ns/call: # 5 times (9┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 719, avg 2┬Ás/call # 5 times (4┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 716, avg 760ns/call # 5 times (4┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 749, avg 720ns/call # 5 times (4┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 717, avg 720ns/call # 5 times (3┬Ás+0s) by Perl::Critic::Config::_validate_and_save_color_severity at line 718, avg 680ns/call # 3 times (3┬Ás+0s) by Perl::Critic::Config::_validate_and_save_regex at line 417, avg 1┬Ás/call # once (300ns+0s) by Perl::Critic::Config::_validate_and_save_theme at line 641
sub Perl::Critic::Config::CORE:subst; # opcode