summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/APIDump
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-12-15 14:13:09 +0100
committerMattes D <github@xoft.cz>2016-12-15 14:13:09 +0100
commitf5adb67f2f0752300b41888adb021fe47b0273d8 (patch)
tree6bb0528e9afbd59d60e3da669bb9976b4a9045df /Server/Plugins/APIDump
parentFixed ToLua compatibility between Lua 5.1 and Lua 5.2+. (diff)
downloadcuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar.gz
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar.bz2
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar.lz
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar.xz
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.tar.zst
cuberite-f5adb67f2f0752300b41888adb021fe47b0273d8.zip
Diffstat (limited to 'Server/Plugins/APIDump')
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua24
1 files changed, 15 insertions, 9 deletions
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua
index a6824c29d..adb2b1c1c 100644
--- a/Server/Plugins/APIDump/main_APIDump.lua
+++ b/Server/Plugins/APIDump/main_APIDump.lua
@@ -1638,7 +1638,7 @@ end
local function DumpLuaCheck(a_API)
LOG("Creating file .luacheckrc...")
local file = io.open(".luacheckrc", "w")
-
+
file:write([[
-- This file is the config file for the tool named Luacheck
-- Documentation: http://luacheck.readthedocs.io/en/stable/index.html
@@ -1669,7 +1669,7 @@ exclude_files =
globals =
{
]])
-
+
-- Export all global symbols
for _, cls in ipairs(a_API) do
if cls.Name == "Globals" then
@@ -1677,12 +1677,12 @@ globals =
for _, func in ipairs(cls.Functions) do
file:write("\t\"", func.Name, "\",\n")
end
-
+
-- Global constants
for _, const in ipairs(cls.Constants) do
file:write("\t\"", const.Name, "\",\n")
end
-
+
-- Global constants from all groups
for _, group in pairs(cls.ConstantGroups) do
for _, const in pairs(group.Constants) do
@@ -1693,10 +1693,10 @@ globals =
file:write("\t\"", cls.Name, "\",\n")
end
end
-
+
file:write("}\n")
file:close()
-
+
LOG("Config file .luacheckrc created...")
end
@@ -1872,7 +1872,7 @@ local function DumpApi()
-- Dump all available API objects in format used by ZeroBraneStudio API descriptions:
DumpAPIZBS(API)
-
+
-- Export the API in a format used by LuaCheck
DumpLuaCheck(API)
@@ -1886,6 +1886,8 @@ end
--- Checks the currently undocumented symbols against an "official" undocumented symbol list
-- Returns an array-table of strings representing the newly-undocumented symbol names
+-- If no newly undocumented symbols are found, returns no value.
+-- If an error occurs, returns true and error message.
local function CheckNewUndocumentedSymbols()
-- Download the official API stats on undocumented stuff:
-- (We need a blocking downloader, which is impossible with the current cNetwork API)
@@ -2103,9 +2105,13 @@ local function HandleCmdApiCheck(a_Split, a_EntireCmd)
-- Check for new symbols that are not documented:
LOG("Checking API for newly undocumented symbols...")
- local newUndocumented = CheckNewUndocumentedSymbols()
+ local newUndocumented, msg = CheckNewUndocumentedSymbols()
if (newUndocumented) then
- return true, "Found new undocumented symbols:\n" .. table.concat(newUndocumented, "\n")
+ if (newUndocumented == true) then
+ return true, "Cannot check for new undocumented symbols: " .. (msg or "<no message>")
+ else
+ return true, "Found new undocumented symbols:\n" .. table.concat(newUndocumented, "\n")
+ end
end
-- The check completed successfully, remove the "test failed" flag from the filesystem: