From: Marius Gavrilescu Date: Sat, 6 Feb 2016 18:44:52 +0000 (+0000) Subject: Add perlcritic tests and make perlcritic happy X-Git-Tag: 0.001002~1 X-Git-Url: http://git.ieval.ro/?p=app-xmms2-notifier.git;a=commitdiff_plain;h=bc8efcf23b9d6a93de6fb44520cea31031cc5b99 Add perlcritic tests and make perlcritic happy --- diff --git a/MANIFEST b/MANIFEST index 8e0b3f4..a4b7e64 100644 --- 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 diff --git a/lib/App/XMMS2/Notifier.pm b/lib/App/XMMS2/Notifier.pm index 76c3521..55a9653 100644 --- a/lib/App/XMMS2/Notifier.pm +++ b/lib/App/XMMS2/Notifier.pm @@ -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 index 0000000..e005e07 --- /dev/null +++ b/t/perlcritic.t @@ -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 index 0000000..40b151e --- /dev/null +++ b/t/perlcriticrc @@ -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