Koha/t/00-testcritic.t
Jonathan Druart 7dd57db429
Bug 34911: Test files from HEAD instead of 'master'
Since bug 34303 the test suite (when ran on jenkins) is no longer testing Perl::Critic

koha_1       | fatal: Not a valid object name master
koha_1       | [14:58:14] t/00-testcritic.t

We are not cloning the whole repo and "master" is not available. Additionally we do not want to test master's files on stable branches anyway...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:15:35 -04:00

18 lines
487 B
Perl
Executable file

#!/usr/bin/env perl
# This script can be used to run perlcritic on perl files in koha
use Modern::Perl;
use Test::More;
use English qw(-no_match_vars);
eval { require Test::Perl::Critic; };
if ( $EVAL_ERROR ) {
my $msg = 'Test::Perl::Critic required to criticise code,';
plan( skip_all => $msg );
}
Test::Perl::Critic->import( -profile => '.perlcriticrc' );
my @files = map { chomp; $_ } `git ls-tree -r HEAD --name-only`; # only files part of git
all_critic_ok(@files);