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-2020 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 [-Freenode::EmptyReturn]
72
73 # The default of 9 is too small and forces weird code contortions.
74 [InputOutput::RequireBriefOpen]
75 lines = 25
76
77 # This is correct 80% of the time, but it isn't correct for a lot of scripts
78 # inside packages, where maintaining $VERSION isn't worth the effort.
79 # Unfortunately, there's no way to override it, so it gets turned off
80 # globally.
81 [-Modules::RequireVersionVar]
82
83 # This sounds interesting but is actually useless. Any large blocks of
84 # literal text, which does not add to the complexity of the regex, will set it
85 # off.
86 [-RegularExpressions::ProhibitComplexRegexes]
87
88 # Produces false positives currently with postfix dereferencing (introduced in
89 # Perl 5.20). See https://github.com/Perl-Critic/Perl-Critic/issues/578.
90 [-References::ProhibitDoubleSigils]
91
92 # I generally don't want to require Readonly as a prerequisite for all my Perl
93 # modules.
94 [-ValuesAndExpressions::ProhibitConstantPragma]
95
96 # A good idea, but there are too many places where this would be more
97 # confusing than helpful. Pull out numbers if one might change them
98 # independent of the algorithm, but don't do so for mathematical formulae.
99 [-ValuesAndExpressions::ProhibitMagicNumbers]
100
101 # Increase this to six digits so that I'm not told to add underscores to
102 # port numbers (which is just silly).
103 [ValuesAndExpressions::RequireNumberSeparators]
104 min_value = 100000
105
106 # IO::Uncompress::Gunzip puts the error message in a package variable.
107 # Text::Wrap has a broken interface that requires use of package variables.
108 [Variables::ProhibitPackageVars]
109 add_packages = IO::Uncompress::Gunzip Text::Wrap
110
111 # use English was one of the worst ideas in the history of Perl. It makes the
112 # code slightly more readable for amateurs at the cost of confusing
113 # experienced Perl programmers and sending people in futile quests for where
114 # these magical global variables are defined.
115 [-Variables::ProhibitPunctuationVars]