blib/lib/Perl/Critic/Utils/Constants.pm

filter: Statementstmt 100% 34 / 34 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 40 / 40 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Perl/Critic/Exception/Parse.pm ↑ Summary blib/lib/Perl/Critic/Utils/Perl.pm »
1 package Perl::Critic::Utils::Constants;
2  
3 40 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 40 ▶use Perl::Critic::Utils qw{ $EMPTY hashify };
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 40 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 40 our $VERSION = '1.150';
13  
14 #-----------------------------------------------------------------------------
15  
16 40 our @EXPORT_OK = qw{
17 $PROFILE_STRICTNESS_WARN
18 $PROFILE_STRICTNESS_FATAL
19 $PROFILE_STRICTNESS_QUIET
20 $PROFILE_STRICTNESS_DEFAULT
21 %PROFILE_STRICTNESSES
22 $PROFILE_COLOR_SEVERITY_HIGHEST_DEFAULT
23 $PROFILE_COLOR_SEVERITY_HIGH_DEFAULT
24 $PROFILE_COLOR_SEVERITY_MEDIUM_DEFAULT
25 $PROFILE_COLOR_SEVERITY_LOW_DEFAULT
26 $PROFILE_COLOR_SEVERITY_LOWEST_DEFAULT
27 $_MODULE_VERSION_TERM_ANSICOLOR
28 @STRICT_EQUIVALENT_MODULES
29 @WARNINGS_EQUIVALENT_MODULES
30 };
31  
32 40 our %EXPORT_TAGS = (
33 all => \@EXPORT_OK,
34 profile_strictness => [
35 qw{
36 $PROFILE_STRICTNESS_WARN
37 $PROFILE_STRICTNESS_FATAL
38 $PROFILE_STRICTNESS_QUIET
39 $PROFILE_STRICTNESS_DEFAULT
40 %PROFILE_STRICTNESSES
41 }
42 ],
43 color_severity => [
44 qw{
45 $PROFILE_COLOR_SEVERITY_HIGHEST_DEFAULT
46 $PROFILE_COLOR_SEVERITY_HIGH_DEFAULT
47 $PROFILE_COLOR_SEVERITY_MEDIUM_DEFAULT
48 $PROFILE_COLOR_SEVERITY_LOW_DEFAULT
49 $PROFILE_COLOR_SEVERITY_LOWEST_DEFAULT
50 }
51 ],
52 equivalent_modules => [
53 qw{
54 @STRICT_EQUIVALENT_MODULES
55 @WARNINGS_EQUIVALENT_MODULES
56 }
57 ],
58 );
59  
60 #-----------------------------------------------------------------------------
61  
62 40 Readonly::Scalar our $PROFILE_STRICTNESS_WARN => 'warn';
63 40 Readonly::Scalar our $PROFILE_STRICTNESS_FATAL => 'fatal';
64 40 Readonly::Scalar our $PROFILE_STRICTNESS_QUIET => 'quiet';
65 40 Readonly::Scalar our $PROFILE_STRICTNESS_DEFAULT => $PROFILE_STRICTNESS_WARN;
66  
67 40 Readonly::Hash our %PROFILE_STRICTNESSES =>
68 hashify(
69 $PROFILE_STRICTNESS_WARN,
70 $PROFILE_STRICTNESS_FATAL,
71 $PROFILE_STRICTNESS_QUIET,
72 );
73  
74 40 Readonly::Scalar our $PROFILE_COLOR_SEVERITY_HIGHEST_DEFAULT => 'bold red';
75 40 Readonly::Scalar our $PROFILE_COLOR_SEVERITY_HIGH_DEFAULT => 'magenta';
76 40 Readonly::Scalar our $PROFILE_COLOR_SEVERITY_MEDIUM_DEFAULT => $EMPTY;
77 40 Readonly::Scalar our $PROFILE_COLOR_SEVERITY_LOW_DEFAULT => $EMPTY;
78 40 Readonly::Scalar our $PROFILE_COLOR_SEVERITY_LOWEST_DEFAULT => $EMPTY;
79  
80 # If the following changes, the corresponding change needs to be made in
81 # inc/Perl/Critic/BuildUtilities.pm, sub recommended_module_versions().
82 40 Readonly::Scalar our $_MODULE_VERSION_TERM_ANSICOLOR => 2.02;
83  
84 40 Readonly::Array our @STRICT_EQUIVALENT_MODULES => qw(
85 Mo
86  
87 Moo
88 Moo::Role
89  
90 Moose
91 Moose::Role
92 Moose::Exporter
93 Moose::Util::TypeConstraints
94 Test::Class::Moose
95  
96 MooseX::NonMoose
97 MooseX::Singleton
98 MooseX::Role::Parameterized
99 MooseX::MethodAttributes::Role
100  
101 Mouse
102 Mouse::Role
103 Mouse::Exporter
104 Mouse::Util
105 Mouse::Util::TypeConstraints
106  
107 Moos
108  
109 Mousse
110  
111 Any::Moose
112  
113 Modern::Perl
114  
115 Dancer
116 Dancer2
117  
118 Mojolicious::Lite
119 Mojo::Base
120  
121 Object::Simple
122  
123 Role::Tiny
124  
125 Test::Spec
126  
127 sane
128 strictures
129 );
130  
131 # Such modules tend to inflict both strictures and warnings, so for
132 # the moment these equivalent module lists are exactly the same.
133 40 Readonly::Array our @WARNINGS_EQUIVALENT_MODULES
134 => @STRICT_EQUIVALENT_MODULES;
135  
136 #-----------------------------------------------------------------------------
137  
138 40 1;
139  
140 __END__
141  
142 #-----------------------------------------------------------------------------
143  
144 =pod
145  
146 =for stopwords
147  
148 =head1 NAME
149  
150 Perl::Critic::Utils::Constants - Global constants.
151  
152 =head1 DESCRIPTION
153  
154 Defines commonly used constants for L<Perl::Critic|Perl::Critic>.
155  
156  
157 =head1 INTERFACE SUPPORT
158  
159 This is considered to be a public module. Any changes to its
160 interface will go through a deprecation cycle.
161  
162  
163 =head1 IMPORTABLE CONSTANTS
164  
165 =over
166  
167 =item C<$PROFILE_STRICTNESS_WARN>
168  
169 =item C<$PROFILE_STRICTNESS_FATAL>
170  
171 =item C<$PROFILE_STRICTNESS_QUIET>
172  
173 =item C<$PROFILE_STRICTNESS_DEFAULT>
174  
175 =item C<%PROFILE_STRICTNESSES>
176  
177 Valid values for the L<perlcritic/"-profile-strictness"> option.
178 Determines whether recoverable problems found in a profile file appear
179 as warnings, are fatal, or are ignored.
180 C<$PROFILE_STRICTNESS_DEFAULT> is set to C<$PROFILE_STRICTNESS_WARN>.
181 Importable via the C<:profile_strictness> tag.
182  
183  
184 =item C<$PROFILE_COLOR_SEVERITY_HIGHEST_DEFAULT>
185  
186 Default for the -color-severity-highest option. Importable via the
187 C<:color_severity> tag.
188  
189 =item C<$PROFILE_COLOR_SEVERITY_HIGH_DEFAULT>
190  
191 Default for the -color-severity-high option. Importable via the
192 C<:color_severity> tag.
193  
194 =item C<$PROFILE_COLOR_SEVERITY_MEDIUM_DEFAULT>
195  
196 Default for the -color-severity-medium option. Importable via the
197 C<:color_severity> tag.
198  
199 =item C<$PROFILE_COLOR_SEVERITY_LOW_DEFAULT>
200  
201 Default for the -color-severity-low option. Importable via the
202 C<:color_severity> tag.
203  
204 =item C<$PROFILE_COLOR_SEVERITY_LOWEST_DEFAULT>
205  
206 Default for the -color-severity-lowest option. Importable via the
207 C<:color_severity> tag.
208  
209 =item C<@STRICT_EQUIVALENT_MODULES>
210  
211 =item C<@WARNINGS_EQUIVALENT_MODULES>
212  
213 As the names suggest, these are lists of modules that are equivalent to
214 applying the L<strict|strict> or L<warnings|warnings> pragma when loaded. At
215 the moment, both lists are exactly the same. B<Note:> These lists are not
216 exhaustive; they only include the most commonly used modules. Policies that
217 use these lists should permit configuration of additional modules.
218  
219 =back
220  
221  
222 =head1 AUTHOR
223  
224 Elliot Shank <perl@galumph.com>
225  
226  
227 =head1 COPYRIGHT
228  
229 Copyright (c) 2007-2011 Elliot Shank.
230  
231 This program is free software; you can redistribute it and/or modify
232 it under the same terms as Perl itself. The full text of this license
233 can be found in the LICENSE file included with this module.
234  
235 =cut
236  
237 # Local Variables:
238 # mode: cperl
239 # cperl-indent-level: 4
240 # fill-column: 78
241 # indent-tabs-mode: nil
242 # c-indentation-style: bsd
243 # End:
244 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
« blib/lib/Perl/Critic/Exception/Parse.pm ↑ Summary blib/lib/Perl/Critic/Utils/Perl.pm »