Lines 1-8
Link Here
|
1 |
#!/bin/sh |
1 |
#!/usr/bin/perl |
2 |
# |
2 |
|
3 |
# Script to find files that probably should not be executed. |
3 |
# Script to find files that probably should not be executed. |
4 |
# |
4 |
# |
5 |
# Copyright 2010 Catalyst IT Ltd |
5 |
# Copyright 2010 Catalyst IT Ltd |
|
|
6 |
# Copyright 2020 Koha Development Team |
6 |
# |
7 |
# |
7 |
# This file is part of Koha. |
8 |
# This file is part of Koha. |
8 |
# |
9 |
# |
Lines 19-38
Link Here
|
19 |
# You should have received a copy of the GNU General Public License |
20 |
# You should have received a copy of the GNU General Public License |
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
|
22 |
|
22 |
set -e |
23 |
use Modern::Perl; |
|
|
24 |
use File::Find; |
25 |
use Data::Dumper; |
26 |
use Test::More tests => 1; |
27 |
|
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 |
35 |
|
36 |
# Search for missing x in svc, xt and t |
37 |
if ( $name =~ m[^\./(svc|xt)] && $name ne './xt/perltidyrc' |
38 |
|| $name =~ m[^\./t/.*\.t$] ) |
39 |
{ |
40 |
push @files, $name unless -x $name; |
41 |
} |
42 |
|
43 |
# Search for missing x for .pl and .sh |
44 |
if ( $name =~ m[\.(pl|sh)$] ) { |
45 |
push @files, $name unless -x $name; |
46 |
} |
23 |
|
47 |
|
24 |
find . \ |
48 |
# Search for extra x flag for .pm |
25 |
-name misc -prune \ |
49 |
if ( $name =~ m[\.pm$] ) { |
26 |
-o -name svc -prune \ |
50 |
push @files, $name if -x $name; |
27 |
-o -name xt -prune \ |
51 |
} |
28 |
-o -name t -prune \ |
52 |
} |
29 |
-o -name .git -prune \ |
53 |
find({ wanted => \&wanted, no_chdir => 1}, '.' ); |
30 |
-o -name blib -prune \ |
54 |
is(@files, 0) or diag(Dumper @files) ; |
31 |
-o -name scripts -prune \ |
|
|
32 |
-o -name debian -prune \ |
33 |
-o -executable -type f \ |
34 |
'!' -name '*.pl' \ |
35 |
'!' -name '*.sh' \ |
36 |
'!' -name '*.plugin' \ |
37 |
'!' -name unapi \ |
38 |
-print |
39 |
- |
|
|