1
0
Fork 0

CheckBasicStyle: Doesn't require LuaFileSystem.

Instead it uses the list of files generated by CMake.
This commit is contained in:
madmaxoft 2014-07-21 17:38:36 +02:00
parent 5194eef07d
commit 26ad3dbee4
1 changed files with 10 additions and 34 deletions

View File

@ -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
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:
local g_ShouldProcessExt =
{
@ -53,13 +39,12 @@ local g_ShouldProcessExt =
--- The list of files not to be processed:
local g_IgnoredFiles =
{
"./Bindings/Bindings.cpp",
"./Bindings/DeprecatedBindings.cpp",
"./LeakFinder.cpp",
"./LeakFinder.h",
"./MersenneTwister.h",
"./StackWalker.cpp",
"./StackWalker.h",
"Bindings/Bindings.cpp",
"LeakFinder.cpp",
"LeakFinder.h",
"MersenneTwister.h",
"StackWalker.cpp",
"StackWalker.h",
}
--- 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
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("%.([^/%.]-)$")
if (g_ShouldProcessExt[ext]) then
ProcessFile(a_ItemName)
@ -219,8 +193,10 @@ end
-- Process the entire current folder:
ProcessItem(".")
-- Process all files in the AllFiles.lst file (generated by cmake):
for fnam in io.lines("AllFiles.lst") do
ProcessItem(fnam)
end
-- Report final verdict:
print("Number of violations found: " .. g_NumViolations)