Improve linter performance (#2083)

Only compute args if we are actually going to use it
This commit is contained in:
Jeff Zhao
2021-06-01 19:34:10 -04:00
committed by GitHub
parent b66ec2bf7a
commit ee9c78dc86

View File

@@ -123,12 +123,11 @@ function runLinter(buf)
ftmatch = false
end
local args = {}
for k, arg in pairs(v.args) do
args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
end
if ftmatch then
local args = {}
for k, arg in pairs(v.args) do
args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
end
lint(buf, k, v.cmd, args, v.errorformat, v.loffset, v.coffset, v.callback)
end
end