Manual Reference Pages - PERL::CRITIC::POLICY::DOCUMENTATION::PROHIBITDUPLICATEHEADINGS (3)
Perl::Critic::Policy::Documentation::ProhibitDuplicateHeadings - dont duplicate =head names
This policy is part of the Perl::Critic::Pulp
add-on. It asks you not to duplicate heading names in =head POD
=head1 SOMETHING # bad, duplicate
Duplication is usually a mistake, perhaps too much cut-and-paste, or a
leftover from a template, or perhaps text in two places which ought to be
together. On that basis this policy is under the bugs theme (see
POLICY THEMES in Perl::Critic) and medium severity.
The policy default is to demand that a given heading is unique to its
ancestors, siblings, and to the immediately adjacent heading irrespective of
level. This is designed to be how human readers perceive the scope of
headings and subheadings, plus adjacency in case a mixture of heading levels
would let a duplicate otherwise go undetected. For example
=head3 Top # bad, duplicates its ancestor head1
=head2 Down # bad, duplicates sibling head2
=head1 Blah # bad, duplicates adjacent
A subheading can be repeated if its under a different higher heading. For
example the following two Details are cousins, so allowed.
=head2 Details # ok
Option uniqueness=all (see CONFIGURATION below) applies a stricter
rule so that all =head names must be unique throughout the document,
irrespective of levels and structure.
=head3 Foo # bad
One use for this is to ensure all headings can be reached by an
L<> link. An L<> only has the heading name, no level
or path, so if theres any duplication among the names then only the first
of each duplicate will be reachable. (The POD browsers usually go to the
first among duplicates.)
This rule is often too strict. It can be good to have similar subheadings
like Details as shown above, with no need to make such sub-parts reachable
by a link.
If you dont care at all about this you can disable
ProhibitDuplicateHeadings from your .perlcriticrc in the usual way (see
CONFIGURATION in Perl::Critic),
uniqueness (string, default default)
The uniqueness to be enforced on each heading. The value is a
comma-separated list of
default currently "ancestor,sibling,adjacent"
ancestor dont duplicate parent, grandparent, etc
sibling same level and parent
adjacent immediately preceding, irrespective of level
all all headings
The default is default and the intention is to have default mean a
sensible set of restrictions, though precisely what it might be could
For example in your .perlcriticrc file
Copyright 2013, 2014, 2015 Kevin Ryde
Perl-Critic-Pulp is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
Perl-Critic-Pulp is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
You should have received a copy of the GNU General Public License along with
Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>.
|perl v5.20.3 ||PERL::CRITIC::POLICY::DOCUMENTATION::PROHIBITDUPLICATEHEADINGS (3) ||2015-01-04 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.