File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 3
3
use strict;
4
4
use warnings;
5
5
6
- use File::Slurp qw( read_file) ;
7
-
8
6
sub file_contains ($$);
9
7
10
8
my $version ;
@@ -44,16 +42,22 @@ for my $file (map glob, qw{ *.lua lib/*.lua lib/*/*.lua lib/*/*/*.lua lib/*/*/*/
44
42
print " Checking use of Lua global variables in file $file ...\n " ;
45
43
system (" luac -p -l $file | grep ETGLOBAL | grep -vE 'require|type|tostring|error|ngx|ndk|jit|setmetatable|getmetatable|string|table|io|os|print|tonumber|math|pcall|xpcall|unpack|pairs|ipairs|assert|module|package|coroutine|[gs]etfenv|next'" );
46
44
# file_contains($file, "attempt to write to undeclared variable");
45
+ system (" grep -H -n -E --color '.{81}' $file " );
47
46
}
48
47
49
48
sub file_contains ($$) {
50
49
my ($file , $regex ) = @_ ;
51
- my $content = read_file($file );
50
+ open my $in , $file
51
+ or die " Cannot open $file fo reading: $! \n " ;
52
+ my $content = do { local $/ ; <$in > };
53
+ close $in ;
52
54
# print "$content";
53
55
return scalar ($content =~ / $regex / );
54
56
}
55
57
56
- system (" ack '.{81}' `find lib -name '*.lua'`" );
57
- system (q{ ack '\b(?:ONLY|LAST)\b' t} );
58
- system (q{ ack -l '\r\n' t} );
58
+ if (-d ' t' ) {
59
+ for my $file (map glob , qw{ t/*.t t/*/*.t t/*/*/*.t } ) {
60
+ system (qq{ grep -H -n --color -E '\\ --- ?(ONLY|LAST)' $file } );
61
+ }
62
+ }
59
63
You can’t perform that action at this time.
0 commit comments