Bug 26237: Move translatable strings out of preferences.tt and into JavaScript files
[koha.git] / xt / find-misplaced-executables.t
blob74c6e6f18ed00a5ea5423f5e392ebaf3498470e2
1 #!/usr/bin/perl
3 # Script to find files that probably should not be executed.
5 # Copyright 2010 Catalyst IT Ltd
6 # Copyright 2020 Koha Development Team
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # Koha is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use Modern::Perl;
24 use File::Find;
25 use Data::Dumper;
26 use Test::More tests => 1;
28 my @files;
29 sub wanted {
30 my $name = $File::Find::name;
31 # Ignore files in .git, blib and node_modules
32 return if $name =~ m[^\./(.git|blib|node_modules)];
33 # Ignore directories
34 return if -d $name; # Skip dir
36 # Search for missing x in svc, xt and t
37 if ( $name =~ m[^\./(svc|xt)] && $name !~ m[\./xt/(perltidyrc|fix-old-fsf-address\.exclude)]
38 || $name =~ m[^\./t/.*\.t$] )
40 push @files, $name unless -x $name;
43 # Search for missing x for .pl and .sh
44 if ( $name =~ m[\.(pl|sh)$] ) {
45 push @files, $name unless -x $name;
48 # Search for extra x flag for .pm
49 if ( $name =~ m[\.pm$] ) {
50 push @files, $name if -x $name;
53 find({ wanted => \&wanted, no_chdir => 1}, '.' );
54 is(@files, 0) or diag(Dumper @files) ;