From 6c64e7f64aba3f6761e735f0dcc48618e9d62c6c Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Fri, 30 Aug 2024 10:12:54 +0200 Subject: [PATCH] - harden critic --- .perlcriticrc | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/.perlcriticrc b/.perlcriticrc index 18865c8..b2033d5 100644 --- a/.perlcriticrc +++ b/.perlcriticrc @@ -4,7 +4,7 @@ only = 0 force = 0 verbose = 8 top = 10 -#theme = (core || pbp || security || bugs || complexity || maintenance || cosmetic || pulp || bangs ||certrec || certrule ) && !more +theme = (core || pbp || security || bugs || complexity || maintenance || cosmetic || pulp || bangs ||certrec || certrule ) && !more # more color = 1 # Tell us which rule this violated, so we can tell it to get lost @@ -37,9 +37,6 @@ above_version = 5.031 [-ValuesAndExpressions::ProhibitEmptyQuotes] [-ValuesAndExpressions::ProhibitNoisyQuotes] -[-ValuesAndExpressions::ProhibitNullStatements] -[-ValuesAndExpressions::ProhibitVersionStrings] - # reverse sort @array is indeed better than # sort { $b cmp $a } @array # I'm not so sure about hating on $b vs $a in e.g. @@ -63,9 +60,7 @@ above_version = 5.031 # We throw structured exceptions all the time. Carp would be a bad idea # here. [-ErrorHandling::RequireCarping] -[-ErrorHandling::RequireUseOfExceptions] -[-Perlsecret] ### [Bangs::ProhibitDebuggingModules] @@ -74,17 +69,14 @@ above_version = 5.031 exceptions = md5 utf8 sha1 sha2 sha512 severity = 3 ## -[BuiltinFunctions::ProhibitStringyEval] - allow_includes = 1 -## [CodeLayout::RequireConsistentNewlines] ## # the values for cognitive complexity are tuned. Sometimes you have several if-statements, which could not be replaced # by other constructs. See 'validate()' in SLUB::LZA::BagIt (score=17) for example. [CognitiveComplexity::ProhibitExcessCognitiveComplexity] severity = 5 - warn_level = 13 - info_level = 10 + warn_level = 15 + info_level = 12 ## [CompileTime] ## @@ -93,12 +85,18 @@ above_version = 5.031 max_elsif = 3 ## [ControlStructures::ProhibitMutatingListFunctions] - severity = 3 + list_funcs = grep List::Util::first + severity = 5 ## [ControlStructures::ProhibitPostfixControls] allow = if unless severity = cruel ## +[ErrorHandling::RequireCarping] + allow_messages_ending_with_newlines = 0 + allow_in_main_unless_in_subroutine = 1 + severity = 3 +## [InputOutput::ProhibitBacktickOperators] ## [InputOutput::ProhibitExplicitStdin] @@ -110,6 +108,7 @@ above_version = 5.031 ## [Miscellanea::ProhibitUnrestrictedNoCritic] severity = 4 +[Perlsecret] ## [RegularExpressions::ProhibitCaptureWithoutTest] severity = 5 @@ -128,7 +127,7 @@ above_version = 5.031 # Builders are pulled in from Moose, but perlcritic can't possibly begin # to fathom that out. So let these things slide. [Subroutines::ProhibitUnusedPrivateSubroutines] - private_name_regex = _(?!build)\w+ +private_name_regex = _(?!build)\w+ ## [Subroutines::RequireArgUnpacking] short_subroutine_statements = 2 @@ -232,18 +231,14 @@ max_chain_length = 5 [TooMuchCode::ProhibitUnusedImport] severity=3 -[TooMuchCode::ProhibitUnusedInclude] - severity=3 -[Modules::RequireExplicitInclusion] - severity=3 +[Perlsecret] -[Subroutines::ProhibitQualifiedSubDeclarations] +[Modules::RequireExplicitInclusion] severity=3 ######################### should be rechecked soon ######################### - +[-Subroutines::ProhibitSubroutinePrototypes] +[-ValuesAndExpressions::ProhibitConstantPragma] [-Modules::ProhibitAutomaticExportation] [-Subroutines::ProhibitCallsToUndeclaredSubs] [-Subroutines::ProhibitCallsToUnexportedSubs] -[-Subroutines::ProhibitSubroutinePrototypes] -[-ValuesAndExpressions::ProhibitConstantPragma] -- GitLab