summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-21 17:38:36 +0200
committermadmaxoft <github@xoft.cz>2014-07-21 17:40:45 +0200
commit26ad3dbee4aacef035e2d085fecdc5610469fc7d (patch)
treef3e4827b89c309e007caab772bcfd88b7249b88c
parentCMake: generates a list of all source files. (diff)
downloadcuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar.gz
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar.bz2
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar.lz
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar.xz
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.tar.zst
cuberite-26ad3dbee4aacef035e2d085fecdc5610469fc7d.zip
-rw-r--r--src/CheckBasicStyle.lua44
1 files 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)