# LedgerSMB perlcriticrc file

# Use these themes:

#  lsmb         -- includes all themes we want to use
#  lsmb_new     -- themes enforced on 'new' code
#  lsmb_old     -- themes enforced on 'old' code; subset of lsmb_new
#  lsmb_tests   -- themes enforced on tests
#  lsmb_wip     -- themes we are trying to use on 'new' code
#  lsmb_old_wip -- themes we are trying to use on 'old' code, subset of lsmb_wip

#  lsmb_reject   -- explicitly rejected themes
#  lsmb_consider -- themes we are confused about using

theme = lsmb_wip

# Run just the policies listed in this configuration
only = 1

# Fail if listed policy modules are not available
profile-strictness = fatal

# 1 is the most strict setting, which is the
# default when only == 1
severity = 1

verbose =%s %p %f   %l\n
#verbose =%f %p   %l  (%s)\n
color =  0
pager = less


[Documentation::RequirePodSections]
    # Section names from Module::Starter::PBP -- Damian Conway's Best Practices
    lib_sections = NAME | DESCRIPTION | METHODS | LICENSE AND COPYRIGHT
    script_sections = NAME | USAGE | DESCRIPTION | LICENSE AND COPYRIGHT
    set_themes = lsmb lsmb_new
[Documentation::RequirePodSections]
    # Section names from Module::Starter::PBP -- Damian Conway's Best Practices
    lib_sections = NAME | DESCRIPTION | SUBCOMMANDS | LICENSE AND COPYRIGHT
    script_sections = NAME | USAGE | DESCRIPTION | LICENSE AND COPYRIGHT
    set_themes = lsmb_cli_cmd
[ValuesAndExpressions::ProhibitMagicNumbers]
    allowed_values = -1 0 1 2 100
    set_themes = lsmb lsmb_wip lsmb_old_wip
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
    set_themes = lsmb lsmb_new
[BuiltinFunctions::ProhibitStringySplit]
    set_themes = lsmb lsmb_new lsmb_tests
[BuiltinFunctions::ProhibitUniversalCan]
    set_themes = lsmb lsmb_new lsmb_tests
[ClassHierarchies::ProhibitExplicitISA]
    set_themes = lsmb lsmb_new lsmb_old_wip lsmb_tests
[ControlStructures::ProhibitMutatingListFunctions]
    set_themes = lsmb lsmb_new lsmb_tests
[ControlStructures::ProhibitUnreachableCode]
    set_themes = lsmb lsmb_new lsmb_tests
[InputOutput::ProhibitBarewordFileHandles]
    set_themes = lsmb lsmb_new lsmb_tests
[InputOutput::ProhibitInteractiveTest]
    set_themes = lsmb lsmb_new lsmb_tests
[InputOutput::ProhibitOneArgSelect]
    set_themes = lsmb lsmb_new lsmb_tests
[InputOutput::ProhibitTwoArgOpen]
    set_themes = lsmb lsmb_new lsmb_tests
[InputOutput::RequireCheckedOpen]
    set_themes = lsmb lsmb_new lsmb_tests
[Miscellanea::ProhibitFormats]
    set_themes = lsmb lsmb_new lsmb_tests
[Modules::ProhibitEvilModules]
    set_themes = lsmb lsmb_new lsmb_tests
    modules_file = xt/prohibited_modules
[Modules::RequireEndWithOne]
    set_themes = lsmb lsmb_new  lsmb_old
[Objects::ProhibitIndirectSyntax]
    set_themes = lsmb lsmb_new lsmb_tests
[Subroutines::ProhibitReturnSort]
    set_themes = lsmb lsmb_new lsmb_tests
[Subroutines::ProhibitSubroutinePrototypes]
    # Unfortunately, subroutine prototypes are confused with signatures
    set_themes = lsmb_reject
[TestingAndDebugging::ProhibitProlongedStrictureOverride]
    set_themes = lsmb lsmb_new lsmb_tests
[TestingAndDebugging::RequireUseStrict]
    set_themes = lsmb lsmb_new
[TestingAndDebugging::RequireUseWarnings]
    set_themes = lsmb lsmb_new
[ValuesAndExpressions::ProhibitLeadingZeros]
    set_themes = lsmb lsmb_new lsmb_tests
[Variables::ProhibitPerl4PackageNames]
    set_themes = lsmb lsmb_new lsmb_tests
[Variables::ProhibitUnusedVariables]
    set_themes = lsmb lsmb_new lsmb_tests
[Variables::ProtectPrivateVars]
    set_themes = lsmb lsmb_new lsmb_tests
[Variables::RequireLexicalLoopIterators]


[CodeLayout::ProhibitTrailingWhitespace]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests

[CodeLayout::ProhibitHardTabs]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests
    allow_leading_tabs = 0

[Modules::ProhibitAutomaticExportation]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests
[Modules::ProhibitConditionalUseStatements]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests
[Modules::ProhibitEvilModules]
    set_themes = lsmb lsmb_new lsmb_old
[Modules::ProhibitExcessMainComplexity]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Modules::ProhibitMultiplePackages]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Modules::RequireBarewordIncludes]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Modules::RequireEndWithOne]
    set_themes = lsmb lsmb_new lsmb_old
[Modules::RequireExplicitInclusion]
    set_themes = lsmb lsmb_new
[Modules::RequireExplicitPackage]
    set_themes = lsmb lsmb_new lsmb_old
[Modules::RequireFilenameMatchesPackage]
    set_themes = lsmb lsmb_new lsmb_old_wip lsmb_tests


[Moose::RequireMakeImmutable]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests
[Moose::RequireCleanNamespace]
    set_themes = lsmb lsmb_new lsmb_old lsmb_tests


[TestingAndDebugging::ProhibitNoStrict]
    set_themes = lsmb lsmb_new lsmb_old_wip
[TestingAndDebugging::ProhibitNoWarnings]
    set_themes = lsmb lsmb_new lsmb_old_wip
[TestingAndDebugging::ProhibitProlongedStrictureOverride]
    set_themes = lsmb lsmb_new lsmb_old
[TestingAndDebugging::RequireTestLabels]
    set_themes = lsmb lsmb_new lsmb_old
[TestingAndDebugging::RequireUseStrict]
    set_themes = lsmb lsmb_new lsmb_old_wip
[TestingAndDebugging::RequireUseWarnings]
    set_themes = lsmb lsmb_new lsmb_old_wip

[InputOutput::RequireEncodingWithUTF8Layer]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Subroutines::ProhibitExplicitReturnUndef]
    set_themes = lsmb lsmb_wip lsmb_old_wip lsmb_tests

[BuiltinFunctions::ProhibitBooleanGrep]
    set_themes = lsmb lsmb_wip lsmb_old_wip
[BuiltinFunctions::ProhibitUniversalIsa]
    set_themes = lsmb lsmb_wip lsmb_old_wip lsmb_tests
[InputOutput::RequireCheckedClose]
    set_themes = lsmb lsmb_wip lsmb_old_wip
[InputOutput::RequireCheckedSyscalls]
    set_themes = lsmb lsmb_new lsmb_old_wip lsmb_tests
    functions = open close

[RegularExpressions::ProhibitCaptureWithoutTest]
    set_themes = lsmb lsmb_wip lsmb_old_wip
[Subroutines::ProtectPrivateSubs]
    set_themes = lsmb lsmb_wip lsmb_old_wip
[Subroutines::RequireFinalReturn]
    set_themes = lsmb lsmb_wip lsmb_old_wip
[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
    set_themes = lsmb lsmb_new lsmb_old_wip lsmb_tests
[ValuesAndExpressions::ProhibitMismatchedOperators]
    set_themes = lsmb lsmb_new lsmb_old_wip
[ValuesAndExpressions::ProhibitMixedBooleanOperators]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Variables::RequireInitializationForLocalVars]
    set_themes = lsmb lsmb_new lsmb_old_wip
[Variables::RequireLocalizedPunctuationVars]
    set_themes = lsmb lsmb_new lsmb_old_wip


# Rejected policies

# It is easier to lookup $^D than remember
# if $DEBUGGING is an application var.
#[Variables::ProhibitPunctuationVars]

# LSMB is more application than lib
#[Modules::RequireVersionVar]

# After Perl 5.20 this is no longer a problem
[Modules::RequireNoMatchVarsWithUseEnglish]
    set_themes = lsmb_reject


# Too many methods
[Subroutines::ProhibitBuiltinHomonyms]
    set_themes = lsmb_reject
