xref: /openbsd-src/gnu/usr.bin/perl/cpan/podlators/t/data/perlcriticrc (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
1# -*- conf -*-
2#
3# Default configuration for perlcritic.  Be sure to copy this into the source
4# for packages that run perlcritic tests automatically during the build for
5# reproducible test results.
6#
7# This file has been updated to match perlcritic 1.134.
8#
9# The canonical version of this file is maintained in the rra-c-util package,
10# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
11#
12# Written by Russ Allbery <eagle@eyrie.org>
13# Copyright 2018-2022 Russ Allbery <eagle@eyrie.org>
14# Copyright 2011-2013
15#     The Board of Trustees of the Leland Stanford Junior University
16#
17# Permission is hereby granted, free of charge, to any person obtaining a
18# copy of this software and associated documentation files (the "Software"),
19# to deal in the Software without restriction, including without limitation
20# the rights to use, copy, modify, merge, publish, distribute, sublicense,
21# and/or sell copies of the Software, and to permit persons to whom the
22# Software is furnished to do so, subject to the following conditions:
23#
24# The above copyright notice and this permission notice shall be included in
25# all copies or substantial portions of the Software.
26#
27# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
30# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
32# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
33# DEALINGS IN THE SOFTWARE.
34#
35# SPDX-License-Identifier: MIT
36
37severity = 1
38verbose  = %f:%l:%c: [%p] %m (%e, Severity: %s)\n
39
40# I prefer this policy (a lot, actually), but other people in my group at
41# Stanford really didn't like it, so this is my compromise to agree with a
42# group coding style.
43[-CodeLayout::ProhibitParensWithBuiltins]
44
45# This conflicts with Subroutines::ProhibitExplicitReturnUndef and
46# Subroutines::RequireFinalReturn, and I prefer the brevity of the simple
47# return statement.  I don't think the empty list versus undef behavior is
48# that confusing.
49#
50# This should be Community::EmptyReturn, which is the new name of the module,
51# but currently ignores have to use the Freenode::EmptyReturn name instead.
52[-Community::EmptyReturn]
53[-Freenode::EmptyReturn]
54
55# This recommends using given/when, but Perl has marked those as experimental
56# and cautions against using when.
57[-ControlStructures::ProhibitCascadingIfElse]
58
59# Stanford's coding style allows postfix unless for flow control.  There
60# doesn't appear to be any way to allow it only for flow control (the logic
61# for "if" and "when" appears to be special-cased), so we have to allow unless
62# globally.
63[ControlStructures::ProhibitPostfixControls]
64allow = unless
65
66# This is handled with a separate test case that uses Test::Spelling.
67[-Documentation::PodSpelling]
68
69# The POD sections Perl::Critic wants are incompatible with the POD template
70# from perlpodstyle, which is what I use for my POD documentation.
71[-Documentation::RequirePodSections]
72
73# This problem was fixed in Perl 5.14, which now properly preserves the value
74# of $@ even if destructors run at exit from the eval block.
75[-ErrorHandling::RequireCheckingReturnValueOfEval]
76
77# The default of 9 is too small and forces weird code contortions.  After some
78# experimentation, I've never found this helpful in driving useful refactors.
79[-InputOutput::RequireBriefOpen]
80
81# This is correct 80% of the time, but it isn't correct for a lot of scripts
82# inside packages, where maintaining $VERSION isn't worth the effort.
83# Unfortunately, there's no way to override it, so it gets turned off
84# globally.
85[-Modules::RequireVersionVar]
86
87# This sounds interesting but is actually useless.  Any large blocks of
88# literal text, which does not add to the complexity of the regex, will set it
89# off.
90[-RegularExpressions::ProhibitComplexRegexes]
91
92# Produces false positives currently with postfix dereferencing (introduced in
93# Perl 5.20).  See https://github.com/Perl-Critic/Perl-Critic/issues/578.
94[-References::ProhibitDoubleSigils]
95
96# Five arguments to a method has seemed reasonable at least once: a pair of
97# input file data and path, a pair of output file descriptor and path, and
98# a dict of additional arguments.
99[Subroutines::ProhibitManyArgs]
100skip_object = 1
101
102# I generally don't want to require Readonly as a prerequisite for all my Perl
103# modules.
104[-ValuesAndExpressions::ProhibitConstantPragma]
105
106# A good idea, but there are too many places where this would be more
107# confusing than helpful.  Pull out numbers if one might change them
108# independent of the algorithm, but don't do so for mathematical formulae.
109[-ValuesAndExpressions::ProhibitMagicNumbers]
110
111# This has never triggered on anything useful and keeps telling me to add
112# underscores to UNIX timestamps and port numbers, which is just silly.
113[-ValuesAndExpressions::RequireNumberSeparators]
114
115# IO::Uncompress::Gunzip puts the error message in a package variable.
116# Text::Wrap has a broken interface that requires use of package variables.
117# YAML::XS also cannot be configured without package variables.
118[Variables::ProhibitPackageVars]
119add_packages = IO::Uncompress::Gunzip Text::Wrap YAML::XS
120
121# use English was one of the worst ideas in the history of Perl.  It makes the
122# code slightly more readable for amateurs at the cost of confusing
123# experienced Perl programmers and sending people in futile quests for where
124# these magical global variables are defined.
125[-Variables::ProhibitPunctuationVars]
126