NAME
App::perl::distrolint::Config - configuration management for App::perl::distrolint
SYNOPSIS
$ cat distrolint.ini
[check Pod]
enabled = false
use App::perl::distrolint::Check;
if( App::perl::distrolint::Config->is_check_enabled( "Foo", 1 ) ) {
say "The 'Foo' check is enabled";
}
DESCRIPTION
This module manages reading of config files that configure how the App::perl::distrolint checks behave. On first use, it reads distrolint.ini files found in various places and stores the configuration found there. Package methods allow modules to query that stored configuration.
There are two locations that files may be found. First is a distrolint.ini file in the current working directory; presumed to be the root directory of a distribution source code. The second is $HOME/.config/distrolint.ini in the user's home directory, for storing user-wide configuration.
Each file should be in ini format, with sections named for each check type, using a section marker like [check Name]. Values that are literal true or false strings are converted into suitable boolean values; everything else is taken literally.
Certain configuration keys are pre-defined as standard; individual check modules may document other keys that are specific to that check.
Standard Configuration
enabled-
A boolean that enables or disables that check module entirely.
skip-
A space-separated list of glob patterns. Files which match any of these patterns will be skipped by checks that would otherwise iterate over all source files of a certain type.
A glob metacharacter of
*will only match parts of a path within a directory; use**to match subdirectories also.
METHODS
check_config
$value = App::perl::distrolint::Config->check_config( $name, $key, $default );
Returns the value of a configuration key from the [check $name] section of the configuration file. If no entry exists, the value of $default is returned instead.
$name may be given as a literal string, or as an object reference to the check object itself (often $self will suffice).
is_check_enabled
$enabled = App::perl::distrolint::Config->is_check_enabled( $name, $default = true );
Returns true if the check is enabled (or at least, has not been specifically disabled), or false if a configuration file has specifically disabled this check.
By default, all checks are enabled.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>