-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscan.lua
More file actions
58 lines (52 loc) · 1.22 KB
/
scan.lua
File metadata and controls
58 lines (52 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
_G.love = _G.love or {}
_G.jit = _G.jit or {}
_G.ffi = _G.ffi or {}
local lfs = require('lfs')
local ss = require('sstrict')
ss.panic = false
print('scanning...')
print('\n')
local checked = 0
local errors = {}
local function scan(path)
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
local full = path..'/'..file
local attr = lfs.attributes(full)
if attr.mode == 'directory' then
scan(full)
elseif attr.mode == 'file' then
if file:match('%.lua$') then
checked = checked + 1
local ok, err = ss.parseFile(full)
local out = checked..". "..full
local n = 0
if not ok and err then
for _, v in ipairs(err) do
--print(v)
table.insert(errors, v)
n = n + 1
end
end
if n > 0 then
out = out..' ('..n..' errors)'
end
print(out)
end
end
end
end
end
scan(arg[1] or '.')
print('\n')
print(checked..' files scanned')
print('\n')
if #errors > 0 then
for _, v in ipairs(errors) do
print(v)
end
print('\n')
end
print(#errors.." errors found")
print('\n')
assert(#errors == 0, #errors..' errors found')