-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.perlcriticrc
107 lines (78 loc) · 3.74 KB
/
.perlcriticrc
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
# DO NOT EDIT! This file is written by perl_setup_dist.
# If needed, you can add content at the end of the file.
# We report any policy of level 2 or higher (there is far too much noise if we
# go down to severity 1).
severity = 2
verbose = %f:%l: %m (%p, Severity: %s).\n
# We still include some policies whose default severity is 1
include = ValuesAndExpressions::ProhibitInterpolationOfLiterals CodeLayout::ProhibitTrailingWhitespace CodeLayout::RequireTidyCode
# Signatures are nice, let’s use them.
[TestingAndDebugging::ProhibitNoWarnings]
allow = experimental::signatures
# Methods of at most 2 lines can directly use @_ without unpacking it first
# (used here for performance reasons).
[Subroutines::RequireArgUnpacking]
short_subroutine_statements = 2
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
allow_if_string_contains_single_quote = 1
# Let’s allow moderately complex regex using the default syntax.
[RegularExpressions::RequireExtendedFormatting]
minimum_regex_length_to_complain_about = 30
# And we disable some policies that don’t work well:
# This policy confuses sub prototype with signatures.
[-Subroutines::ProhibitSubroutinePrototypes]
# This policy appears to also be confused by signatures.
[-Subroutines::ProhibitManyArgs]
# In theory we want that but, when using Locale::MakeText, this policy
# complains about the %Lexicon variables declared for the localization and there
# is no easy way to exclude them except by listing them all.
# TODO: remove once https://github.com/Perl-Critic/Perl-Critic/issues/1034 is fixed.
[-Variables::ProhibitPackageVars]
# That performance issue has been fixed in Perl 5.18 and newer.
[-Modules::RequireNoMatchVarsWithUseEnglish]
# I like postfix control :-)
[-ControlStructures::ProhibitPostfixControls]
# All the sections that I want to include are there already.
[-Documentation::RequirePodSections]
# This policy has many bugs, also I think that using the topic variable can make
# the code clearer, even in place where it would not be required to use it.
[-BuiltinFunctions::ProhibitUselessTopic]
# Let’s assume the reader knows how to write regex.
[-RegularExpressions::RequireDotMatchAnything]
[-RegularExpressions::RequireLineBoundaryMatching]
# The ',' syntax is nicer than q{,} in my opinion.
[-ValuesAndExpressions::ProhibitNoisyQuotes]
# End of the template. You can add custom content below this line.
# This is inconvenient
[-ValuesAndExpressions::ProhibitEmptyQuotes]
# 0, 1, and 2 are always allowed. We are adding 3 and 4 as they are very
# frequently used here to match spaces, with a tab-stop of 4.
# TODO: remove this override once the tab-stop is configurable.
[-ValuesAndExpressions::ProhibitMagicNumbers]
allowed_values = 0 1 2 3 4
# Actually, we are using %+, not $+ or @+ but this policy is buggy.
[Variables::ProhibitPunctuationVars]
allow = $+ @+
# I can’t find a better name than close
[-NamingConventions::ProhibitAmbiguousNames]
# TODO: get rid of this and simplify the code.
[-ControlStructures::ProhibitCascadingIfElse]
# They are just too convenient when we need to track the index or modify the
# array while we loop over it.
[-ControlStructures::ProhibitCStyleForLoops]
[Subroutines::RequireArgUnpacking]
allow_delegation_to = &_get_this_and_args
short_subroutine_statements = 3
[TestingAndDebugging::ProhibitNoWarnings]
allow = experimental::signatures experimental::refaliasing
[TestingAndDebugging::ProhibitNoStrict]
allow = refs
[Subroutines::ProhibitExcessComplexity]
max_mccabe = 30
# TODO: move this to perl_dist_setup as there is rarely a good reason to
# localize $ERRNO.
[Variables::RequireLocalizedPunctuationVars]
allow = $! $ERRNO
# This policy is not well suited for the encoding manipulation that we are doing
# on the file handles.
[-InputOutput::ProhibitInteractiveTest]