lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm announcing the first release of luacheck, a simple static analyzer for Lua. 

luacheck scans Lua source and detects undefined, redefined(defined twice in the same scope) and unused variables. These are very basic checks, but if there are warnings, they usually point to dead code, accidental global namespace pollution or even bugs. [1]

luacheck provides a pretty command-line interface for basic usage and a Lua module for using luacheck in a programmable way. [2]

For more info, check out the luacheck page on github:

I've published the rockspec on the luarocks mailing list, in the meantime luacheck can be installed from moonrocks[3]:

    [sudo] luarocks install --server= luacheck

luacheck wouldn't have happened without the awesome Metalua[4] parser[5]. 

Any feedback would be appreciated. 


[1] The lowest signal/noise ratio is typically for `unused variable` warnings, because in most codebases I've checked there is no policy to name unavoidable unused variables with an underscore. If there are too many unused variables, try `--no-unused-args` command-line flag to make luacheck ignore unused function arguments and loop variables(counters). 

[2] I used this module to automate the process of removing old-style `module` from luarocks codebase to make it work on Lua 5.2 without LUA_COMPAT_MODULE.