forked from liquidev/lintplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp.lua
40 lines (35 loc) · 869 Bytes
/
php.lua
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
-- PHP lint plugin for lint+
--- CONFIG ---
-- config.lint.php_args: {string}
-- passes the specified arguments to php
--- IMPLEMENTATION ---
local lintplus = require "plugins.lintplus"
lintplus.add("php") {
filename = "%.php$",
procedure = {
command = lintplus.args_command(
{
"php",
"-l",
lintplus.args,
lintplus.filename
},
"php_args"
),
interpreter = function (filename, line, context)
local line_processed = false
return function ()
if line_processed then
return nil
end
local message, file, line_num = line:match(
"[%a ]+:%s*(.*)%s+in%s+(%g+)%s+on%sline%s+(%d+)"
)
if line_num then
line_processed = true
return filename, tonumber(line_num), 1, "error", message
end
end
end
},
}