Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions analyzeall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

local id = ID("analyzeall.analyzeall")

local function path2mask(s)
local function pathEscape(s)
return s
:gsub('([%(%)%.%%%+%-%?%[%^%$%]])','%%%1') -- escape all special symbols
:gsub("%*", ".*") -- but expand asterisk into sequence of any symbols
:gsub("[\\/]","[\\\\/]") -- allow for any path
end

local function path2mask(s)
return pathEscape(s)
:gsub("%*", ".*") -- expand asterisk into sequence of any symbols
end

local function analyzeProject(self)
local frame = ide:GetMainFrame()
ide:GetOutput():Erase()
Expand All @@ -18,11 +22,12 @@ local function analyzeProject(self)
local errors, warnings = 0, 0
local projectPath = ide:GetProject()
if projectPath then
local projectMask = pathEscape(projectPath)
local specs = self:GetConfig().ignore or {}
local masks = {}
for i in ipairs(specs) do masks[i] = "^"..path2mask(specs[i]).."$" end
for _, filePath in ipairs(ide:GetFileList(projectPath, true, "*.lua")) do
local checkPath = filePath:gsub(projectPath, "")
local checkPath = filePath:gsub(projectMask, "")
local ignore = false
for _, spec in ipairs(masks) do
ignore = ignore or checkPath:find(spec)
Expand Down