Debian Codegraph @

t/data/perlcriticrc

raw
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 <[email protected]>
13 # Copyright 2018-2021 Russ Allbery <[email protected]>
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
37 severity = 1
38 verbose = %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 recommends using given/when, but Perl has marked those as experimental
46 # and cautions against using when.
47 [-ControlStructures::ProhibitCascadingIfElse]
48
49 # Stanford's coding style allows postfix unless for flow control. There
50 # doesn't appear to be any way to allow it only for flow control (the logic
51 # for "if" and "when" appears to be special-cased), so we have to allow unless
52 # globally.
53 [ControlStructures::ProhibitPostfixControls]
54 allow = unless
55
56 # This is handled with a separate test case that uses Test::Spelling.
57 [-Documentation::PodSpelling]
58
59 # The POD sections Perl::Critic wants are incompatible with the POD template
60 # from perlpodstyle, which is what I use for my POD documentation.
61 [-Documentation::RequirePodSections]
62
63 # This problem was fixed in Perl 5.14, which now properly preserves the value
64 # of $@ even if destructors run at exit from the eval block.
65 [-ErrorHandling::RequireCheckingReturnValueOfEval]
66
67 # This conflicts with Subroutines::ProhibitExplicitReturnUndef and
68 # Subroutines::RequireFinalReturn, and I prefer the brevity of the simple
69 # return statement. I don't think the empty list versus undef behavior is
70 # that confusing.
71 #
72 # This has been renamed to Community::EmptyReturn, but excluding it by that
73 # name produces a warning on systems that only have the older version of the
74 # package. This is handled in t/style/critic.t specially.
75 [-Freenode::EmptyReturn]
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 # I generally don't want to require Readonly as a prerequisite for all my Perl
97 # modules.
98 [-ValuesAndExpressions::ProhibitConstantPragma]
99
100 # A good idea, but there are too many places where this would be more
101 # confusing than helpful. Pull out numbers if one might change them
102 # independent of the algorithm, but don't do so for mathematical formulae.
103 [-ValuesAndExpressions::ProhibitMagicNumbers]
104
105 # This has never triggered on anything useful and keeps telling me to add
106 # underscores to UNIX timestamps and port numbers, which is just silly.
107 [-ValuesAndExpressions::RequireNumberSeparators]
108
109 # IO::Uncompress::Gunzip puts the error message in a package variable.
110 # Text::Wrap has a broken interface that requires use of package variables.
111 # YAML::XS also cannot be configured without package variables.
112 [Variables::ProhibitPackageVars]
113 add_packages = IO::Uncompress::Gunzip Text::Wrap YAML::XS
114
115 # use English was one of the worst ideas in the history of Perl. It makes the
116 # code slightly more readable for amateurs at the cost of confusing
117 # experienced Perl programmers and sending people in futile quests for where
118 # these magical global variables are defined.
119 [-Variables::ProhibitPunctuationVars]