| 1 |
# Copyright 2022 Jeffrey Kegler |
| 2 |
# This file is part of Marpa::R2. Marpa::R2 is free software: you can |
| 3 |
# redistribute it and/or modify it under the terms of the GNU Lesser |
| 4 |
# General Public License as published by the Free Software Foundation, |
| 5 |
# either version 3 of the License, or (at your option) any later version. |
| 6 |
# |
| 7 |
# Marpa::R2 is distributed in the hope that it will be useful, |
| 8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 10 |
# Lesser General Public License for more details. |
| 11 |
# |
| 12 |
# You should have received a copy of the GNU Lesser |
| 13 |
# General Public License along with Marpa::R2. If not, see |
| 14 |
# http://www.gnu.org/licenses/. |
| 15 |
|
| 16 |
# This perlcriticrc is intended to list all policies explicitly. |
| 17 |
# Defaults are set so that policies not explicitly included (perhaps |
| 18 |
# because they are new in the latest Perl::Critic release) |
| 19 |
# produce warnings. This is done by setting default severity to |
| 20 |
# 1, changing the severity of all policies I use to 5, and turning |
| 21 |
# off policies which are not used with a minus prepended to the |
| 22 |
# name of the module. |
| 23 |
|
| 24 |
severity = 1 |
| 25 |
|
| 26 |
color = 0 |
| 27 |
|
| 28 |
[-BuiltinFunctions::ProhibitBooleanGrep] |
| 29 |
severity=5 |
| 30 |
|
| 31 |
[BuiltinFunctions::ProhibitComplexMappings] |
| 32 |
severity=5 |
| 33 |
|
| 34 |
[BuiltinFunctions::ProhibitLvalueSubstr] |
| 35 |
severity=5 |
| 36 |
|
| 37 |
# I consider these OK, but I also like to document |
| 38 |
# them, and the override this forces enforces |
| 39 |
# my documentation requirement |
| 40 |
[BuiltinFunctions::ProhibitReverseSortBlock] |
| 41 |
severity=5 |
| 42 |
|
| 43 |
[BuiltinFunctions::ProhibitSleepViaSelect] |
| 44 |
severity=5 |
| 45 |
|
| 46 |
[BuiltinFunctions::ProhibitStringyEval] |
| 47 |
severity=5 |
| 48 |
|
| 49 |
[BuiltinFunctions::ProhibitStringySplit] |
| 50 |
severity=5 |
| 51 |
|
| 52 |
[BuiltinFunctions::ProhibitUniversalCan] |
| 53 |
severity=5 |
| 54 |
|
| 55 |
[BuiltinFunctions::ProhibitUniversalIsa] |
| 56 |
severity=5 |
| 57 |
|
| 58 |
[BuiltinFunctions::ProhibitVoidGrep] |
| 59 |
severity=5 |
| 60 |
|
| 61 |
[BuiltinFunctions::ProhibitVoidMap] |
| 62 |
severity=5 |
| 63 |
|
| 64 |
[BuiltinFunctions::RequireBlockGrep] |
| 65 |
severity=5 |
| 66 |
|
| 67 |
[BuiltinFunctions::RequireBlockMap] |
| 68 |
severity=5 |
| 69 |
|
| 70 |
[BuiltinFunctions::RequireGlobFunction] |
| 71 |
severity=5 |
| 72 |
|
| 73 |
[BuiltinFunctions::RequireSimpleSortBlock] |
| 74 |
severity=5 |
| 75 |
|
| 76 |
[ClassHierarchies::ProhibitAutoloading] |
| 77 |
severity=5 |
| 78 |
|
| 79 |
[ClassHierarchies::ProhibitExplicitISA] |
| 80 |
severity=5 |
| 81 |
|
| 82 |
[ClassHierarchies::ProhibitOneArgBless] |
| 83 |
severity=5 |
| 84 |
|
| 85 |
[CodeLayout::ProhibitHardTabs] |
| 86 |
severity=5 |
| 87 |
|
| 88 |
[CodeLayout::ProhibitParensWithBuiltins] |
| 89 |
severity=5 |
| 90 |
|
| 91 |
[CodeLayout::ProhibitQuotedWordLists] |
| 92 |
severity=5 |
| 93 |
|
| 94 |
[CodeLayout::ProhibitTrailingWhitespace] |
| 95 |
severity=5 |
| 96 |
|
| 97 |
[CodeLayout::RequireConsistentNewlines] |
| 98 |
severity=5 |
| 99 |
|
| 100 |
[CodeLayout::RequireTrailingCommas] |
| 101 |
severity=5 |
| 102 |
|
| 103 |
[CodeLayout::RequireTidyCode] |
| 104 |
severity=5 |
| 105 |
perltidyrc=author.t/perltidyrc |
| 106 |
|
| 107 |
[-ControlStructures::ProhibitCStyleForLoops] |
| 108 |
severity=5 |
| 109 |
|
| 110 |
[ControlStructures::ProhibitCascadingIfElse] |
| 111 |
severity=5 |
| 112 |
|
| 113 |
# Good advice, but it is pretty obvious |
| 114 |
# when it is happening, and Perl::Critic |
| 115 |
# doesn't need to point it out. |
| 116 |
[-ControlStructures::ProhibitDeepNests] |
| 117 |
severity=5 |
| 118 |
|
| 119 |
[ControlStructures::ProhibitMutatingListFunctions] |
| 120 |
severity=5 |
| 121 |
|
| 122 |
[ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] |
| 123 |
severity=5 |
| 124 |
|
| 125 |
# These constructs are there because they can |
| 126 |
# be the clearest way to express the logic. |
| 127 |
# Disabling them is against the Perl spirit. |
| 128 |
[-ControlStructures::ProhibitPostfixControls] |
| 129 |
severity=5 |
| 130 |
|
| 131 |
# These constructs are there because they can |
| 132 |
# be the clearest way to express the logic. |
| 133 |
# Disabling them is against the Perl spirit. |
| 134 |
[-ControlStructures::ProhibitUnlessBlocks] |
| 135 |
severity=5 |
| 136 |
|
| 137 |
[ControlStructures::ProhibitUnreachableCode] |
| 138 |
severity=5 |
| 139 |
|
| 140 |
# These constructs are there because they can |
| 141 |
# be the clearest way to express the logic. |
| 142 |
# Disabling them is against the Perl spirit. |
| 143 |
[-ControlStructures::ProhibitUntilBlocks] |
| 144 |
severity=5 |
| 145 |
|
| 146 |
[-Documentation::RequirePodAtEnd] |
| 147 |
severity=5 |
| 148 |
|
| 149 |
[-Documentation::RequirePodSections] |
| 150 |
severity=5 |
| 151 |
lib_sections = NAME | DESCRIPTION | SUPPORT | AUTHOR | LICENSE AND COPYRIGHT |
| 152 |
script_sections = NAME | USAGE | OPTIONS | EXIT STATUS | AUTHOR |
| 153 |
|
| 154 |
# die() is good for Internal errors. |
| 155 |
[-ErrorHandling::RequireCarping] |
| 156 |
severity=5 |
| 157 |
|
| 158 |
[InputOutput::ProhibitBacktickOperators] |
| 159 |
severity=5 |
| 160 |
|
| 161 |
[InputOutput::ProhibitBarewordFileHandles] |
| 162 |
severity=5 |
| 163 |
|
| 164 |
[InputOutput::ProhibitExplicitStdin] |
| 165 |
severity=5 |
| 166 |
|
| 167 |
[InputOutput::ProhibitInteractiveTest] |
| 168 |
severity=5 |
| 169 |
|
| 170 |
[InputOutput::ProhibitJoinedReadline] |
| 171 |
severity=5 |
| 172 |
|
| 173 |
[InputOutput::ProhibitOneArgSelect] |
| 174 |
severity=5 |
| 175 |
|
| 176 |
[InputOutput::ProhibitReadlineInForLoop] |
| 177 |
severity=5 |
| 178 |
|
| 179 |
[InputOutput::ProhibitTwoArgOpen] |
| 180 |
severity=5 |
| 181 |
|
| 182 |
[InputOutput::RequireBracedFileHandleWithPrint] |
| 183 |
severity=5 |
| 184 |
|
| 185 |
[InputOutput::RequireBriefOpen] |
| 186 |
severity=5 |
| 187 |
lines=99 |
| 188 |
|
| 189 |
[InputOutput::RequireCheckedClose] |
| 190 |
severity=5 |
| 191 |
|
| 192 |
[InputOutput::RequireCheckedOpen] |
| 193 |
severity=5 |
| 194 |
|
| 195 |
|
| 196 |
[InputOutput::RequireCheckedSyscalls] |
| 197 |
severity=5 |
| 198 |
|
| 199 |
functions = :builtins |
| 200 |
|
| 201 |
[Miscellanea::ProhibitFormats] |
| 202 |
severity=5 |
| 203 |
|
| 204 |
[Miscellanea::ProhibitTies] |
| 205 |
severity=5 |
| 206 |
|
| 207 |
[-Miscellanea::RequireRcsKeywords] |
| 208 |
|
| 209 |
[Modules::ProhibitAutomaticExportation] |
| 210 |
severity=5 |
| 211 |
|
| 212 |
[Modules::ProhibitEvilModules] |
| 213 |
severity=5 |
| 214 |
|
| 215 |
[-Modules::ProhibitExcessMainComplexity] |
| 216 |
|
| 217 |
[-Modules::ProhibitMultiplePackages] |
| 218 |
|
| 219 |
[Modules::RequireBarewordIncludes] |
| 220 |
severity=5 |
| 221 |
|
| 222 |
[Modules::RequireEndWithOne] |
| 223 |
severity=5 |
| 224 |
|
| 225 |
[Modules::RequireExplicitPackage] |
| 226 |
severity=5 |
| 227 |
|
| 228 |
[-Modules::RequireFilenameMatchesPackage] |
| 229 |
|
| 230 |
[Modules::RequireNoMatchVarsWithUseEnglish] |
| 231 |
severity=5 |
| 232 |
|
| 233 |
[-Modules::RequireVersionVar] |
| 234 |
|
| 235 |
# I no longer use this because |
| 236 |
# 1.) Violations are obvious so perlcritic adds |
| 237 |
# limited value. |
| 238 |
# 2.) There are many good reasons to make exceptions. |
| 239 |
# 3.) Turning off violations on a case-by-case basis |
| 240 |
# is too noisy considering the severity. |
| 241 |
[-NamingConventions::Capitalization] |
| 242 |
local_lexical_variable_exemptions=.*_NFA.* .*NFA_.* .*AHFA_.* |
| 243 |
file_lexical_variable_exemptions=.*SGML_.* |
| 244 |
subroutine_exemptions=.*_NFA.* .*_AHFA.* Marpa::.* .*_CHAF.* |
| 245 |
severity=5 |
| 246 |
|
| 247 |
[NamingConventions::ProhibitAmbiguousNames] |
| 248 |
severity=5 |
| 249 |
|
| 250 |
forbid = last left right no abstract contract record second close |
| 251 |
# set is OK -- as in earley set |
| 252 |
|
| 253 |
[References::ProhibitDoubleSigils] |
| 254 |
severity=5 |
| 255 |
|
| 256 |
[RegularExpressions::ProhibitCaptureWithoutTest] |
| 257 |
severity=5 |
| 258 |
|
| 259 |
[RegularExpressions::ProhibitComplexRegexes] |
| 260 |
severity=5 |
| 261 |
|
| 262 |
[RegularExpressions::ProhibitEnumeratedClasses] |
| 263 |
severity=5 |
| 264 |
|
| 265 |
[RegularExpressions::ProhibitEscapedMetacharacters] |
| 266 |
severity=5 |
| 267 |
|
| 268 |
[RegularExpressions::ProhibitFixedStringMatches] |
| 269 |
severity=5 |
| 270 |
|
| 271 |
[RegularExpressions::ProhibitSingleCharAlternation] |
| 272 |
severity=5 |
| 273 |
|
| 274 |
[RegularExpressions::ProhibitUnusedCapture] |
| 275 |
severity=5 |
| 276 |
|
| 277 |
[RegularExpressions::ProhibitUnusualDelimiters] |
| 278 |
allow_all_brackets=1 |
| 279 |
severity=5 |
| 280 |
|
| 281 |
[RegularExpressions::RequireBracesForMultiline] |
| 282 |
severity=5 |
| 283 |
|
| 284 |
[RegularExpressions::RequireExtendedFormatting] |
| 285 |
severity=5 |
| 286 |
|
| 287 |
[RegularExpressions::RequireLineBoundaryMatching] |
| 288 |
severity=5 |
| 289 |
|
| 290 |
[Subroutines::ProhibitAmpersandSigils] |
| 291 |
severity=5 |
| 292 |
|
| 293 |
[Subroutines::ProhibitBuiltinHomonyms] |
| 294 |
severity=5 |
| 295 |
|
| 296 |
[-Subroutines::ProhibitExcessComplexity] |
| 297 |
|
| 298 |
[Subroutines::ProhibitExplicitReturnUndef] |
| 299 |
severity=5 |
| 300 |
|
| 301 |
[Subroutines::ProhibitManyArgs] |
| 302 |
severity=5 |
| 303 |
|
| 304 |
[Subroutines::ProhibitNestedSubs] |
| 305 |
severity=5 |
| 306 |
|
| 307 |
[Subroutines::ProhibitSubroutinePrototypes] |
| 308 |
severity=5 |
| 309 |
|
| 310 |
[Subroutines::ProtectPrivateSubs] |
| 311 |
severity=5 |
| 312 |
|
| 313 |
[Subroutines::RequireArgUnpacking] |
| 314 |
severity=5 |
| 315 |
allow_subscripts = 1 |
| 316 |
short_subroutine_statements = 3 |
| 317 |
|
| 318 |
[Subroutines::RequireFinalReturn] |
| 319 |
severity=5 |
| 320 |
terminal_funcs = Marpa::R2::exception |
| 321 |
|
| 322 |
[TestingAndDebugging::ProhibitNoStrict] |
| 323 |
severity=5 |
| 324 |
allow = refs |
| 325 |
|
| 326 |
# I add warnings to the allow line as I need |
| 327 |
# them. In effect, my policy is the same |
| 328 |
# as "allow_with_category_restriction = 1", |
| 329 |
# but forcing myself to add them documents |
| 330 |
# which ones I use, and provides an additional |
| 331 |
# level of checking. |
| 332 |
[TestingAndDebugging::ProhibitNoWarnings] |
| 333 |
severity=5 |
| 334 |
allow=qw once recursion |
| 335 |
|
| 336 |
[TestingAndDebugging::ProhibitProlongedStrictureOverride] |
| 337 |
severity=5 |
| 338 |
|
| 339 |
[TestingAndDebugging::RequireTestLabels] |
| 340 |
severity=5 |
| 341 |
|
| 342 |
[TestingAndDebugging::RequireUseStrict] |
| 343 |
severity=5 |
| 344 |
|
| 345 |
[TestingAndDebugging::RequireUseWarnings] |
| 346 |
severity=5 |
| 347 |
|
| 348 |
[ValuesAndExpressions::ProhibitCommaSeparatedStatements] |
| 349 |
severity=5 |
| 350 |
|
| 351 |
[-ValuesAndExpressions::ProhibitConstantPragma] |
| 352 |
[-ValuesAndExpressions::RequireConstantVersion] |
| 353 |
|
| 354 |
[ValuesAndExpressions::ProhibitEmptyQuotes] |
| 355 |
severity=5 |
| 356 |
|
| 357 |
[ValuesAndExpressions::ProhibitEscapedCharacters] |
| 358 |
severity=5 |
| 359 |
|
| 360 |
[ValuesAndExpressions::ProhibitImplicitNewlines] |
| 361 |
severity=5 |
| 362 |
|
| 363 |
[ValuesAndExpressions::ProhibitInterpolationOfLiterals] |
| 364 |
severity=5 |
| 365 |
|
| 366 |
[ValuesAndExpressions::ProhibitLeadingZeros] |
| 367 |
severity=5 |
| 368 |
|
| 369 |
# I comment this out because it is |
| 370 |
# 1.) not a sin I'm prone to |
| 371 |
# 2.) obvious from the code when it happens, so that |
| 372 |
# a perlcritic complaint is unneeded. |
| 373 |
# 3.) necessary to use Data::Dumper |
| 374 |
[-ValuesAndExpressions::ProhibitLongChainsOfMethodCalls] |
| 375 |
severity=5 |
| 376 |
|
| 377 |
[ValuesAndExpressions::RequireInterpolationOfMetachars] |
| 378 |
severity=5 |
| 379 |
|
| 380 |
# Reluctantly, I've disabled this one. |
| 381 |
# It is basically a good test, but |
| 382 |
# as of 2009-12-10 there is a bug where you either |
| 383 |
# get this warning or a useless "no critic" warning. |
| 384 |
# |
| 385 |
# Rewrites to constants are usually |
| 386 |
# not my preferred solution. |
| 387 |
# They often make the code more obscure. |
| 388 |
[-ValuesAndExpressions::ProhibitMagicNumbers] |
| 389 |
severity=5 |
| 390 |
allowed_values = -1 0 1 2 3 4 10 |
| 391 |
|
| 392 |
[ValuesAndExpressions::ProhibitMismatchedOperators] |
| 393 |
severity=5 |
| 394 |
|
| 395 |
# Just don't agree with this one. |
| 396 |
# The differences between operators |
| 397 |
# is obvious to the eye. |
| 398 |
# And the difference is not an obscure feature |
| 399 |
# of Perl, but one easy to remember and |
| 400 |
# important to know. |
| 401 |
[-ValuesAndExpressions::ProhibitMixedBooleanOperators] |
| 402 |
severity=5 |
| 403 |
|
| 404 |
[ValuesAndExpressions::ProhibitNoisyQuotes] |
| 405 |
severity=5 |
| 406 |
|
| 407 |
[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] |
| 408 |
severity=5 |
| 409 |
|
| 410 |
[ValuesAndExpressions::ProhibitVersionStrings] |
| 411 |
severity=5 |
| 412 |
|
| 413 |
[ValuesAndExpressions::RequireInterpolationOfMetachars] |
| 414 |
severity=5 |
| 415 |
|
| 416 |
[ValuesAndExpressions::RequireNumberSeparators] |
| 417 |
severity=5 |
| 418 |
|
| 419 |
[ValuesAndExpressions::RequireQuotedHeredocTerminator] |
| 420 |
severity=5 |
| 421 |
|
| 422 |
[ValuesAndExpressions::RequireUpperCaseHeredocTerminator] |
| 423 |
severity=5 |
| 424 |
|
| 425 |
[Variables::ProhibitConditionalDeclarations] |
| 426 |
severity=5 |
| 427 |
|
| 428 |
[Variables::ProhibitLocalVars] |
| 429 |
severity=5 |
| 430 |
|
| 431 |
[Variables::ProhibitMatchVars] |
| 432 |
severity=5 |
| 433 |
|
| 434 |
[Variables::ProhibitPackageVars] |
| 435 |
severity=5 |
| 436 |
add_packages = DynaLoader Marpa::R2::Context |
| 437 |
|
| 438 |
[Variables::ProhibitPerl4PackageNames] |
| 439 |
severity=5 |
| 440 |
|
| 441 |
[Variables::ProhibitPunctuationVars] |
| 442 |
severity=5 |
| 443 |
|
| 444 |
[Variables::ProtectPrivateVars] |
| 445 |
severity=5 |
| 446 |
|
| 447 |
[Variables::RequireInitializationForLocalVars] |
| 448 |
severity=5 |
| 449 |
|
| 450 |
[Variables::RequireLexicalLoopIterators] |
| 451 |
severity=5 |
| 452 |
|
| 453 |
[Variables::RequireLocalizedPunctuationVars] |
| 454 |
severity=5 |
| 455 |
|
| 456 |
[Variables::RequireNegativeIndices] |
| 457 |
severity=5 |
| 458 |
|
| 459 |
[-Subroutines::ProhibitCallsToUnexportedSubs] |
| 460 |
|
| 461 |
[-Subroutines::ProhibitQualifiedSubDeclarations] |
| 462 |
|
| 463 |
[Subroutines::ProhibitCallsToUndeclaredSubs] |
| 464 |
severity=5 |
| 465 |
|
| 466 |
[-Modules::RequireExplicitInclusion] |
| 467 |
|
| 468 |
[Documentation::PodSpelling] |
| 469 |
severity=5 |
| 470 |
stop_words_file = author.t/spelling_exceptions.list |