The Perl Toolchain Summit 2025 Needs You: You can help ๐Ÿ™ Learn more

# Copyright 2016 Jeffrey Kegler
# Marpa::R3 is Copyright (C) 2016, Jeffrey Kegler.
#
# This module is free software; you can redistribute it and/or modify it
# under the same terms as Perl 5.10.1. For more details, see the full text
# of the licenses in the directory LICENSES.
#
# This program is distributed in the hope that it will be
# useful, but it is provided โ€œas isโ€ and without any express
# or implied warranties. For details, see the full text of
# of the licenses in the directory LICENSES.
# This perlcriticrc is intended to list all policies explicitly.
# Defaults are set so that policies not explicitly included (perhaps
# because they are new in the latest Perl::Critic release)
# produce warnings. This is done by setting default severity to
# 1, changing the severity of all policies I use to 5, and turning
# off policies which are not used with a minus prepended to the
# name of the module.
severity = 1
color = 0
[-BuiltinFunctions::ProhibitBooleanGrep]
severity=5
[BuiltinFunctions::ProhibitComplexMappings]
severity=5
[BuiltinFunctions::ProhibitLvalueSubstr]
severity=5
# I consider these OK, but I also like to document
# them, and the override this forces enforces
# my documentation requirement
[BuiltinFunctions::ProhibitReverseSortBlock]
severity=5
[BuiltinFunctions::ProhibitSleepViaSelect]
severity=5
[BuiltinFunctions::ProhibitStringyEval]
severity=5
[BuiltinFunctions::ProhibitStringySplit]
severity=5
[BuiltinFunctions::ProhibitUniversalCan]
severity=5
[BuiltinFunctions::ProhibitUniversalIsa]
severity=5
[BuiltinFunctions::ProhibitVoidGrep]
severity=5
[BuiltinFunctions::ProhibitVoidMap]
severity=5
[BuiltinFunctions::RequireBlockGrep]
severity=5
[BuiltinFunctions::RequireBlockMap]
severity=5
[BuiltinFunctions::RequireGlobFunction]
severity=5
[BuiltinFunctions::RequireSimpleSortBlock]
severity=5
[ClassHierarchies::ProhibitAutoloading]
severity=5
[ClassHierarchies::ProhibitExplicitISA]
severity=5
[ClassHierarchies::ProhibitOneArgBless]
severity=5
[CodeLayout::ProhibitHardTabs]
severity=5
[CodeLayout::ProhibitParensWithBuiltins]
severity=5
[CodeLayout::ProhibitQuotedWordLists]
severity=5
[CodeLayout::ProhibitTrailingWhitespace]
severity=5
[CodeLayout::RequireConsistentNewlines]
severity=5
[CodeLayout::RequireTrailingCommas]
severity=5
[CodeLayout::RequireTidyCode]
severity=5
perltidyrc=author.t/perltidyrc
[-ControlStructures::ProhibitCStyleForLoops]
severity=5
[ControlStructures::ProhibitCascadingIfElse]
severity=5
# Good advice, but it is pretty obvious
# when it is happening, and Perl::Critic
# doesn't need to point it out.
[-ControlStructures::ProhibitDeepNests]
severity=5
[ControlStructures::ProhibitMutatingListFunctions]
severity=5
[ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions]
severity=5
# These constructs are there because they can
# be the clearest way to express the logic.
# Disabling them is against the Perl spirit.
[-ControlStructures::ProhibitPostfixControls]
severity=5
# These constructs are there because they can
# be the clearest way to express the logic.
# Disabling them is against the Perl spirit.
[-ControlStructures::ProhibitUnlessBlocks]
severity=5
[ControlStructures::ProhibitUnreachableCode]
severity=5
# These constructs are there because they can
# be the clearest way to express the logic.
# Disabling them is against the Perl spirit.
[-ControlStructures::ProhibitUntilBlocks]
severity=5
[-Documentation::RequirePodAtEnd]
severity=5
[-Documentation::RequirePodSections]
severity=5
lib_sections = NAME | DESCRIPTION | SUPPORT | AUTHOR | LICENSE AND COPYRIGHT
script_sections = NAME | USAGE | OPTIONS | EXIT STATUS | AUTHOR
# die() is good for Internal errors.
[-ErrorHandling::RequireCarping]
severity=5
[InputOutput::ProhibitBacktickOperators]
severity=5
[InputOutput::ProhibitBarewordFileHandles]
severity=5
[InputOutput::ProhibitExplicitStdin]
severity=5
[InputOutput::ProhibitInteractiveTest]
severity=5
[InputOutput::ProhibitJoinedReadline]
severity=5
[InputOutput::ProhibitOneArgSelect]
severity=5
[InputOutput::ProhibitReadlineInForLoop]
severity=5
[InputOutput::ProhibitTwoArgOpen]
severity=5
[InputOutput::RequireBracedFileHandleWithPrint]
severity=5
[InputOutput::RequireBriefOpen]
severity=5
lines=99
[InputOutput::RequireCheckedClose]
severity=5
[InputOutput::RequireCheckedOpen]
severity=5
[InputOutput::RequireCheckedSyscalls]
severity=5
functions = :builtins
[Miscellanea::ProhibitFormats]
severity=5
[Miscellanea::ProhibitTies]
severity=5
[-Miscellanea::RequireRcsKeywords]
[Modules::ProhibitAutomaticExportation]
severity=5
[Modules::ProhibitEvilModules]
severity=5
[-Modules::ProhibitExcessMainComplexity]
[-Modules::ProhibitMultiplePackages]
[Modules::RequireBarewordIncludes]
severity=5
[Modules::RequireEndWithOne]
severity=5
[Modules::RequireExplicitPackage]
severity=5
[-Modules::RequireFilenameMatchesPackage]
[Modules::RequireNoMatchVarsWithUseEnglish]
severity=5
[-Modules::RequireVersionVar]
# I no longer use this because
# 1.) Violations are obvious so perlcritic adds
# limited value.
# 2.) There are many good reasons to make exceptions.
# 3.) Turning off violations on a case-by-case basis
# is too noisy considering the severity.
[-NamingConventions::Capitalization]
local_lexical_variable_exemptions=.*_NFA.* .*NFA_.* .*AHFA_.*
file_lexical_variable_exemptions=.*SGML_.*
subroutine_exemptions=.*_NFA.* .*_AHFA.* Marpa::.* .*_CHAF.*
severity=5
[NamingConventions::ProhibitAmbiguousNames]
severity=5
forbid = last left right no abstract contract record second close
# set is OK -- as in earley set
[References::ProhibitDoubleSigils]
severity=5
[RegularExpressions::ProhibitCaptureWithoutTest]
severity=5
[RegularExpressions::ProhibitComplexRegexes]
severity=5
[RegularExpressions::ProhibitEnumeratedClasses]
severity=5
[RegularExpressions::ProhibitEscapedMetacharacters]
severity=5
[RegularExpressions::ProhibitFixedStringMatches]
severity=5
[RegularExpressions::ProhibitSingleCharAlternation]
severity=5
[RegularExpressions::ProhibitUnusedCapture]
severity=5
[RegularExpressions::ProhibitUnusualDelimiters]
allow_all_brackets=1
severity=5
[RegularExpressions::RequireBracesForMultiline]
severity=5
[RegularExpressions::RequireExtendedFormatting]
severity=5
[RegularExpressions::RequireLineBoundaryMatching]
severity=5
[Subroutines::ProhibitAmpersandSigils]
severity=5
[Subroutines::ProhibitBuiltinHomonyms]
severity=5
[-Subroutines::ProhibitExcessComplexity]
[Subroutines::ProhibitExplicitReturnUndef]
severity=5
[Subroutines::ProhibitManyArgs]
severity=5
[Subroutines::ProhibitNestedSubs]
severity=5
[Subroutines::ProhibitSubroutinePrototypes]
severity=5
[Subroutines::ProtectPrivateSubs]
severity=5
[Subroutines::RequireArgUnpacking]
severity=5
allow_subscripts = 1
short_subroutine_statements = 3
[Subroutines::RequireFinalReturn]
severity=5
terminal_funcs = Marpa::R3::exception
[TestingAndDebugging::ProhibitNoStrict]
severity=5
allow = refs
# I add warnings to the allow line as I need
# them. In effect, my policy is the same
# as "allow_with_category_restriction = 1",
# but forcing myself to add them documents
# which ones I use, and provides an additional
# level of checking.
[TestingAndDebugging::ProhibitNoWarnings]
severity=5
allow=qw once recursion
[TestingAndDebugging::ProhibitProlongedStrictureOverride]
severity=5
[TestingAndDebugging::RequireTestLabels]
severity=5
[TestingAndDebugging::RequireUseStrict]
severity=5
[TestingAndDebugging::RequireUseWarnings]
severity=5
[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
severity=5
[-ValuesAndExpressions::ProhibitConstantPragma]
[-ValuesAndExpressions::RequireConstantVersion]
[ValuesAndExpressions::ProhibitEmptyQuotes]
severity=5
[ValuesAndExpressions::ProhibitEscapedCharacters]
severity=5
[ValuesAndExpressions::ProhibitImplicitNewlines]
severity=5
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
severity=5
[ValuesAndExpressions::ProhibitLeadingZeros]
severity=5
# I comment this out because it is
# 1.) not a sin I'm prone to
# 2.) obvious from the code when it happens, so that
# a perlcritic complaint is unneeded.
# 3.) necessary to use Data::Dumper
[-ValuesAndExpressions::ProhibitLongChainsOfMethodCalls]
severity=5
[ValuesAndExpressions::RequireInterpolationOfMetachars]
severity=5
# Reluctantly, I've disabled this one.
# It is basically a good test, but
# as of 2009-12-10 there is a bug where you either
# get this warning or a useless "no critic" warning.
#
# Rewrites to constants are usually
# not my preferred solution.
# They often make the code more obscure.
[-ValuesAndExpressions::ProhibitMagicNumbers]
severity=5
allowed_values = -1 0 1 2 3 4 10
[ValuesAndExpressions::ProhibitMismatchedOperators]
severity=5
# Just don't agree with this one.
# The differences between operators
# is obvious to the eye.
# And the difference is not an obscure feature
# of Perl, but one easy to remember and
# important to know.
[-ValuesAndExpressions::ProhibitMixedBooleanOperators]
severity=5
[ValuesAndExpressions::ProhibitNoisyQuotes]
severity=5
[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters]
severity=5
[ValuesAndExpressions::ProhibitVersionStrings]
severity=5
[ValuesAndExpressions::RequireInterpolationOfMetachars]
severity=5
[ValuesAndExpressions::RequireNumberSeparators]
severity=5
[ValuesAndExpressions::RequireQuotedHeredocTerminator]
severity=5
[ValuesAndExpressions::RequireUpperCaseHeredocTerminator]
severity=5
[Variables::ProhibitConditionalDeclarations]
severity=5
[Variables::ProhibitLocalVars]
severity=5
[Variables::ProhibitMatchVars]
severity=5
[Variables::ProhibitPackageVars]
severity=5
add_packages = DynaLoader Marpa::R3::Context
[Variables::ProhibitPerl4PackageNames]
severity=5
[Variables::ProhibitPunctuationVars]
severity=5
[Variables::ProtectPrivateVars]
severity=5
[Variables::RequireInitializationForLocalVars]
severity=5
[Variables::RequireLexicalLoopIterators]
severity=5
[Variables::RequireLocalizedPunctuationVars]
severity=5
[Variables::RequireNegativeIndices]
severity=5
[-Subroutines::ProhibitCallsToUnexportedSubs]
[-Subroutines::ProhibitQualifiedSubDeclarations]
[Subroutines::ProhibitCallsToUndeclaredSubs]
severity=5
[-Modules::RequireExplicitInclusion]
[Documentation::PodSpelling]
severity=5
stop_words_file = author.t/spelling_exceptions.list