Bug 39149: Make tidy.pl deal with .PL files

This patch adds handling for files with the `.PL` extension to the
`tidy.pl` helper script.

It will now consider them Perl files and tidy them as appropriate.

I opted for explicitly listing `PL` instead of making the existing check
case-insensitive because the only files I found with changed case (i.e.
Perl scripts that don't have `.pl`) are:

$ find . -type f -iname "*.pl" ! -name "*.pl"
./fix-perl-path.PL
./build-resources.PL
./rewrite-config.PL
./Makefile.PL

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomás Cohen Arazi 2025-02-17 17:19:57 +00:00 committed by Katrin Fischer
parent da6996c08e
commit 63cba14abd
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -143,7 +143,7 @@ sub build_git_exclude {
}
sub get_perl_files {
my $cmd = sprintf q{git ls-files '*.pl' '*.pm' '*.t' svc opac/svc %s}, build_git_exclude('pl');
my $cmd = sprintf q{git ls-files '*.pl' '*.PL' '*.pm' '*.t' svc opac/svc %s}, build_git_exclude('pl');
my @files = qx{$cmd};
chomp for @files;
return @files;
@ -219,8 +219,9 @@ sub tidy_tt {
sub get_filetype {
my ($file) = @_;
return 'pl' if $file =~ m{^svc} || $file =~ m{^opac/svc};
return 'pl' if $file =~ m{^svc} || $file =~ m{^opac/svc};
return 'pl' if $file =~ m{\.pl$} || $file =~ m{\.pm} || $file =~ m{\.t$};
return 'pl' if $file =~ m{\.PL$};
return 'js' if $file =~ m{\.js$} || $file =~ m{\.ts$} || $file =~ m{\.vue$};