From: Marius Gavrilescu Date: Sat, 6 Jun 2015 19:37:16 +0000 (+0300) Subject: Add perlcritic test and appease perlcritic X-Git-Tag: 0.001~1 X-Git-Url: http://git.ieval.ro/?p=www-backpacktf.git;a=commitdiff_plain;h=116816ee6a9c86f7223fac7348087ae238a0372c Add perlcritic test and appease perlcritic --- diff --git a/MANIFEST b/MANIFEST index 2d3dd0e..0ef90fe 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,3 +8,5 @@ MANIFEST README t/00-load.t t/50-network.t +t/perlcritic.t +t/perlcriticrc diff --git a/lib/WWW/BackpackTF.pm b/lib/WWW/BackpackTF.pm index af3511f..06cfcf5 100644 --- a/lib/WWW/BackpackTF.pm +++ b/lib/WWW/BackpackTF.pm @@ -7,7 +7,7 @@ use parent qw/Exporter/; our $VERSION = '0.000_003'; our @EXPORT_OK = qw/TF2 DOTA2/; -use constant +{ +use constant +{ ## no critic (Capitalization) TF2 => 440, DOTA2 => 570, CSGO => 730, @@ -38,9 +38,9 @@ sub request { $url = $self->{base} . $url; $url .= "&$_=$params{$_}" for keys %params; my $htr = $ht->get($url); - die $htr->{reason} unless $htr->{success}; + die $htr->{reason} unless $htr->{success}; ## no critic (RequireCarping) my $response = decode_json($htr->{content})->{response}; - die $response->{message} unless $response->{success}; + die $response->{message} unless $response->{success}; ## no critic (RequireCarping) $response } diff --git a/t/perlcritic.t b/t/perlcritic.t new file mode 100644 index 0000000..51bad9d --- /dev/null +++ b/t/perlcritic.t @@ -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 index 0000000..5815f07 --- /dev/null +++ b/t/perlcriticrc @@ -0,0 +1,36 @@ +severity = 1 + +[-BuiltinFunctions::ProhibitComplexMappings] +[-CodeLayout::RequireTidyCode] +[-ControlStructures::ProhibitPostfixControls] +[-ControlStructures::ProhibitUnlessBlocks] +[-Documentation::PodSpelling] +[-Documentation::RequirePodLinksIncludeText] +[-InputOutput::RequireBracedFileHandleWithPrint] +[-Modules::ProhibitAutomaticExportation] +[-References::ProhibitDoubleSigils] +[-RegularExpressions::ProhibitEnumeratedClasses] +[-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