summaryrefslogtreecommitdiffstats
path: root/t/critic/perlcriticrc
blob: 6bdebc0d23ef6ba57a7583ff64a81a38e2ddda73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
## Perl Critic configuration file
severity = 1
verbose = %f %l:%c (Severity: %s)\n  %P (%s)\n  near '%r'\n%d\n
program-extensions = .pl .t

##
## Tune tests
##

[Documentation::RequirePodSections]
lib_sections = NAME | DESCRIPTION | CHANGES
script_sections = NAME | SYNOPSIS | DESCRIPTION

[InputOutput::ProhibitBacktickOperators]
# TODO: Add new Dpkg::Program module and switch those to it ?
only_in_void_context = 1

[NamingConventions::ProhibitAmbiguousNames]
# Allow set(), which is the common name for a setter.
forbid = abstract bases close contract last left no record right second

[RegularExpressions::ProhibitUnusualDelimiters]
allow_all_brackets = 1

[RegularExpressions::RequireBracesForMultiline]
allow_all_brackets = 1

[RegularExpressions::RequireExtendedFormatting]
minimum_regex_length_to_complain_about = 60

[Subroutines::RequireArgUnpacking]
allow_delegation_to = new clone

[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
# TODO: Switch these to q{} ?
allow_if_string_contains_single_quote = 1

##
## Disable tests
##

# Here complex is meant as long, but long is not necessarily complex.
[-BuiltinFunctions::ProhibitComplexMappings]

# Needed when generating code.
[-BuiltinFunctions::ProhibitStringyEval]

# BUG: Bogus check.
[-Documentation::PodSpelling]

# While this might be good for performance, it is bad for keeping docs updated.
[-Documentation::RequirePodAtEnd]

# Too many false positives.
[-CodeLayout::RequireTidyCode]

# Forcing this just turns into noise (depending on the context, it makes sense).
[-CodeLayout::RequireTrailingCommas]

# These are fine, and given/when are marked as experimental.
[-ControlStructures::ProhibitCascadingIfElse]

# These are fine, and too many in the code base anyway.
[-ControlStructures::ProhibitPostfixControls]

# These are fine, usually as long as they are not double negations.
[-ControlStructures::ProhibitUnlessBlocks]

# BUG: Too many false positives.
[-ControlStructures::ProhibitUnreachableCode]

# Not relevant anymore, the mentioned problems were fixed in Perl 5.14.
[-ErrorHandling::RequireCheckingReturnValueOfEval]

# Needed, using <>/<@ARGV> is not correct, Prompt is not a core module.
[-InputOutput::ProhibitExplicitStdin]

# TODO: Maybe, some of these are part of the public/current API.
[-Modules::ProhibitAutomaticExportation]

# Here complex is meant as long, but long is not necessarily complex.
[-Modules::ProhibitExcessMainComplexity]

# BUG: Too many false positives; non-modules all trigger.
[-Modules::RequireVersionVar]

# We work primarily with ASCII, so we need to specify the exact characters
# to match.
[-RegularExpressions::ProhibitEnumeratedClasses]

# When . is used in the code it means what it does.
[-RegularExpressions::RequireDotMatchAnything]

# When ^ or $ are used in the code they mean what they do.
[-RegularExpressions::RequireLineBoundaryMatching]

# TODO: While valid, these are part of the public/current API.
[-Subroutines::ProhibitBuiltinHomonyms]

# TODO: Needed but we should switch away, and with perl 5.36 use signatures.
[-Subroutines::ProhibitSubroutinePrototypes]

# Adding these seems like more noise.
[-Subroutines::RequireFinalReturn]

# Readers need to know perl, English module is worse.
[-Variables::ProhibitPunctuationVars]
[-Modules::RequireNoMatchVarsWithUseEnglish]

# Readers need to know perl.
[-Variables::RequireInitializationForLocalVars]

# BUG: Too many false positives; on ::main and for $ENV, $SIG, $?, $a, $b.
[-Variables::RequireLocalizedPunctuationVars]

# Readonly is not a core module.
[-ValuesAndExpressions::ProhibitConstantPragma]

# TODO: Check it out, using other quotes might be less readable and uniform.
[-ValuesAndExpressions::ProhibitEmptyQuotes]

# Using charnames is less clear.
[-ValuesAndExpressions::ProhibitEscapedCharacters]

# Used for help output.
[-ValuesAndExpressions::ProhibitImplicitNewlines]

# TODO: Octals are fine, but revisit with perl 5.34 octal syntax 0o<nnnn>.
[-ValuesAndExpressions::ProhibitLeadingZeros]

# TODO: Check it out, some magic numbers are fine, octals for example.
[-ValuesAndExpressions::ProhibitMagicNumbers]

# BUG: False positives on long hex numbers, even when separated.
[-ValuesAndExpressions::RequireNumberSeparators]