-
Notifications
You must be signed in to change notification settings - Fork 0
/
.perlcriticrc
90 lines (66 loc) · 3.2 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
# 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.
# The style of ptp is to use complex mapping everywhere...
[-BuiltinFunctions::ProhibitComplexMappings]
# Similarly, we use map in void context everywhere and sometime mutate $_.
[-BuiltinFunctions::ProhibitVoidMap]
[-ControlStructures::ProhibitMutatingListFunctions]
[ControlStructures::ProhibitCascadingIfElse]
max_elsif = 3
[ValuesAndExpressions::ProhibitMagicNumbers]
allowed_values = -1 0 1 2 3
# This is an app, not a library
[-ErrorHandling::RequireCarping]
# Stuff we just do...
[-InputOutput::RequireBriefOpen]
[-Miscellanea::ProhibitTies]
[-Modules::ProhibitMultiplePackages]
[-ValuesAndExpressions::ProhibitEmptyQuotes]
[-Variables::ProhibitPunctuationVars]
# TODO: Get rid of these exceptions, we shouldn’t do all these things.
[-Modules::ProhibitAutomaticExportation]
[-References::ProhibitDoubleSigils]
[-Subroutines::RequireFinalReturn]