Skip to content

Commit

Permalink
Reviewed perlcritic policies of severity 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-Elie committed Sep 8, 2024
1 parent 0764c13 commit 8b7a59d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
59 changes: 56 additions & 3 deletions .perlcriticrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# https://metacpan.org/pod/Perl::Critic::Pulp
# https://perlmaven.com/perl-critic

# Be harsh for the time being. All the policies are not enabled yet.
severity = 3
# Be cruel for the time being. All the policies are not enabled yet.
severity = 2

# Custom output.
verbose = %f:%l:%c: [%p] %m, near '%r' (%e, Severity: %s)\n
Expand All @@ -46,6 +46,11 @@ exclude = Freenode::
# Configuration of some policies #
##################################

# Prefer the use of qw() to declare a list of one-word literals.
[CodeLayout::ProhibitQuotedWordLists]
min_elements = 1
strict = 1

# tunefeed and innreport declare specific sorting functions.
[Community::DollarAB]
extra_pair_functions = by_hierarchy DateCompare
Expand Down Expand Up @@ -162,13 +167,16 @@ allow = lock
[-Community::OpenArgs]
[-Community::Prototypes]

# Perl 5.14.0 fixed the underlying issue (preserving the value of $@ even if
# destructors run at exit from the eval block).
[-ErrorHandling::RequireCheckingReturnValueOfEval]

# The following policies are mostly related to style.
[-BuiltinFunctions::ProhibitComplexMappings]
[-BuiltinFunctions::ProhibitVoidMap]
[-ControlStructures::ProhibitCascadingIfElse]
[-ControlStructures::ProhibitDeepNests]
[-ErrorHandling::RequireCarping]
[-ErrorHandling::RequireCheckingReturnValueOfEval]
[-InputOutput::ProhibitJoinedReadline]
[-Modules::ProhibitExcessMainComplexity]
[-NamingConventions::ProhibitAmbiguousNames]
Expand All @@ -181,3 +189,48 @@ allow = lock
[-ValuesAndExpressions::ProhibitImplicitNewlines]
[-ValuesAndExpressions::RequireNumericVersion]
[-Variables::ProhibitPackageVars]


###################################
# Excluded policies of severity 2 #
###################################

# This policy may be worthwhile enforcing when Perl 5.10.0 is the minimum
# required version for INN as List::Util is not shipped as a core module in
# previous versions.
# Anyway, it won't drastically optimize the speed of programs!
[-BuiltinFunctions::ProhibitBooleanGrep]

# perltidy already takes care of it. Besides, there are false positives in
# innreport.
[-CodeLayout::RequireFinalSemicolon]

# Normally enforced by perltidy, but some trailing commas are still missing.
# https://github.com/perltidy/perltidy/issues/143
[-CodeLayout::RequireTrailingCommaAtNewline]

# Getopt::Std is still used and fits our needs.
[-Community::PreferredAlternatives]

# The following policies are mostly related to style.
[-BuiltinFunctions::ProhibitUselessTopic]
[-ControlStructures::ProhibitCStyleForLoops]
[-ControlStructures::ProhibitPostfixControls]
[-ControlStructures::ProhibitUnlessBlocks]
[-Documentation::RequirePodSections]
[-InputOutput::RequireCheckedClose]
[-Miscellanea::ProhibitTies]
[-Modules::RequireVersionVar]
[-References::ProhibitDoubleSigils]
[-RegularExpressions::ProhibitFixedStringMatches]
[-RegularExpressions::ProhibitUselessTopic]
[-RegularExpressions::RequireDotMatchAnything]
[-RegularExpressions::RequireLineBoundaryMatching]
[-Subroutines::ProhibitAmpersandSigils]
[-ValuesAndExpressions::ProhibitEmptyQuotes]
[-ValuesAndExpressions::ProhibitEscapedCharacters]
[-ValuesAndExpressions::ProhibitMagicNumbers]
[-ValuesAndExpressions::ProhibitNoisyQuotes]
[-ValuesAndExpressions::RequireConstantVersion]
[-ValuesAndExpressions::RequireNumberSeparators]
[-Variables::ProhibitPunctuationVars]
5 changes: 4 additions & 1 deletion frontends/cnfsstat.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ use warnings;
use Getopt::Long;
use Math::BigInt;
use Math::BigFloat;
use English;

# We're using $POSTMATCH so we cannot use -no_match_vars.
# Anyway, Perl 5.20.0 fixed the speed issue.
use English; ## no critic (Modules::RequireNoMatchVarsWithUseEnglish)

my $conffile = "$INN::Config::pathetc/cycbuff.conf";
my $storageconf = "$INN::Config::pathetc/storage.conf";
Expand Down

0 comments on commit 8b7a59d

Please sign in to comment.