1#!/usr/bin/perl 2 3use strict; 4use warnings; 5use File::Spec; 6use Test::More; 7use English qw(-no_match_vars); 8 9BEGIN { 10 if (-d 'xt') { chdir 'xt'; } 11 12 if (-e 'test_dir') { # running from test directory, not .. 13 unshift(@INC, '../blib/lib'); 14 unshift(@INC, '../lib'); 15 } 16} 17 18eval { require Test::Perl::Critic; }; 19 20if ( $EVAL_ERROR ) { 21 my $msg = 'Test::Perl::Critic required to criticise code'; 22 plan( skip_all => $msg ); 23} 24 25open RC, ">../t/log/perlcritic.rc" or die "cannot create t/log/perlcritic.rc"; 26 27# we should remove some of these excludes if/when we feel like fixing 'em! 28print RC q{ 29 30 severity = 5 31 verbose = 10 32 exclude = ValuesAndExpressions::ProhibitLeadingZeros InputOutput::ProhibitBarewordFileHandles InputOutput::ProhibitTwoArgOpen BuiltinFunctions::ProhibitStringyEval InputOutput::ProhibitInteractiveTest 33 34 [TestingAndDebugging::ProhibitNoStrict] 35 allow = refs 36 37} or die "cannot write t/log/perlcritic.rc"; 38close RC or die "cannot close t/log/perlcritic.rc"; 39 40Test::Perl::Critic->import( -profile => "../t/log/perlcritic.rc" ); 41all_critic_ok("../blib"); 42 43