line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::UserProfile; |
2
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
16860
|
use 5.010001; |
|
40
|
|
|
|
|
208
|
|
4
|
40
|
|
|
40
|
|
270
|
use strict; |
|
40
|
|
|
|
|
110
|
|
|
40
|
|
|
|
|
868
|
|
5
|
40
|
|
|
40
|
|
205
|
use warnings; |
|
40
|
|
|
|
|
117
|
|
|
40
|
|
|
|
|
1224
|
|
6
|
|
|
|
|
|
|
|
7
|
40
|
|
|
40
|
|
1762
|
use English qw(-no_match_vars); |
|
40
|
|
|
|
|
11637
|
|
|
40
|
|
|
|
|
262
|
|
8
|
40
|
|
|
40
|
|
17312
|
use Readonly; |
|
40
|
|
|
|
|
24462
|
|
|
40
|
|
|
|
|
2097
|
|
9
|
|
|
|
|
|
|
|
10
|
40
|
|
|
40
|
|
22859
|
use Config::Tiny qw(); |
|
40
|
|
|
|
|
47654
|
|
|
40
|
|
|
|
|
990
|
|
11
|
40
|
|
|
40
|
|
295
|
use File::Spec qw(); |
|
40
|
|
|
|
|
131
|
|
|
40
|
|
|
|
|
686
|
|
12
|
|
|
|
|
|
|
|
13
|
40
|
|
|
40
|
|
17697
|
use Perl::Critic::OptionsProcessor qw(); |
|
40
|
|
|
|
|
151
|
|
|
40
|
|
|
|
|
1309
|
|
14
|
40
|
|
|
40
|
|
331
|
use Perl::Critic::Utils qw{ $EMPTY policy_long_name policy_short_name }; |
|
40
|
|
|
|
|
143
|
|
|
40
|
|
|
|
|
4234
|
|
15
|
40
|
|
|
40
|
|
354
|
use Perl::Critic::Exception::Fatal::Internal qw{ throw_internal }; |
|
40
|
|
|
|
|
115
|
|
|
40
|
|
|
|
|
2022
|
|
16
|
40
|
|
|
40
|
|
4120
|
use Perl::Critic::Exception::Configuration::Generic qw{ throw_generic }; |
|
40
|
|
|
|
|
117
|
|
|
40
|
|
|
|
|
973
|
|
17
|
40
|
|
|
40
|
|
4522
|
use Perl::Critic::PolicyConfig; |
|
40
|
|
|
|
|
115
|
|
|
40
|
|
|
|
|
61353
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.146'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
|
25
|
3085
|
|
|
3085
|
1
|
71235
|
my ( $class, %args ) = @_; |
26
|
3085
|
|
|
|
|
9008
|
my $self = bless {}, $class; |
27
|
3085
|
|
|
|
|
13104
|
$self->_init( %args ); |
28
|
3081
|
|
|
|
|
10230
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _init { |
34
|
|
|
|
|
|
|
|
35
|
3085
|
|
|
3085
|
|
7977
|
my ( $self, %args ) = @_; |
36
|
|
|
|
|
|
|
# The profile can be defined, undefined, or an empty string. |
37
|
3085
|
|
66
|
|
|
11299
|
my $profile = $args{-profile} // _find_profile_path(); |
38
|
3085
|
|
|
|
|
10779
|
$self->_load_profile( $profile ); |
39
|
3081
|
|
|
|
|
10840
|
$self->_set_options_processor(); |
40
|
3081
|
|
|
|
|
7174
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub options_processor { |
46
|
|
|
|
|
|
|
|
47
|
23247
|
|
|
23247
|
1
|
37091
|
my ($self) = @_; |
48
|
23247
|
|
|
|
|
67694
|
return $self->{_options_processor}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub policy_params { |
54
|
|
|
|
|
|
|
|
55
|
12362
|
|
|
12362
|
1
|
24351
|
my ( $self, $policy ) = @_; |
56
|
|
|
|
|
|
|
|
57
|
12362
|
|
|
|
|
26998
|
my $short_name = policy_short_name($policy); |
58
|
|
|
|
|
|
|
|
59
|
12362
|
|
|
|
|
30969
|
return Perl::Critic::PolicyConfig->new( |
60
|
|
|
|
|
|
|
$short_name, |
61
|
|
|
|
|
|
|
$self->raw_policy_params($policy), |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub raw_policy_params { |
68
|
|
|
|
|
|
|
|
69
|
12374
|
|
|
12374
|
1
|
21901
|
my ( $self, $policy ) = @_; |
70
|
12374
|
|
|
|
|
23139
|
my $profile = $self->{_profile}; |
71
|
12374
|
|
33
|
|
|
41259
|
my $long_name = ref $policy || policy_long_name( $policy ); |
72
|
12374
|
|
|
|
|
27216
|
my $short_name = policy_short_name( $long_name ); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return |
75
|
|
|
|
|
|
|
$profile->{$short_name} |
76
|
|
|
|
|
|
|
|| $profile->{$long_name} |
77
|
|
|
|
|
|
|
|| $profile->{"-$short_name"} |
78
|
12374
|
|
100
|
|
|
137245
|
|| $profile->{"-$long_name"} |
79
|
|
|
|
|
|
|
|| {}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub policy_is_disabled { |
85
|
|
|
|
|
|
|
|
86
|
10886
|
|
|
10886
|
1
|
20162
|
my ( $self, $policy ) = @_; |
87
|
10886
|
|
|
|
|
18112
|
my $profile = $self->{_profile}; |
88
|
10886
|
|
66
|
|
|
35908
|
my $long_name = ref $policy || policy_long_name( $policy ); |
89
|
10886
|
|
|
|
|
28315
|
my $short_name = policy_short_name( $long_name ); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
return exists $profile->{"-$short_name"} |
92
|
10886
|
|
100
|
|
|
71824
|
|| exists $profile->{"-$long_name"}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub policy_is_enabled { |
98
|
|
|
|
|
|
|
|
99
|
10886
|
|
|
10886
|
1
|
18562
|
my ( $self, $policy ) = @_; |
100
|
10886
|
|
|
|
|
19534
|
my $profile = $self->{_profile}; |
101
|
10886
|
|
66
|
|
|
26227
|
my $long_name = ref $policy || policy_long_name( $policy ); |
102
|
10886
|
|
|
|
|
23462
|
my $short_name = policy_short_name( $long_name ); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return exists $profile->{$short_name} |
105
|
10886
|
|
66
|
|
|
50970
|
|| exists $profile->{$long_name}; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub listed_policies { |
111
|
|
|
|
|
|
|
|
112
|
3076
|
|
|
3076
|
1
|
8595
|
my ( $self, $policy ) = @_; |
113
|
3076
|
|
|
|
|
5500
|
my @normalized_policy_names = (); |
114
|
|
|
|
|
|
|
|
115
|
3076
|
|
|
|
|
5594
|
for my $policy_name ( sort keys %{$self->{_profile}} ) { |
|
3076
|
|
|
|
|
14281
|
|
116
|
1833
|
|
|
|
|
3102
|
$policy_name =~ s/\A - //xmso; #Chomp leading "-" |
117
|
1833
|
|
|
|
|
3376
|
my $policy_long_name = policy_long_name( $policy_name ); |
118
|
1833
|
|
|
|
|
3357
|
push @normalized_policy_names, $policy_long_name; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
3076
|
|
|
|
|
10756
|
return @normalized_policy_names; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub source { |
127
|
37839
|
|
|
37839
|
1
|
57486
|
my ( $self ) = @_; |
128
|
|
|
|
|
|
|
|
129
|
37839
|
|
|
|
|
69185
|
return $self->{_source}; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub _set_source { |
133
|
3
|
|
|
3
|
|
10
|
my ( $self, $source ) = @_; |
134
|
|
|
|
|
|
|
|
135
|
3
|
|
|
|
|
21
|
$self->{_source} = $source; |
136
|
|
|
|
|
|
|
|
137
|
3
|
|
|
|
|
7
|
return; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
141
|
|
|
|
|
|
|
# Begin PRIVATE methods |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Readonly::Hash my %LOADER_FOR => ( |
144
|
|
|
|
|
|
|
ARRAY => \&_load_profile_from_array, |
145
|
|
|
|
|
|
|
DEFAULT => \&_load_profile_from_file, |
146
|
|
|
|
|
|
|
HASH => \&_load_profile_from_hash, |
147
|
|
|
|
|
|
|
SCALAR => \&_load_profile_from_string, |
148
|
|
|
|
|
|
|
); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub _load_profile { |
151
|
|
|
|
|
|
|
|
152
|
3085
|
|
|
3085
|
|
6811
|
my ( $self, $profile ) = @_; |
153
|
|
|
|
|
|
|
|
154
|
3085
|
|
100
|
|
|
13928
|
my $ref_type = ref $profile || 'DEFAULT'; |
155
|
3085
|
|
|
|
|
19911
|
my $loader = $LOADER_FOR{$ref_type}; |
156
|
|
|
|
|
|
|
|
157
|
3085
|
100
|
|
|
|
29034
|
if (not $loader) { |
158
|
1
|
|
|
|
|
17
|
throw_internal qq{Can't load UserProfile from type "$ref_type"}; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
3084
|
|
|
|
|
8573
|
$self->{_profile} = $loader->($self, $profile); |
162
|
3081
|
|
|
|
|
7330
|
return $self; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub _set_options_processor { |
168
|
|
|
|
|
|
|
|
169
|
3081
|
|
|
3081
|
|
6266
|
my ($self) = @_; |
170
|
3081
|
|
|
|
|
5592
|
my $profile = $self->{_profile}; |
171
|
3081
|
|
100
|
|
|
13455
|
my $defaults = delete $profile->{__defaults__} || {}; |
172
|
|
|
|
|
|
|
$self->{_options_processor} = |
173
|
3081
|
|
|
|
|
6395
|
Perl::Critic::OptionsProcessor->new( %{ $defaults } ); |
|
3081
|
|
|
|
|
16081
|
|
174
|
3081
|
|
|
|
|
8696
|
return $self; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub _load_profile_from_file { |
180
|
3027
|
|
|
3027
|
|
6728
|
my ( $self, $file ) = @_; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Handle special cases. |
183
|
3027
|
100
|
|
|
|
8132
|
return {} if not defined $file; |
184
|
2996
|
100
|
|
|
|
8658
|
return {} if $file eq $EMPTY; |
185
|
2993
|
100
|
|
|
|
11338
|
return {} if $file eq 'NONE'; |
186
|
|
|
|
|
|
|
|
187
|
3
|
|
|
|
|
17
|
$self->_set_source( $file ); |
188
|
|
|
|
|
|
|
|
189
|
3
|
|
|
|
|
29
|
my $profile = Config::Tiny->read( $file ); |
190
|
3
|
100
|
|
|
|
3150
|
if (not defined $profile) { |
191
|
1
|
|
|
|
|
6
|
my $errstr = Config::Tiny::errstr(); |
192
|
1
|
|
|
|
|
10
|
throw_generic |
193
|
|
|
|
|
|
|
message => qq{Could not parse profile "$file": $errstr}, |
194
|
|
|
|
|
|
|
source => $file; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
2
|
|
|
|
|
13
|
_fix_defaults_key( $profile ); |
198
|
|
|
|
|
|
|
|
199
|
2
|
|
|
|
|
7
|
return $profile; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub _load_profile_from_array { |
205
|
1
|
|
|
1
|
|
8
|
my ( $self, $array_ref ) = @_; |
206
|
1
|
|
|
|
|
2
|
my $joined = join qq{\n}, @{ $array_ref }; |
|
1
|
|
|
|
|
5
|
|
207
|
1
|
|
|
|
|
11
|
my $profile = Config::Tiny->read_string( $joined ); |
208
|
|
|
|
|
|
|
|
209
|
1
|
50
|
|
|
|
107
|
if (not defined $profile) { |
210
|
0
|
|
|
|
|
0
|
throw_generic 'Profile error: ' . Config::Tiny::errstr(); |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
1
|
|
|
|
|
5
|
_fix_defaults_key( $profile ); |
214
|
|
|
|
|
|
|
|
215
|
1
|
|
|
|
|
4
|
return $profile; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub _load_profile_from_string { |
221
|
5
|
|
|
5
|
|
16
|
my ( $self, $string ) = @_; |
222
|
5
|
|
|
|
|
11
|
my $profile = Config::Tiny->read_string( ${ $string } ); |
|
5
|
|
|
|
|
39
|
|
223
|
|
|
|
|
|
|
|
224
|
5
|
100
|
|
|
|
19349
|
if (not defined $profile) { |
225
|
2
|
|
|
|
|
8
|
throw_generic 'Profile error: ' . Config::Tiny::errstr(); |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
3
|
|
|
|
|
14
|
_fix_defaults_key( $profile ); |
229
|
|
|
|
|
|
|
|
230
|
3
|
|
|
|
|
9
|
return $profile; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub _load_profile_from_hash { |
236
|
51
|
|
|
51
|
|
218
|
my ( $self, $hash_ref ) = @_; |
237
|
51
|
|
|
|
|
201
|
return $hash_ref; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub _find_profile_path { |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
#Check explicit environment setting |
245
|
1
|
50
|
|
1
|
|
2230
|
return $ENV{PERLCRITIC} if exists $ENV{PERLCRITIC}; |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
#Define default filename |
248
|
0
|
|
|
|
|
0
|
my $rc_file = '.perlcriticrc'; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
#Check current directory |
251
|
0
|
0
|
|
|
|
0
|
return $rc_file if -f $rc_file; |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
#Check home directory |
254
|
0
|
0
|
|
|
|
0
|
if ( my $home_dir = _find_home_dir() ) { |
255
|
0
|
|
|
|
|
0
|
my $path = File::Spec->catfile( $home_dir, $rc_file ); |
256
|
0
|
0
|
|
|
|
0
|
return $path if -f $path; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
#No profile defined |
260
|
0
|
|
|
|
|
0
|
return; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub _find_home_dir { |
266
|
|
|
|
|
|
|
# This logic is taken from File::HomeDir::Tiny. |
267
|
|
|
|
|
|
|
return |
268
|
|
|
|
|
|
|
($^O eq 'MSWin32') && ("$]" < 5.016) ## no critic ( Variables::ProhibitPunctuationVars ValuesAndExpressions::ProhibitMagicNumbers ValuesAndExpressions::ProhibitMismatchedOperators ) |
269
|
|
|
|
|
|
|
? ($ENV{HOME} || $ENV{USERPROFILE}) |
270
|
0
|
0
|
0
|
0
|
|
0
|
: (<~>)[0]; |
|
|
|
0
|
|
|
|
|
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
# !$%@$%^ Config::Tiny uses a completely non-descriptive name for global |
276
|
|
|
|
|
|
|
# values. |
277
|
|
|
|
|
|
|
sub _fix_defaults_key { |
278
|
6
|
|
|
6
|
|
16
|
my ( $profile ) = @_; |
279
|
|
|
|
|
|
|
|
280
|
6
|
|
|
|
|
17
|
my $defaults = delete $profile->{_}; |
281
|
6
|
100
|
|
|
|
58
|
if ($defaults) { |
282
|
3
|
|
|
|
|
12
|
$profile->{__defaults__} = $defaults; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
6
|
|
|
|
|
13
|
return; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
1; |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
__END__ |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=pod |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=for stopwords UserProfile |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head1 NAME |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Perl::Critic::UserProfile - The contents of the user's profile, often F<.perlcriticrc>. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 DESCRIPTION |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
This is a helper class that encapsulates the contents of the user's |
306
|
|
|
|
|
|
|
profile, which is usually stored in a F<.perlcriticrc> file. There are |
307
|
|
|
|
|
|
|
no user-serviceable parts here. |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=head1 INTERFACE SUPPORT |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
This is considered to be a non-public class. Its interface is subject |
313
|
|
|
|
|
|
|
to change without notice. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=over |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=item C< new( -profile => $p ) > |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
B<-profile> is the path to the user's profile. If -profile is not |
323
|
|
|
|
|
|
|
defined, then it looks for the profile at F<./.perlcriticrc> and then |
324
|
|
|
|
|
|
|
F<$HOME/.perlcriticrc>. If neither of those files exists, then the |
325
|
|
|
|
|
|
|
UserProfile is created with default values. |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
This object does not take into account any command-line overrides; |
328
|
|
|
|
|
|
|
L<Perl::Critic::Config|Perl::Critic::Config> does that. |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=back |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=head1 METHODS |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=over |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=item C< options_processor() > |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
Returns the |
341
|
|
|
|
|
|
|
L<Perl::Critic::OptionsProcessor|Perl::Critic::OptionsProcessor> |
342
|
|
|
|
|
|
|
object for this UserProfile. |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=item C< policy_is_disabled( $policy ) > |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
Given a reference to a L<Perl::Critic::Policy|Perl::Critic::Policy> |
348
|
|
|
|
|
|
|
object or the name of one, returns true if the user has disabled that |
349
|
|
|
|
|
|
|
policy in their profile. |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=item C< policy_is_enabled( $policy ) > |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Given a reference to a L<Perl::Critic::Policy|Perl::Critic::Policy> |
355
|
|
|
|
|
|
|
object or the name of one, returns true if the user has explicitly |
356
|
|
|
|
|
|
|
enabled that policy in their user profile. |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=item C< policy_params( $policy ) > |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
Given a reference to a L<Perl::Critic::Policy|Perl::Critic::Policy> |
362
|
|
|
|
|
|
|
object or the name of one, returns a |
363
|
|
|
|
|
|
|
L<Perl::Critic::PolicyConfig|Perl::Critic::PolicyConfig> for the |
364
|
|
|
|
|
|
|
user's configuration parameters for that policy. |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item C< raw_policy_params( $policy ) > |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Given a reference to a L<Perl::Critic::Policy|Perl::Critic::Policy> |
370
|
|
|
|
|
|
|
object or the name of one, returns a reference to a hash of the user's |
371
|
|
|
|
|
|
|
configuration parameters for that policy. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=item C< listed_policies() > |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
Returns a list of the names of all the Policies that are mentioned in |
377
|
|
|
|
|
|
|
the profile. The Policy names will be fully qualified (e.g. |
378
|
|
|
|
|
|
|
Perl::Critic::Foo). |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=item C< source() > |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
The place where the profile information came from, if available. |
384
|
|
|
|
|
|
|
Usually the path to a F<.perlcriticrc>. |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=back |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=head1 SEE ALSO |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
L<Perl::Critic::Config|Perl::Critic::Config>, |
393
|
|
|
|
|
|
|
L<Perl::Critic::OptionsProcessor|Perl::Critic::OptionsProcessor> |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=head1 AUTHOR |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head1 COPYRIGHT |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
406
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
407
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=cut |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
# Local Variables: |
412
|
|
|
|
|
|
|
# mode: cperl |
413
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
414
|
|
|
|
|
|
|
# fill-column: 78 |
415
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
416
|
|
|
|
|
|
|
# c-indentation-style: bsd |
417
|
|
|
|
|
|
|
# End: |
418
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |