diff --git a/.gitignore b/.gitignore index 05c572d25e..18338f1508 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ META.* MYMETA.* SIGNATURE NGCP-Panel-* +.perlcritic-history diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 0000000000..a77b7bafd1 --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,66 @@ +verbose = %f line %l col %c\n [%s] %p (%e) = %m\n %r\n + # the ouput format, another nice one is 8, the [%s] is the severity +severity = 2 +theme = security || (pbp && bugs) || cosmetic || sipwise + +# This is optional, define your own colors if you like: +#colour-severity-5 = magenta +#colour-severity-4 = red +#colour-severity-3 = yellow +#colour-severity-2 = blue +#colour-severity-1 = black + +[Documentation::RequirePodSections] +#lib_sections = NAME | VERSION | SYNOPSIS | DESCRIPTION | INTERFACE | Composition | Attributes | Methods | Exports | DIAGNOSTICS | CONFIGURATION AND ENVIRONMENT | DEPENDENCIES | INCOMPATIBILITIES | BUGS AND LIMITATIONS | TO DO | AUTHOR | SEE ALSO +add_themes = sipwise +lib_sections = NAME | DESCRIPTION | LICENSE | AUTHOR +# lets keep this simple for now + +[Bangs::ProhibitCommentedOutCode] +commentedcoderegex = \$(?!Id)[A-Za-z_].*=/ +add_themes = sipwise +# should not trigger on the RCS variable + +[Perl::Critic::Policy::Tics::ProhibitLongLines] +add_themes = sipwise +base_max = 100 +hard_max = 160 +pct_allowed = 50 +# terminal width + +[InputOutput::RequireCheckedSyscalls] +add_themes = sipwise +functions = :builtins +exclude_functions = print + +[-Modules::RequireExplicitInclusion] +# we dont want this + +[BuiltinFunctions::ProhibitStringyEval] +allow_includes = 0 +# use Module::Runtime for includes + +[TestingAndDebugging::RequireUseStrict] +equivalent_modules = strictures Sipwise::Base HTML::FormHandler::Moose + +[TestingAndDebugging::RequireUseWarnings] +equivalent_modules = strictures Sipwise::Base HTML::FormHandler::Moose + +[Modules::RequireEndWithOne] +severity = 1 +# not really important, since this is redundant with perl5i (Sipwise::Base) + +##### Other exclusions + +# [-Subroutines::RequireFinalReturn] +# this is actually a good thing +[-CodeLayout::ProhibitHashBarewords] +# meh, it's super annoying +[-Lax::ProhibitStringyEval::ExceptForRequire] +# already covered through BuiltinFunctions::ProhibitStringyEval::allow_includes +[-ControlStructures::ProhibitPostfixControls] +[-ControlStructures::ProhibitUnlessBlocks] +[-RegularExpressions::RequireLineBoundaryMatching] +[-RegularExpressions::RequireDotMatchAnything] +[-ValuesAndExpressions::ProhibitEmptyQuotes] +[-ValuesAndExpressions::ProhibitNoisyQuotes] diff --git a/Build.PL b/Build.PL index bc402e27db..58a4132274 100644 --- a/Build.PL +++ b/Build.PL @@ -121,9 +121,8 @@ my $builder = Local::Module::Build->new( # for the testcover target 'Devel::Cover' => 0, 'sigtrap' => 0, - # for development - 'Convert::Ascii85' => 0, - 'IO::Uncompress::UnXz' => 0, + # for perlcritic test + 'Test::Perl::Critic::Progressive' => 0, }, add_to_cleanup => [ 'NGCP-Panel-*' ], ); diff --git a/t/perlcritic-progressive.t b/t/perlcritic-progressive.t new file mode 100644 index 0000000000..8323eb3c55 --- /dev/null +++ b/t/perlcritic-progressive.t @@ -0,0 +1,10 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +eval { require Test::Perl::Critic::Progressive }; +plan skip_all => 'T::P::C::Progressive required for this test' if $@; + +Test::Perl::Critic::Progressive::set_history_file('.perlcritic-history'); +Test::Perl::Critic::Progressive::progressive_critic_ok('lib');