# Copyright 2014 Jeffrey Kegler
# This file is part of Marpa::R2.  Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser
# General Public License along with Marpa::R2.  If not, see
# http://www.gnu.org/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::R2::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::R2::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
