06-26-2015, 11:31 PM
09-11-2016, 05:18 PM
Found a nice tool for checking lua code and added it as a external tool in Decoda
Name: luacheck
link: https://github.com/mpeterv/luacheck
As external tool in Decoda:
Title: Luacheck
Command: luacheck
Arguments: $(ItemDir) -g -a
-g ignore global variables, for example cPluginManger
-a ignore unused function arguments
With this 2 flags it creates a useful output.
Edit: Here a small output from Core
Warnings:
Core\banlist.lua:251:9: unused variable 'Reason'
Core\banlist.lua:253:9: unused variable 'Reason'
As you see the variable Reason is defined inside of a if block and Reason is nil here

Name: luacheck
link: https://github.com/mpeterv/luacheck
As external tool in Decoda:
Title: Luacheck
Command: luacheck
Arguments: $(ItemDir) -g -a
-g ignore global variables, for example cPluginManger
-a ignore unused function arguments
With this 2 flags it creates a useful output.
Edit: Here a small output from Core
Warnings:
Core\banlist.lua:251:9: unused variable 'Reason'
Core\banlist.lua:253:9: unused variable 'Reason'
Code:
-- If the player supplied a reason, use that, else use a default reason.
if (a_Split[3] ~= nil) then
local Reason = table.concat(a_Split, " ", 3)
else
local Reason = "No reason."
end
-- Add the player to the banlist:
AddPlayerToBanlist(a_Split[2], Reason, a_Player:GetName());
As you see the variable Reason is defined inside of a if block and Reason is nil here

09-12-2016, 01:54 AM
Looks nice, should be pretty easy to add to ZeroBraneStudio as well.
It might be a great addition to plugin CI tests, together with my PluginChecker, if it ever sees the light of the day
Are you seriously still using Decoda? It is really outdated and there are other IDEs much better equipped for Cuberite plugin development.
It might be a great addition to plugin CI tests, together with my PluginChecker, if it ever sees the light of the day

Are you seriously still using Decoda? It is really outdated and there are other IDEs much better equipped for Cuberite plugin development.
09-12-2016, 04:20 AM
I looked into ZeroBraneStudio, it has a static analyzer but it looks like it only works for the current open file. Yes it could be nice for CI tests.
It's also possible to install it as a module and then use it in lua.
It's also possible to install it as a module and then use it in lua.
09-12-2016, 04:52 AM
If you installed the Cuberite module into ZBS, as is described in the API docs article ( http://apidocs.cuberite.org/SettingUpZeroBrane.html ), then ZBS actually can analyze the plugins in the very same way as Cuberite does - it has an implementation of joining the files together and using the correct load order (alpha-sorted, with Info.lua last) etc. It can also call the utility scripts - InfoDump.lua (converts Info.lua into README.md and forum thread post text)