NAME

Dist::Conformance::Check::CriticProfile - The perlcritic profile enables or turns off every policy of its template

VERSION

version 0.002

DESCRIPTION

A profile is compared with its template by the policies that each names. Both are read as Perl::Critic reads a profile, with Config::Tiny: each section [Name] enables the policy Name, a section [-Name] turns it off, and the keys before the first section are global settings. A name with the prefix Perl::Critic::Policy:: is the same policy as the name without it.

The check passes when the file names each policy that the template enables, either as [Name], which enables it, or as [-Name], which turns it off on purpose. It fails when the file is missing, when it does not parse, and when it does not name a policy that the template enables. The detail names each such policy. So when the template gains a policy, every profile that does not have it yet fails, by the name of that policy.

What else the file says is the distribution's own business, and does not change the result:

the parameters of a policy

A policy that the template configures, and the file configures differently or not at all, is there. An exemption or a threshold of its own is a choice of the distribution, not a policy that it lacks.

a policy that the template does not enable

A policy of the distribution's own, or one that the template has dropped or turns off, can stay.

the global settings and the comments

The first line among them, so a header says nothing about whether a profile is current.

The update writes the template when the file is missing. A profile that is there usually has changes of its own, such as exemptions, so it is replaced only when replace is true; otherwise the update names the policies to add by hand.

METHODS

missing_policies

($text). The sorted names of the policies that the template enables and the profile $text does not name. Dies when either does not parse.

verdict

($text). The status and the detail of the profile $text, as check returns them, and for a failure, what a person must do to fix it by hand.

check

update

Writes the template when the profile is missing, or when it is not current and replace is true. Otherwise names what to add by hand.

FUNCTIONS

policies

($text, $where). The policies of the profile $text, as a hash reference from the short name of each to enabled or disabled. Dies, naming $where, when Perl::Critic could not parse the text either.

lacks

(@missing). The detail for a profile that lacks the policies @missing, without the template.

IN A FLAVOR

checks:
  CriticProfile:
    file: .perlcriticrc
    template: templates/perlcriticrc
    replace: false

CONFIGURATION

file

Required. The path of the profile.

template

Required. The template of the current profile.

replace

Whether an update overwrites a profile that is not current. Default false.

outdated

Deprecated, and ignored. Each named a first line to compare, which the check no longer does. They are accepted so that a flavor that names them still loads.

SEE ALSO

Please see those modules/websites for more information related to this module.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/Dist-Conformance/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHORS

Current Maintainers:

  • George S. Baugh <george@troglodyne.net>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Troglodyne LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.