CheckBasicStyle: Doesn't require LuaFileSystem.
Instead it uses the list of files generated by CMake.
This commit is contained in:
parent
5194eef07d
commit
26ad3dbee4
@ -23,26 +23,12 @@ the line brings the editor directly to the violation.
|
|||||||
|
|
||||||
Returns 0 on success, 1 on internal failure, 2 if any violations found
|
Returns 0 on success, 1 on internal failure, 2 if any violations found
|
||||||
|
|
||||||
This script requires LuaFileSystem to be available in the current Lua interpreter.
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Check that LFS is installed:
|
|
||||||
local hasLfs = pcall(require, "lfs")
|
|
||||||
if not(hasLfs) then
|
|
||||||
print("This script requires LuaFileSystem to be installed")
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
local lfs = require("lfs")
|
|
||||||
assert(lfs ~= nil)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- The list of file extensions that are processed:
|
-- The list of file extensions that are processed:
|
||||||
local g_ShouldProcessExt =
|
local g_ShouldProcessExt =
|
||||||
{
|
{
|
||||||
@ -53,13 +39,12 @@ local g_ShouldProcessExt =
|
|||||||
--- The list of files not to be processed:
|
--- The list of files not to be processed:
|
||||||
local g_IgnoredFiles =
|
local g_IgnoredFiles =
|
||||||
{
|
{
|
||||||
"./Bindings/Bindings.cpp",
|
"Bindings/Bindings.cpp",
|
||||||
"./Bindings/DeprecatedBindings.cpp",
|
"LeakFinder.cpp",
|
||||||
"./LeakFinder.cpp",
|
"LeakFinder.h",
|
||||||
"./LeakFinder.h",
|
"MersenneTwister.h",
|
||||||
"./MersenneTwister.h",
|
"StackWalker.cpp",
|
||||||
"./StackWalker.cpp",
|
"StackWalker.h",
|
||||||
"./StackWalker.h",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The list of files not to be processed, as a dictionary (filename => true), built from g_IgnoredFiles
|
--- The list of files not to be processed, as a dictionary (filename => true), built from g_IgnoredFiles
|
||||||
@ -198,17 +183,6 @@ local function ProcessItem(a_ItemName)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If the item is a folder, recurse:
|
|
||||||
local attrs = lfs.attributes(a_ItemName)
|
|
||||||
if (attrs and (attrs.mode == "directory")) then
|
|
||||||
for fnam in lfs.dir(a_ItemName) do
|
|
||||||
if ((fnam ~= ".") and (fnam ~= "..")) then
|
|
||||||
ProcessItem(a_ItemName .. "/" .. fnam)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ext = a_ItemName:match("%.([^/%.]-)$")
|
local ext = a_ItemName:match("%.([^/%.]-)$")
|
||||||
if (g_ShouldProcessExt[ext]) then
|
if (g_ShouldProcessExt[ext]) then
|
||||||
ProcessFile(a_ItemName)
|
ProcessFile(a_ItemName)
|
||||||
@ -219,8 +193,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Process the entire current folder:
|
-- Process all files in the AllFiles.lst file (generated by cmake):
|
||||||
ProcessItem(".")
|
for fnam in io.lines("AllFiles.lst") do
|
||||||
|
ProcessItem(fnam)
|
||||||
|
end
|
||||||
|
|
||||||
-- Report final verdict:
|
-- Report final verdict:
|
||||||
print("Number of violations found: " .. g_NumViolations)
|
print("Number of violations found: " .. g_NumViolations)
|
||||||
|
Loading…
Reference in New Issue
Block a user