#severity  = gentle
severity  = stern
only      = 0
force     = 0
verbose   = 8
top       = 10
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
verbose  = [%p] %m at %f line %l, near '%r'\n

### rules

### Git
# We use git, not svn or RCS
[-Miscellanea::RequireRcsKeywords]

# We'll enforce dependencies in other ways, rather than magically putting
# a $VERSION variable in modules.
[-Modules::RequireVersionVar]

### Modern Perl
# We'll run on at least perl 5.30
[Compatibility::PodMinimumVersion]
above_version = 5.031

# So don't badger us about explicitly declaring which version of Perl we
# require
[-Compatibility::PerlMinimumVersionAndWhy]

# Perltidy is a judgement call.
[-CodeLayout::RequireTidyCode]

# Damian Conway's insistence that the literal '' or "" in a proper
# monospaced font is difficult to read is frankly bizarre.
[-ValuesAndExpressions::ProhibitEmptyQuotes]
[-ValuesAndExpressions::ProhibitNoisyQuotes]

# 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.
# sort { $b->{stuff} <=> $a->{stuff} }
[-BuiltinFunctions::ProhibitReverseSortBlock]

# This is overridden by the better rule RequireCheckedSyscalls
[-InputOutput::RequireCheckedClose]

# There's muscle memory of always adding /xms to a regex, and then there's
# typing for the hell of it.
[-RegularExpressions::RequireDotMatchAnything]
[-RegularExpressions::RequireLineBoundaryMatching]

# Inline POD is good, dammit.
[-Documentation::RequirePodAtEnd]

# These are internal Perl modules. They don't need all these sections.
[-Documentation::RequirePodSections]

# We throw structured exceptions all the time. Carp would be a bad idea
# here.
[-ErrorHandling::RequireCarping]


### 
[Bangs::ProhibitDebuggingModules]
  severity = 3
[Bangs::ProhibitNumberedNames]
  exceptions = md5 utf8 sha1 sha2 sha512
  severity = 3
##
[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 = 15
  info_level = 12
##
[CompileTime]
##
[ControlStructures::ProhibitCascadingIfElse]
  severity = 5
  max_elsif = 3
##
[ControlStructures::ProhibitMutatingListFunctions]
  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]
  severity = 5
##
[InputOutput::RequireBriefOpen]
  lines = 30
  severity = 5
##
[Miscellanea::ProhibitUnrestrictedNoCritic]
  severity = 4
[Perlsecret]
##
[RegularExpressions::ProhibitCaptureWithoutTest]
  severity = 5
##
[RegularExpressions::ProhibitUnusedCapture]
##
[Subroutines::ProhibitBuiltinHomonyms]
  severity = 5
##
[Subroutines::ProhibitExcessComplexity]
  severity = 4
##
### Moose
[Moose::RequireMakeImmutable]
  severity = 3
# 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+
##
[Subroutines::RequireArgUnpacking]
  short_subroutine_statements = 2
  allow_subscripts = 1
  severity = 4
##
[Subroutines::RequireFinalReturn]
  severity = 5
##
[CognitiveComplexity::ProhibitExcessCognitiveComplexity]
[TestingAndDebugging::RequireUseStrict]
  equivalent_modules = MooseX::My::Sugar
  severity = 5
##
[TestingAndDebugging::RequireUseWarnings]
 equivalent_modules = MooseX::My::Sugar
 severity = 5
##
## Modules that import strictures etc.
# We have use strict and use warnings, dammit.
# Adding Test::Class::Moose temporarily as perlcritic doesn't realise that,
# like Moose, it enables strictures and warnings.
[TestingAndDebugging::RequireUseStrict]
equivalent_modules = common::sense our::way Test::Class::Moose

[TestingAndDebugging::RequireUseWarnings]
equivalent_modules = our::way Test::Class::Moose

[TestingAndDebugging::ProhibitNoWarnings]
 severity = 5
 allow = uninitialized once void experimental::signatures experimental::smartmatch

##
[TooMuchCode::ProhibitDuplicateLiteral]
#  severity = 3
##
[TooMuchCode::ProhibitLargeBlock]
  severity = 5
##
[TooMuchCode::ProhibitUnnecessaryUTF8Pragma]
  severity = 4
##
[Variables::ProhibitReusedNames]
  severity = 5
##
[Variables::ProhibitPunctuationVars]
  allow = $@ $!
##
[Variables::RequireLocalizedPunctuationVars]
  allow = %SIG
##
[ValuesAndExpressions::ProhibitMagicNumbers]
  allowed_values = 0 1 2  
##
[ValuesAndExpressions::ProhibitLeadingZeros]
  strict = 0
##
[ValuesAndExpressions::RequireNumberSeparators]
  min_value = 100000
  severity = brutal
##
[ValuesAndExpressions::RestrictLongStrings]

# Yes, require /x but perhaps not for really trivial regexen
# or stuff that looks for a constant
[RegularExpressions::RequireExtendedFormatting]
minimum_regex_length_to_complain_about = 35

# Checking return values is a good thing. Checking the return value of
# close or print STDERR is downright silly, as is checking whether you
# managed to sleep or not (!).
[InputOutput::RequireCheckedSyscalls]
functions = :builtins
exclude_functions = print close sleep

# Some things like DBIx::Class work fine with long chains of method calls.
# Bump up the number of method calls allowed.
[ValuesAndExpressions::ProhibitLongChainsOfMethodCalls]
max_chain_length = 5

# A blanket prohibition like this policy is harsh, but is meant as a
# building block or at least to make you think carefully whether "-f" is
# really right.
[-ValuesAndExpressions::ProhibitFiletest_f]

##
[Variables::ProhibitLoopOnHash]
##
### MOOSE
[Moose::ProhibitDESTROYMethod]

[Moose::ProhibitMultipleWiths]

[Moose::ProhibitNewMethod]

[Moose::RequireCleanNamespace]

[Moose::RequireMakeImmutable]

[Moose::ProhibitLazyBuild]

[TooMuchCode::ProhibitUnusedImport]
  severity=3

[Perlsecret]

[Modules::RequireExplicitInclusion]
  severity=3
######################### should be rechecked soon #########################
[-Subroutines::ProhibitSubroutinePrototypes]
[-ValuesAndExpressions::ProhibitConstantPragma]
[-Modules::ProhibitAutomaticExportation]
[-Subroutines::ProhibitCallsToUndeclaredSubs]
[-Subroutines::ProhibitCallsToUnexportedSubs]
