From 86b37acc59d5652a3e01066bd441e19f15a18b4a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 May 2023 12:52:22 +0200 Subject: [PATCH] Bug 33743: Make xt/find-missing-filters.t check directories in git index only --- xt/find-missing-filters.t | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/xt/find-missing-filters.t b/xt/find-missing-filters.t index 6b7e80f4aa3..f117e9398a2 100755 --- a/xt/find-missing-filters.t +++ b/xt/find-missing-filters.t @@ -17,40 +17,24 @@ use Modern::Perl; use Test::More tests => 1; -use File::Find; -use File::Slurp; +use File::Spec; +use File::Slurp qw( read_file ); use Data::Dumper; use t::lib::QA::TemplateFilters; -my @themes; - -# OPAC themes -my $opac_dir = 'koha-tmpl/opac-tmpl'; -opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!"; -for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) { - push @themes, "$opac_dir/$theme/en"; -} -close $dh; - -# STAFF themes -my $staff_dir = 'koha-tmpl/intranet-tmpl'; -opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; -for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { - push @themes, "$staff_dir/$theme/en"; -} -close $dh; - my @files; -sub wanted { - my $name = $File::Find::name; - push @files, $name - if $name =~ m[\.(tt|inc)$] and -f $name; -} -find({ wanted => \&wanted, no_chdir => 1 }, @themes ); +# OPAC +push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.tt'`; +push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; + +# Staff +push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; +push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; my @errors; for my $file ( @files ) { + chomp $file; my $content = read_file($file); my @e = t::lib::QA::TemplateFilters::missing_filters($content); push @errors, { file => $file, errors => \@e } if @e; -- 2.25.1