Benchmark-Perl-Formance-Cargo
view release on metacpan or search on metacpan
share/PerlCritic/Critic/Config.pm view on Meta::CPAN
Returns the value of the C<-program_extensions> attribute for this Config, as
an array of case-sensitive regexes matching the ends of the file names that
represent program files.
=back
=head1 SUBROUTINES
Perl::Critic::Config has a few static subroutines that are used
internally, but may be useful to you in some way.
=over
=item C<site_policy_names()>
Returns a list of all the Policy modules that are currently installed
in the Perl::Critic:Policy namespace. These will include modules that
are distributed with Perl::Critic plus any third-party modules that
have been installed.
=back
=head1 CONFIGURATION
Most of the settings for Perl::Critic and each of the Policy modules
can be controlled by a configuration file. The default configuration
file is called F<.perlcriticrc>.
L<Perl::Critic::Config|Perl::Critic::Config> will look for this file
in the current directory first, and then in your home directory.
Alternatively, you can set the C<PERLCRITIC> environment variable to
explicitly point to a different file in another location. If none of
these files exist, and the C<-profile> option is not given to the
constructor, then all Policies will be loaded with their default
configuration.
The format of the configuration file is a series of INI-style blocks
that contain key-value pairs separated by '='. Comments should start
with '#' and can be placed on a separate line or after the name-value
pairs if you desire.
Default settings for Perl::Critic itself can be set B<before the first
named block.> For example, putting any or all of these at the top of
your configuration file will set the default value for the
corresponding Perl::Critic constructor argument.
severity = 3 #Integer from 1 to 5
only = 1 #Zero or One
force = 0 #Zero or One
verbose = 4 #Integer or format spec
top = 50 #A positive integer
theme = risky + (pbp * security) - cosmetic #A theme expression
include = NamingConventions ClassHierarchies #Space-delimited list
exclude = Variables Modules::RequirePackage #Space-delimited list
color = 1 #Zero or One
allow_unsafe = 1 #Zero or One
color-severity-highest = bold red #Term::ANSIColor
color-severity-high = magenta #Term::ANSIColor
color-severity-medium = #no coloring
color-severity-low = #no coloring
color-severity-lowest = #no coloring
program-extensions = #Space-delimited list
The remainder of the configuration file is a series of blocks like
this:
[Perl::Critic::Policy::Category::PolicyName]
severity = 1
set_themes = foo bar
add_themes = baz
arg1 = value1
arg2 = value2
C<Perl::Critic::Policy::Category::PolicyName> is the full name of a
module that implements the policy. The Policy modules distributed
with Perl::Critic have been grouped into categories according to the
table of contents in Damian Conway's book B<Perl Best Practices>. For
brevity, you can omit the C<'Perl::Critic::Policy'> part of the module
name.
C<severity> is the level of importance you wish to assign to the
Policy. All Policy modules are defined with a default severity value
ranging from 1 (least severe) to 5 (most severe). However, you may
disagree with the default severity and choose to give it a higher or
lower severity, based on your own coding philosophy.
The remaining key-value pairs are configuration parameters that will
be passed into the constructor of that Policy. The constructors for
most Policy modules do not support arguments, and those that do should
have reasonable defaults. See the documentation on the appropriate
Policy module for more details.
Instead of redefining the severity for a given Policy, you can
completely disable a Policy by prepending a '-' to the name of the
module in your configuration file. In this manner, the Policy will
never be loaded, regardless of the C<-severity> given to the
Perl::Critic::Config constructor.
A simple configuration might look like this:
#--------------------------------------------------------------
# I think these are really important, so always load them
[TestingAndDebugging::RequireUseStrict]
severity = 5
[TestingAndDebugging::RequireUseWarnings]
severity = 5
#--------------------------------------------------------------
# I think these are less important, so only load when asked
[Variables::ProhibitPackageVars]
severity = 2
[ControlStructures::ProhibitPostfixControls]
allow = if unless #My custom configuration
( run in 0.562 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )