Bugzilla – Attachment 151269 Details for
Bug 33743
xt/find-missing-filters.t parsing files outside of git repo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33743: Make xt/find-missing-filters.t and xt/single_quotes.t check directories in git index only
Bug-33743-Make-xtfind-missing-filterst-and-xtsingl.patch (text/plain), 3.83 KB, created by
Jonathan Druart
on 2023-05-16 10:57:07 UTC
(
hide
)
Description:
Bug 33743: Make xt/find-missing-filters.t and xt/single_quotes.t check directories in git index only
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-05-16 10:57:07 UTC
Size:
3.83 KB
patch
obsolete
>From 922c7668a5da5ba20f40a577718f4734c9d60d84 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 May 2023 12:52:22 +0200 >Subject: [PATCH] Bug 33743: Make xt/find-missing-filters.t and > xt/single_quotes.t check directories in git index only > >--- > xt/find-missing-filters.t | 35 ++++++++----------------------- > xt/single_quotes.t | 43 +++++++++++++++------------------------ > 2 files changed, 25 insertions(+), 53 deletions(-) > >diff --git a/xt/find-missing-filters.t b/xt/find-missing-filters.t >index 6b7e80f4aa3..2cd461a56a4 100755 >--- a/xt/find-missing-filters.t >+++ b/xt/find-missing-filters.t >@@ -17,40 +17,23 @@ > > use Modern::Perl; > use Test::More tests => 1; >-use File::Find; >-use File::Slurp; >+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; >diff --git a/xt/single_quotes.t b/xt/single_quotes.t >index 402b51cc64b..2c88d78c335 100755 >--- a/xt/single_quotes.t >+++ b/xt/single_quotes.t >@@ -19,39 +19,28 @@ > > use Modern::Perl; > use Test::More tests => 1; >-use File::Find; >+use File::Slurp qw( read_file ); > >-my @themes; >+my @files; > >-# 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; >+# 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 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; >+# 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 @files; >-find( >- sub { >- open my $fh, '<', $_ or die "Could not open $_: $!"; >- my @lines = sort grep /\_\(\'/, <$fh>; >- push @files, { name => "$_", lines => \@lines } if @lines; >- }, >- @themes >-); >+my @errors; >+for my $file ( @files ) { >+ chomp $file; >+ my @lines = sort grep /\_\(\'/, read_file($file); >+ push @errors, { name => $file, lines => \@lines } if @lines; >+} > >-ok( !@files, "Files do not contain single quotes _(' " ) >+ok( !@errors, "Files do not contain single quotes _(' " ) > or diag( > "Files list: \n", > join( "\n", >- map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @files ) >+ map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @errors ) > ); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33743
:
151268
| 151269