From 26ad3dbee4aacef035e2d085fecdc5610469fc7d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Jul 2014 17:38:36 +0200 Subject: [PATCH] CheckBasicStyle: Doesn't require LuaFileSystem. Instead it uses the list of files generated by CMake. --- src/CheckBasicStyle.lua | 44 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index fba30ea98..e85c074dc 100644 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -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)