|
Line 0
Link Here
|
|
|
1 |
#!/usr/bin/env perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
# This script can be used to run perlcritic on perl files in koha |
| 6 |
# It calls its own custom perlcriticrc |
| 7 |
# The script is purely optional requiring Test::Perl::Critic to be installed |
| 8 |
# and the environment variable TEST_QA to be set |
| 9 |
# At present only the directories in @dirs will pass the tests in 'Gentle' mode |
| 10 |
|
| 11 |
use File::Spec; |
| 12 |
use Test::More; |
| 13 |
use English qw(-no_match_vars); |
| 14 |
|
| 15 |
my @all_koha_dirs = qw( acqui admin authorities basket C4 catalogue cataloguing circ debian errors |
| 16 |
labels members misc offline_circ opac patroncards reports reserve reviews rotating_collections |
| 17 |
serials sms suggestion t tags test tools virtualshelves); |
| 18 |
|
| 19 |
my @dirs = qw( basket circ debian errors offline_circ reserve reviews rotating_collections |
| 20 |
serials sms virtualshelves ); |
| 21 |
|
| 22 |
if ( not $ENV{TEST_QA} ) { |
| 23 |
my $msg = 'Author test. Set $ENV{TEST_QA} to a true value to run'; |
| 24 |
plan( skip_all => $msg ); |
| 25 |
} |
| 26 |
|
| 27 |
eval { require Test::Perl::Critic; }; |
| 28 |
|
| 29 |
if ( $EVAL_ERROR ) { |
| 30 |
my $msg = 'Test::Perl::Critic required to criticise code,'; |
| 31 |
plan( skip_all => $msg ); |
| 32 |
} |
| 33 |
|
| 34 |
my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); |
| 35 |
Test::Perl::Critic->import( -profile => $rcfile); |
| 36 |
all_critic_ok(@dirs); |
| 37 |
|