Bug 17530: (QA follow-up) Replace our variable by cached value
[koha.git] / t / 00-testcritic.t
blob8a7f5d2e5f9fbc35788637e34d610ab61a29eb3f
1 #!/usr/bin/env perl
3 # This script can be used to run perlcritic on perl files in koha
4 # It calls its own custom perlcriticrc
5 # The script is purely optional requiring Test::Perl::Critic to be installed
6 # and the environment variable TEST_QA to be set
7 # At present only the directories in @dirs will pass the tests in 'Gentle' mode
9 use Modern::Perl;
10 use File::Spec;
11 use Test::More;
12 use English qw(-no_match_vars);
14 my @dirs = qw(
15 acqui
16 admin
17 authorities
18 basket
19 catalogue
20 cataloguing
21 circ
22 debian
23 errors
24 labels
25 members
26 offline_circ
27 reserve
28 reviews
29 rotating_collections
30 serials
31 sms
32 virtualshelves
33 Koha
34 C4/SIP
37 if ( not $ENV{TEST_QA} ) {
38 my $msg = 'Author test. Set $ENV{TEST_QA} to a true value to run';
39 plan( skip_all => $msg );
42 eval { require Test::Perl::Critic; };
44 if ( $EVAL_ERROR ) {
45 my $msg = 'Test::Perl::Critic required to criticise code,';
46 plan( skip_all => $msg );
49 my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
50 Test::Perl::Critic->import( -profile => $rcfile);
51 all_critic_ok(@dirs);