Add perlcritic tests and make code comply
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 21 Feb 2015 21:19:15 +0000 (23:19 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 21 Feb 2015 21:19:15 +0000 (23:19 +0200)
MANIFEST
lib/POE/Component/IRC/Plugin/Hello.pm
t/perlcritic.t [new file with mode: 0644]
t/perlcriticrc [new file with mode: 0644]

index ce246a4c2892b85dac8f9917294b7f98856c5a80..7f920991928d9f8a6aa183d7425c26c1392ed719 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,4 +3,6 @@ Makefile.PL
 MANIFEST
 README
 t/POE-Component-IRC-Plugin-Hello.t
+t/perlcritic.t
+t/perlcriticrc
 lib/POE/Component/IRC/Plugin/Hello.pm
index f559fd2e7be9fe000f9dc2b59789ca07d6611423..9b03e4713061d343b320b863887c80bfe2322e2e 100644 (file)
@@ -24,7 +24,7 @@ sub new {
                           saluton allo moin aloha namaste shalom ciào ciao servus
                           salve ave merhaba witaj hei hola selam sawubona
                           geodemorgen hoi καλημέρα/,
-                       "what's up", 'que tal', 'こんにちは', '你好', 'ni hao',
+                       'what\'s up', 'que tal', 'こんにちは', '你好', 'ni hao',
                        'добро јутро', 'γεια σας', 'bom dia', 'hyvää huomenta'],
                @_
        };
@@ -47,7 +47,7 @@ sub S_public{
        my $message = NFC decode 'UTF-8', $$rmessage;
        my @hello = @{$self->{greetings}};
 
-       my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello;
+       my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/is } @hello;
        my $randhello = encode 'UTF-8', $hello[int rand $#hello];
        $irc->yield(privmsg => $$rchannels->[0] => "$randhello, $nick") if $match;
        PCI_EAT_NONE
diff --git a/t/perlcritic.t b/t/perlcritic.t
new file mode 100644 (file)
index 0000000..51bad9d
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+use v5.14;
+use warnings;
+
+use Test::More;
+
+BEGIN { plan skip_all => '$ENV{RELEASE_TESTING} is false' unless $ENV{RELEASE_TESTING} }
+use Test::Perl::Critic -profile => 't/perlcriticrc';
+
+all_critic_ok
diff --git a/t/perlcriticrc b/t/perlcriticrc
new file mode 100644 (file)
index 0000000..cc51fca
--- /dev/null
@@ -0,0 +1,36 @@
+severity = 1
+
+[-BuiltinFunctions::ProhibitComplexMappings]
+[-CodeLayout::RequireTidyCode]
+[-ControlStructures::ProhibitPostfixControls]
+[-ControlStructures::ProhibitUnlessBlocks]
+[-Documentation::PodSpelling]
+[-Documentation::RequirePodLinksIncludeText]
+[-InputOutput::RequireBracedFileHandleWithPrint]
+[-References::ProhibitDoubleSigils]
+[-RegularExpressions::ProhibitEnumeratedClasses]
+[-RegularExpressions::RequireExtendedFormatting]
+[-RegularExpressions::RequireLineBoundaryMatching]
+[-Subroutines::RequireFinalReturn]
+[-ValuesAndExpressions::ProhibitConstantPragma]
+[-ValuesAndExpressions::ProhibitEmptyQuotes]
+[-ValuesAndExpressions::ProhibitLeadingZeros]
+[-ValuesAndExpressions::ProhibitMagicNumbers]
+[-ValuesAndExpressions::ProhibitNoisyQuotes]
+[-Variables::ProhibitLocalVars]
+[-Variables::ProhibitPackageVars]
+[-Variables::ProhibitPunctuationVars]
+
+[BuiltinFunctions::ProhibitStringyEval]
+allow_includes = 1
+
+[Documentation::RequirePodSections]
+lib_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+
+[Subroutines::RequireArgUnpacking]
+short_subroutine_statements = 5
+allow_subscripts = 1
+
+[NamingConventions::Capitalization]
+subroutines = :no_restriction
This page took 0.013487 seconds and 4 git commands to generate.