luacheck
TLDR
Check Lua file
$ luacheck [file.lua]
Check directory recursively$ luacheck [directory]
Check with specific standard$ luacheck --std [lua53] [file.lua]
Ignore specific warnings$ luacheck --ignore [211] [file.lua]
Output in different format$ luacheck --formatter [TAP] [file.lua]
Check from stdin$ cat [file.lua] | luacheck -
SYNOPSIS
luacheck [options] files...
DESCRIPTION
luacheck is a static analyzer and linter for Lua. It detects various issues including undefined globals, unused variables, unreachable code, and stylistic problems.
luacheck supports multiple Lua versions and can be configured per-project.
PARAMETERS
--std std
Lua version standard.--ignore codes
Ignore warning codes.--only codes
Show only specific codes.--globals names
Allowed globals.--formatter fmt
Output format (TAP, JUnit, plain).--codes
Show warning codes.-q, --quiet
Less verbose output.--config file
Config file path.
CONFIGURATION
$ -- .luacheckrc
std = "lua53"
globals = {"myGlobal"}
ignore = {"212"} -- unused argument
std = "lua53"
globals = {"myGlobal"}
ignore = {"212"} -- unused argument
CAVEATS
Static analysis only; won't catch runtime errors. May have false positives with dynamic code. Different standards for different Lua versions.
HISTORY
luacheck was created by Peter Melnichenko as a comprehensive Lua static analysis tool, filling the gap of linting tools for Lua.


