]> iEval git - www-backpacktf.git/commitdiff
Add perlcritic test and appease perlcritic
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Jun 2015 19:37:16 +0000 (22:37 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Jun 2015 19:40:35 +0000 (22:40 +0300)
MANIFEST
lib/WWW/BackpackTF.pm
t/perlcritic.t [new file with mode: 0644]
t/perlcriticrc [new file with mode: 0644]

index 2d3dd0e649976fd7af3ccfdaba9b488b743b4f15..0ef90fe612fe6c449acad8ac8d21ff5c546e3706 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -8,3 +8,5 @@ MANIFEST
 README
 t/00-load.t
 t/50-network.t
+t/perlcritic.t
+t/perlcriticrc
index af3511ff372aedc2dbce18c4faa481c2d0bedb5e..06cfcf5075654b8f7d0de222848e9c9edfb2f1fb 100644 (file)
@@ -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 (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..5815f07
--- /dev/null
@@ -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
This page took 0.039302 seconds and 4 git commands to generate.