]> iEval git - app-xmms2-notifier.git/commitdiff
Add perlcritic tests and make perlcritic happy
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Feb 2016 18:44:52 +0000 (18:44 +0000)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Feb 2016 18:44:52 +0000 (18:44 +0000)
MANIFEST
lib/App/XMMS2/Notifier.pm
t/perlcritic.t [new file with mode: 0644]
t/perlcriticrc [new file with mode: 0644]

index 8e0b3f413e85b1bc080cad3d312eb29db813c40c..a4b7e643f5a3be852740fa22482b56d055c92ad2 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,5 +3,7 @@ Makefile.PL
 MANIFEST
 README
 t/test.t
+t/perlcriticrc
+t/perlcritic.t
 lib/App/XMMS2/Notifier.pm
 xmms2-notifier
index 76c35211564e3ce789218a2a911158ea8b00389a..55a9653553a41e3700af0fd61cb8efe79c459df4 100644 (file)
@@ -1,5 +1,5 @@
 package App::XMMS2::Notifier;
-use v5.14;
+use 5.014000;
 use strict;
 use warnings;
 our $VERSION = 0.001001;
@@ -33,7 +33,7 @@ sub notify{
 
        my %metadata = map { $_ => exists $minfo->{$_} ? (values %{$minfo->{$_}})[0] : undef } CONVERSION_SPECIFIERS;
        my $str=$format;
-       $str =~ s/\$$_/$metadata{$_}/g for keys %metadata;
+       $str =~ s/\$$_/$metadata{$_}/gs for keys %metadata;
 
        notify_libnotify $str
 }
@@ -60,8 +60,7 @@ sub run {
        $xmms->loop
 }
 
-1
-
+1;
 __END__
 
 =head1 NAME
diff --git a/t/perlcritic.t b/t/perlcritic.t
new file mode 100644 (file)
index 0000000..e005e07
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+use strict;
+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 'lib'
diff --git a/t/perlcriticrc b/t/perlcriticrc
new file mode 100644 (file)
index 0000000..40b151e
--- /dev/null
@@ -0,0 +1,41 @@
+severity = 1
+
+[-BuiltinFunctions::ProhibitComplexMappings]
+[-CodeLayout::RequireTidyCode]
+[-ControlStructures::ProhibitPostfixControls]
+[-ControlStructures::ProhibitUnlessBlocks]
+[-Documentation::PodSpelling]
+[-Documentation::RequirePodLinksIncludeText]
+[-InputOutput::RequireBracedFileHandleWithPrint]
+[-Modules::ProhibitAutomaticExportation]
+[-References::ProhibitDoubleSigils]
+[-RegularExpressions::ProhibitEnumeratedClasses]
+[-RegularExpressions::ProhibitUnusualDelimiters]
+[-RegularExpressions::RequireBracesForMultiline]
+[-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
+
+[RegularExpressions::RequireExtendedFormatting]
+minimum_regex_length_to_complain_about = 20
+
+[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
+
+[TestingAndDebugging::ProhibitNoWarnings]
+allow_with_category_restriction = 1
This page took 0.034399 seconds and 4 git commands to generate.