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 8e0b3f4..a4b7e64 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 76c3521..55a9653 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.052755 seconds and 4 git commands to generate.