8000 Luacheck · Actions · GitHub Marketplace · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 script type="application/json" data-target="react-app.embeddedData">{"payload":{"action":{"categories":[{"name":"Code quality","slug":"code-quality"},{"name":"Testing","slug":"testing"}],"color":"ffd33d","description":"Luacheck\n","iconSvg":"\u003csvg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n\u003e\n \u003cpolyline points=\"20 6 9 17 4 12\" /\u003e\n\u003c/svg\u003e\n","id":444750,"isVerifiedOwner":false,"name":"Luacheck","ownerLogin":"lunarmodules","slug":"luacheck","stars":397,"type":"repository_action","externalUsesPathPrefix":"lunarmodules/luacheck@","globalRelayId":"MDE2OlJlcG9zaXRvcnlBY3Rpb240NDQ3NTA="},"readmeHtml":"\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 class=\"heading-element\" dir=\"auto\"\u003eLuacheck\u003c/h1\u003e\u003ca id=\"user-content-luacheck\" class=\"anchor\" aria-label=\"Permalink: Luacheck\" href=\"#luacheck\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://gitter.im/luacheck/Lobby?utm_source=badge\u0026amp;utm_medium=badge\u0026amp;utm_campaign=pr-badge\u0026amp;utm_content=badge\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/b872aaa409121d63191034e3b00958df9c2b270b845abba5e71831eec9acf11f/68747470733a2f2f6261646765732e6769747465722e696d2f6c7561636865636b2f4c6f6262792e737667\" alt=\"Join the chat at https://gitter.im/luacheck/Lobby\" data-canonical-src=\"https://badges.gitter.im/luacheck/Lobby.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/lunarmodules/luacheck/actions?workflow=Luacheck\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/c40e20d9e0d19f52ecd2fc7e311dba162160076876108f9c1dccba8ed055e3b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756e61726d6f64756c65732f6c7561636865636b2f6c7561636865636b2e796d6c3f6272616e63683d6d6173746572266c6162656c3d4c7561636865636b266c6f676f3d4c7561\" alt=\"Luacheck\" data-canonical-src=\"https://img.shields.io/github/actions/workflow/status/lunarmodules/luacheck/luacheck.yml?branch=master\u0026amp;label=Luacheck\u0026amp;logo=Lua\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/lunarmodules/luacheck/actions?workflow=Busted\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/0d91b4354f5d8f96a755bad1c6dea0397c4b61cb1e6cb9f11073d68d006e9de0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756e61726d6f64756c65732f6c7561636865636b2f6275737465642e796d6c3f6272616e63683d6d6173746572266c6162656c3d427573746564266c6f676f3d4c7561\" alt=\"Busted\" data-canonical-src=\"https://img.shields.io/github/actions/workflow/status/lunarmodules/luacheck/busted.yml?branch=master\u0026amp;label=Busted\u0026amp;logo=Lua\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/lunarmodules/luacheck?branch=master\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/41e3b084e7dee7da272df89b7845377a29598fde508d5b0c3a614107c3e175b8/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f6c756e61726d6f64756c65732f6c7561636865636b3f6c6162656c3d436f766572616c6c73266c6f676f3d436f766572616c6c73\" alt=\"Coverage Status\" data-canonical-src=\"https://img.shields.io/coveralls/github/lunarmodules/luacheck?label=Coveralls\u0026amp;logo=Coveralls\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/lunarmodules/luacheck/releases\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7a50c26aa031a30e3612142aef4b2d8dc9d30e9fa3d85a0a48c8e6bdaa37223b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6c756e61726d6f64756c65732f6c7561636865636b3f6c6162656c3d546167266c6f676f3d476974487562\" alt=\"GitHub tag (latest SemVer)\" data-canonical-src=\"https://img.shields.io/github/v/tag/lunarmodules/luacheck?label=Tag\u0026amp;logo=GitHub\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://luarocks.org/modules/lunarmodules/luacheck\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/6a0ba8de7084e4403705c2e05d28df1302550f29b6edb5efb004ba7817bce435/68747470733a2f2f696d672e736869656c64732e696f2f6c7561726f636b732f762f6c756e61726d6f64756c65732f6c7561636865636b3f6c6162656c3d4c7561726f636b73266c6f676f3d4c7561\" alt=\"Luarocks\" data-canonical-src=\"https://img.shields.io/luarocks/v/lunarmodules/luacheck?label=Luarocks\u0026amp;logo=Lua\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eContents\u003c/h2\u003e\u003ca id=\"user-content-contents\" class=\"anchor\" aria-label=\"Permalink: Contents\" href=\"#contents\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#overview\"\u003eOverview\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#basic-usage\"\u003eBasic usage\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#related-projects\"\u003eRelated projects\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#documentation\"\u003eDocumentation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#development\"\u003eDevelopment\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#building-and-testing\"\u003eBuilding and testing\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eOverview\u003c/h2\u003e\u003ca id=\"user-content-overview\" class=\"anchor\" aria-label=\"Permalink: Overview\" href=\"#overview\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eLuacheck is a static analyzer and a linter for \u003ca href=\"http://www.lua.org\" rel=\"nofollow\"\u003eLua\u003c/a\u003e. Luacheck detects various issues such as usage of undefined global variables, unused variables and values, accessing uninitialized variables, unreachable code and more. Most aspects of checking are configurable: there are options for defining custom project-related globals, for selecting set of standard globals (version of Lua standard library), for filtering warnings by type and name of related variable, etc. The options can be used on the command line, put into a config or directly into checked files as Lua comments.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eLuacheck supports checking Lua files using syntax of Lua 5.1 - 5.4, and LuaJIT. Luacheck itself is written in Lua and runs on all of mentioned Lua versions.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eInstallation\u003c/h2\u003e\u003ca id=\"user-content-installation\" class=\"anchor\" aria-label=\"Permalink: Installation\" href=\"#installation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 class=\"heading-element\" dir=\"auto\"\u003eUsing LuaRocks\u003c/h3\u003e\u003ca id=\"user-content-using-luarocks\" class=\"anchor\" aria-label=\"Permalink: Using LuaRocks\" href=\"#using-luarocks\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFrom your command line run the following command (using \u003ccode\u003esudo\u003c/code\u003e if necessary):\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"luarocks install luacheck\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eluarocks install luacheck\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor parallel checking Luacheck additionally requires \u003ca href=\"https://github.com/LuaLanes/lanes\"\u003eLuaLanes\u003c/a\u003e, which can be installed using LuaRocks as well (\u003ccode\u003eluarocks install lanes\u003c/code\u003e).\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 class=\"heading-element\" dir=\"auto\"\u003eWindows binary download\u003c/h3\u003e\u003ca id=\"user-content-windows-binary-download\" class=\"anchor\" aria-label=\"Permalink: Windows binary download\" href=\"#windows-binary-download\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor Windows there is single-file 64-bit binary distribution, bundling Lua 5.4.4, Luacheck, LuaFileSystem, and LuaLanes using \u003ca href=\"https://github.com/ers35/luastatic\"\u003eLuaStatic\u003c/a\u003e:\n\u003ca href=\"https://github.com/lunarmodules/luacheck/releases/download/v1.2.0/luacheck.exe\"\u003edownload\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eBasic usage\u003c/h2\u003e\u003ca id=\"user-content-basic-usage\" class=\"anchor\" aria-label=\"Permalink: Basic usage\" href=\"#basic-usage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAfter Luacheck is installed, run \u003ccode\u003eluacheck\u003c/code\u003e program from the command line. Pass a list of files, \u003ca href=\"https://github.com/luarocks/luarocks/wiki/Rockspec-format\"\u003erockspecs\u003c/a\u003e or directories (requires LuaFileSystem) to be checked:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"luacheck src extra_file.lua another_file.lua\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eluacheck src extra_file.lua another_file.lua\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"Checking src/good_code.lua OK\nChecking src/bad_code.lua 3 warnings\n\n src/bad_code.lua:3:23: unused variable length argument\n src/bad_code.lua:7:10: setting non-standard global variable embrace\n src/bad_code.lua:8:10: variable opt was previously defined as an argument on line 7\n\nChecking src/python_code.lua 1 error\n\n src/python_code.lua:1:6: expected '=' near '__future__'\n\nChecking extra_file.lua 5 warnings\n\n extra_file.lua:3:18: unused argument baz\n extra_file.lua:4:8: unused loop variable i\n extra_file.lua:13:7: accessing uninitialized variable a\n extra_file.lua:14:1: value assigned to variable x is unused\n extra_file.lua:21:7: variable z is never accessed\n\nChecking another_file.lua 2 warnings\n\n another_file.lua:2:7: unused variable height\n another_file.lua:3:7: accessing undefined variable heigth\n\nTotal: 10 warnings / 1 error in 5 files\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eChecking src/good_code.lua OK\nChecking src/bad_code.lua 3 warnings\n\n src/bad_code.lua:3:23: unused variable length argument\n src/bad_code.lua:7:10: setting non-standard global variable embrace\n src/bad_code.lua:8:10: variable opt was previously defined as an argument on line 7\n\nChecking src/python_code.lua 1 error\n\n src/python_code.lua:1:6: expected '=' near '__future__'\n\nChecking extra_file.lua 5 warnings\n\n extra_file.lua:3:18: unused argument baz\n extra_file.lua:4:8: unused loop variable i\n extra_file.lua:13:7: accessing uninitialized variable a\n extra_file.lua:14:1: value assigned to variable x is unused\n extra_file.lua:21:7: variable z is never accessed\n\nChecking another_file.lua 2 warnings\n\n another_file.lua:2:7: unused variable height\n another_file.lua:3:7: accessing undefined variable heigth\n\nTotal: 10 warnings / 1 error in 5 files\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor more info, see \u003ca href=\"https://luacheck.readthedocs.io/en/stable/\" rel=\"nofollow\"\u003edocumentation\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eRelated projects\u003c/h2\u003e\u003ca id=\"user-content-related-projects\" class=\"anchor\" aria-label=\"Permalink: Related projects\" href=\"#related-projects\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 class=\"heading-element\" dir=\"auto\"\u003eEditor support\u003c/h3\u003e\u003ca id=\"user-content-editor-support\" class=\"anchor\" aria-label=\"Permalink: Editor support\" href=\"#editor-support\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThere are a few plugins which allow using Luacheck directly inside an editor, showing warnings inline:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor Vim, \u003ca href=\"https://github.com/vim-syntastic/syntastic\"\u003eSyntastic\u003c/a\u003e contains \u003ca href=\"https://github.com/vim-syntastic/syntastic/wiki/Lua%3A---luacheck\"\u003eluacheck checker\u003c/a\u003e;\u003c/li\u003e\n\u003cli\u003eFor Sublime Text 3 there is \u003ca href=\"https://packagecontrol.io/packages/SublimeLinter-luacheck\" rel=\"nofollow\"\u003eSublimeLinter-luacheck\u003c/a\u003e which requires \u003ca href=\"https://sublimelinter.readthedocs.io/en/latest/\" rel=\"nofollow\"\u003eSublimeLinter\u003c/a\u003e;\u003c/li\u003e\n\u003cli\u003eFor Atom there is \u003ca href=\"https://atom.io/packages/linter-luacheck\" rel=\"nofollow\"\u003elinter-luacheck\u003c/a\u003e which requires \u003ca href=\"https://github.com/steelbrain/linter\"\u003eAtomLinter\u003c/a\u003e;\u003c/li\u003e\n\u003cli\u003eFor Emacs, \u003ca href=\"http://www.flycheck.org/en/latest/\" rel=\"nofollow\"\u003eFlycheck\u003c/a\u003e contains \u003ca href=\"http://www.flycheck.org/en/latest/languages.html#lua\" rel=\"nofollow\"\u003eluacheck checker\u003c/a\u003e;\u003c/li\u003e\n\u003cli\u003eFor Brackets, there is \u003ca href=\"https://github.com/Malcolm3141/brackets-luacheck\"\u003elinter.luacheck\u003c/a\u003e extension;\u003c/li\u003e\n\u003cli\u003eFor Visual Studio code there is \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=dwenegar.vscode-luacheck\" rel=\"nofollow\"\u003evscode-luacheck\u003c/a\u003e extension. \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=trixnz.vscode-lua\" rel=\"nofollow\"\u003evscode-lua\u003c/a\u003e extension also includes Luacheck support;\u003c/li\u003e\n\u003cli\u003eFor Nova, search the Extension Library for the \u003ca href=\"https://github.com/GarrettAlbright/Luacheck.novaextension\"\u003eLuacheck\u003c/a\u003e extension.\u003c/li\u003e\n\u003cli\u003eFor Geany IDE there is \u003ca href=\"https://github.com/Yenoxel/gealubi\"\u003egeany luacheck bindings\u003c/a\u003e plugin.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eIf you are a plugin developer, see \u003ca href=\"http://luacheck.readthedocs.org/en/stable/cli.html#stable-interface-for-editor-plugins-and-tools\" rel=\"nofollow\"\u003erecommended way of using Luacheck in a plugin\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 class=\"heading-element\" dir=\"auto\"\u003eOther projects\u003c/h3\u003e\u003ca id=\"user-content-other-projects\" class=\"anchor\" aria-label=\"Permalink: Other projects\" href=\"#other-projects\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/luacheck\" rel=\"nofollow\"\u003eLuacheck bindings for Node.js\u003c/a\u003e;\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/gulp-luacheck\" rel=\"nofollow\"\u003eLuacheck plugin for Gulp\u003c/a\u003e.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eDocumentation\u003c/h2\u003e\u003ca id=\"user-content-documentation\" class=\"anchor\" aria-label=\"Permalink: Documentation\" href=\"#documentation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDocumentation is available \u003ca href=\"https://luacheck.readthedocs.io/en/stable/\" rel=\"nofollow\"\u003eonline\u003c/a\u003e. If Luacheck has been installed using LuaRocks, it can be browsed offline using \u003ccode\u003eluarocks doc luacheck\u003c/code\u003e command.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eDocumentation can be built using \u003ca href=\"http://sphinx-doc.org/\" rel=\"nofollow\"\u003eSphinx\u003c/a\u003e: \u003ccode\u003esphinx-build docsrc doc\u003c/code\u003e, the files will be found inside \u003ccode\u003edoc/\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eDevelopment\u003c/h2\u003e\u003ca id=\"user-content-development\" class=\"anchor\" aria-label=\"Permalink: Development\" href=\"#development\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eLuacheck is currently in development. The latest released version is v1.2.0. The interface of the \u003ccode\u003eluacheck\u003c/code\u003e module may change between minor releases. The command line interface is fairly stable.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eUse the Luacheck issue tracker on GitHub to submit bugs, suggestions and questions. Any pull requests are welcome, too.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eBuilding and testing\u003c/h2\u003e\u003ca id=\"user-content-building-and-testing\" class=\"anchor\" aria-label=\"Permalink: Building and testing\" href=\"#building-and-testing\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAfter the Luacheck repo is cloned and changes are made, run \u003ccode\u003eluarocks make\u003c/code\u003e (using \u003ccode\u003esudo\u003c/code\u003e if necessary) from its root directory to install dev version of Luacheck. To run Luacheck using sources in current directory without installing it, run \u003ccode\u003elua -e 'package.path=\"./src/?.lua;./src/?/init.lua;\"..package.path' bin/luacheck.lua ...\u003c/code\u003e. To test Luacheck, ensure that you have \u003ca href=\"http://olivinelabs.com/busted/\" rel=\"nofollow\"\u003ebusted\u003c/a\u003e, \u003ca href=\"https://github.com/starwing/luautf8\"\u003eluautf8\u003c/a\u003e, and \u003ca href=\"https://github.com/lunarmodules/luasocket\"\u003eluasocket\u003c/a\u003e installed and run \u003ccode\u003ebusted\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eDocker\u003c/h2\u003e\u003ca id=\"user-content-docker\" class=\"anchor\" aria-label=\"Permalink: Docker\" href=\"#docker\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAlternatively Luacheck can be run as a standalone docker container.\nThe usage of docker is fairly simple.\nYou can either build your own or download a prebuilt version.\nTo build your own, execute the following command from the source directory of this project:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-shell-session notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ docker build -t ghcr.io/lunarmodules/luacheck:HEAD .\"\u003e\u003cpre\u003e$ \u003cspan class=\"pl-s1\"\u003edocker build -t ghcr.io/lunarmodules/luacheck:HEAD \u003cspan class=\"pl-c1\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo use a prebuilt one, download it from the GitHub Container Registry.\nHere we use the one tagged \u003cem\u003elatest\u003c/em\u003e, but you can substitute \u003cem\u003elatest\u003c/em\u003e for any tagged release.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-shell-session notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ docker pull ghcr.io/lunarmodules/luacheck:latest\"\u003e\u003cpre\u003e$ \u003cspan class=\"pl-s1\"\u003edocker pull ghcr.io/lunarmodules/luacheck:latest\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOnce you have a container you can run it on one file or a source tree (substitute \u003cem\u003elatest\u003c/em\u003e with \u003cem\u003eHEAD\u003c/em\u003e if you built your own or with the tagged version you want if applicable):\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-shell-session notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Run on an entire directory\n$ docker run -v \u0026quot;$(pwd):/data\u0026quot; ghcr.io/lunarmodules/luacheck:latest .\n\n# Run on one file:\n$ docker run -v \u0026quot;$(pwd):/data\u0026quot; ghcr.io/lunarmodules/luacheck:latest bin/luacheck.lua\"\u003e\u003cpre\u003e# \u003cspan class=\"pl-s1\"\u003eRun on an entire directory\u003c/span\u003e\n$ \u003cspan class=\"pl-s1\"\u003edocker run -v \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e$(\u003c/span\u003epwd\u003cspan class=\"pl-pds\"\u003e)\u003c/span\u003e\u003c/span\u003e:/data\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e ghcr.io/lunarmodules/luacheck:latest \u003cspan class=\"pl-c1\"\u003e.\u003c/span\u003e\u003c/span\u003e\n\n# \u003cspan class=\"pl-s1\"\u003eRun on one file:\u003c/span\u003e\n$ \u003cspan class=\"pl-s1\"\u003edocker run -v \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e$(\u003c/span\u003epwd\u003cspan class=\"pl-pds\"\u003e)\u003c/span\u003e\u003c/span\u003e:/data\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e ghcr.io/lunarmodules/luacheck:latest bin/luacheck.lua\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eA less verbose way to run it in most shells is with at alias:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-shell-session notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# In a shell or in your shell's RC file:\n$ alias luacheck='docker run -v \u0026quot;$(pwd):/data\u0026quot; ghcr.io/lunarmodules/luacheck:latest'\n\n# Thereafter just run:\n$ luacheck .\"\u003e\u003cpre\u003e# \u003cspan class=\"pl-s1\"\u003eIn a shell or \u003cspan class=\"pl-k\"\u003ein\u003c/span\u003e your shell\u003cspan cla 8000 ss=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003es RC file:\u003c/span\u003e\u003c/span\u003e\n$ \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003ealias\u003c/span\u003e luacheck=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003edocker run -v \"$(pwd):/data\" ghcr.io/lunarmodules/luacheck:latest\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\n\n# \u003cspan class=\"pl-s1\"\u003eThereafter just run:\u003c/span\u003e\n$ \u003cspan class=\"pl-s1\"\u003eluacheck \u003cspan class=\"pl-c1\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 class=\"heading-element\" dir=\"auto\"\u003eUse as a CI job\u003c/h3\u003e\u003ca id=\"user-content-use-as-a-ci-job\" class=\"anchor\" aria-label=\"Permalink: Use as a CI job\" href=\"#use-as-a-ci-job\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThere are actually many ways to run Luacheck remotely as part of a CI work flow.\nBecause packages are available for many platforms, one way would be to just use your platforms native package installation system to pull them into whatever CI runner environment you already use.\nAnother way is to pull in the prebuilt Docker container and run that.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAs a case study, here is how a workflow could be setup in GitHub Actions:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"name: Luacheck\non: [push, pull_request]\njobs:\n luacheck:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n - name: Luacheck linter\n uses: lunarmodules/luacheck@v1\"\u003e\u003cpre\u003e\u003cspan class=\"pl-ent\"\u003ename\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eLuacheck\u003c/span\u003e\n\u003cspan class=\"pl-ent\"\u003eon\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e[push, pull_request]\u003c/span\u003e\n\u003cspan class=\"pl-ent\"\u003ejobs\u003c/span\u003e:\n \u003cspan class=\"pl-ent\"\u003eluacheck\u003c/span\u003e:\n \u003cspan class=\"pl-ent\"\u003eruns-on\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eubuntu-latest\u003c/span\u003e\n \u003cspan class=\"pl-ent\"\u003esteps\u003c/span\u003e:\n - \u003cspan class=\"pl-ent\"\u003ename\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eCheckout\u003c/span\u003e\n \u003cspan class=\"pl-ent\"\u003euses\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eactions/checkout@v4\u003c/span\u003e\n - \u003cspan class=\"pl-ent\"\u003ename\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eLuacheck linter\u003c/span\u003e\n \u003cspan class=\"pl-ent\"\u003euses\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003elunarmodules/luacheck@v1\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBy default the GH Action is configured to run \u003ccode\u003eluacheck .\u003c/code\u003e, but you can also pass it your own \u003ccode\u003eargs\u003c/code\u003e to replace the default input of \u003ccode\u003e.\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\" - name: Luacheck linter\n uses: lunarmodules/luacheck@v1\n with:\n args: myfile.lua\"\u003e\u003cpre\u003e - \u003cspan class=\"pl-ent\"\u003ename\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003eLuacheck linter\u003c/span\u003e\n \u003cspan class=\"pl-ent\"\u003euses\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003elunarmodules/luacheck@v1\u003c/span\u003e\n \u003cspan class=\"pl-ent\"\u003ewith\u003c/span\u003e:\n \u003cspan class=\"pl-ent\"\u003eargs\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003emyfile.lua\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 class=\"heading-element\" dir=\"auto\"\u003eLicense\u003c/h2\u003e\u003ca id=\"user-content-license\" class=\"anchor\" aria-label=\"Permalink: License\" href=\"#license\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"The MIT License (MIT)\n\nCopyright (c) 2014 - 2018 Peter Melnichenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \u0026quot;Software\u0026quot;), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \u0026quot;AS IS\u0026quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eThe MIT License (MIT)\n\nCopyright (c) 2014 - 2018 Peter Melnichenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n","helpUrl":"https://docs.github.com/articles/about-readmes/","repository":{"id":180188203,"name":"luacheck","owner":"lunarmodules","isDiscussionsActive":false,"hasIssues":true,"hasSecurityPolicy":false,"isThirdParty":true,"isOrganization":true,"contributorsCount":0,"topContributorsData":[],"openIssuesCount":28,"openPullRequestsCount":9},"releaseData":{"selectedRelease":null,"latestRelease":{"tagName":"v1.2.0","name":"v1.2.0","isPrerelease":false},"releases":[{"tagName":"v1.1.2","name":"v1.1.2","isPrerelease":false},{"tagName":"v1.1.1","name":"v1.1.1","isPrerelease":false},{"tagName":"v1.1.0","name":"v1.1.0","isPrerelease":false},{"tagName":"v1.0.0","name":"","isPrerelease":false},{"tagName":"v0.26.0","name":"v0.26.0","isPrerelease":false}]},"repoAdminableByViewer":false,"loggedIn":false,"starData":{"starredByCurrentUser":false,"currentUserAbleToStar":false,"currentUserEnterpriseName":null}},"title":null,"appPayload":null}

Luacheck

Actions
Luacheck
v1.2.0
Latest
Star (397)

Luacheck

Join the chat at https://gitter.im/luacheck/Lobby

Luacheck Busted Coverage Status GitHub tag (latest SemVer) Luarocks

Contents

Overview

Luacheck is a static analyzer and a linter for Lua. Luacheck detects various issues such as usage of undefined global variables, unused variables and values, accessing uninitialized variables, unreachable code and more. Most aspects of checking are configurable: there are options for defining custom project-related globals, for selecting set of standard globals (version of Lua standard library), for filtering warnings by type and name of related variable, etc. The options can be used on the command line, put into a config or directly into checked files as Lua comments.

Luacheck supports checking Lua files using syntax of Lua 5.1 - 5.4, and LuaJIT. Luacheck itself is written in Lua and runs on all of mentioned Lua versions.

Installation

Using LuaRocks

From your command line run the following command (using sudo if necessary):

luarocks install luacheck

For parallel checking Luacheck additionally requires LuaLanes, which can be installed using LuaRocks as well (luarocks install lanes).

Windows binary download

For Windows there is single-file 64-bit binary distribution, bundling Lua 5.4.4, Luacheck, LuaFileSystem, and LuaLanes using LuaStatic: download.

Basic usage

After Luacheck is installed, run luacheck program from the command line. Pass a list of files, rockspecs or directories (requires LuaFileSystem) to be checked:

luacheck src extra_file.lua another_file.lua
Checking src/good_code.lua               OK
Checking src/bad_code.lua                3 warnings

    src/bad_code.lua:3:23: unused variable length argument
    src/bad_code.lua:7:10: setting non-standard global variable embrace
    src/bad_code.lua:8:10: variable opt was previously defined as an argument on line 7

Checking src/python_code.lua             1 error

    src/python_code.lua:1:6: expected '=' near '_
10000
_future__'

Checking extra_file.lua                  5 warnings

    extra_file.lua:3:18: unused argument baz
    extra_file.lua:4:8: unused loop variable i
    extra_file.lua:13:7: accessing uninitialized variable a
    extra_file.lua:14:1: value assigned to variable x is unused
    extra_file.lua:21:7: variable z is never accessed

Checking another_file.lua                2 warnings

    another_file.lua:2:7: unused variable height
    another_file.lua:3:7: accessing undefined variable heigth

Total: 10 warnings / 1 error in 5 files

For more info, see documentation.

Related projects

Editor support

There are a few plugins which allow using Luacheck directly inside an editor, showing warnings inline:

If you are a plugin developer, see recommended way of using Luacheck in a plugin.

Other projects

Documentation

Documentation is available online. If Luacheck has been installed using LuaRocks, it can be browsed offline using luarocks doc luacheck command.

Documentation can be built using Sphinx: sphinx-build docsrc doc, the files will be found inside doc/.

Development

Luacheck is currently in development. The latest released version is v1.2.0. The interface of the luacheck module may change between minor releases. The command line interface is fairly stable.

Use the Luacheck issue tracker on GitHub to submit bugs, suggestions and questions. Any pull requests are welcome, too.

Building and testing

After the Luacheck repo is cloned and changes are made, run luarocks make (using sudo if necessary) from its root directory to install dev version of Luacheck. To run Luacheck using sources in current directory without installing it, run lua -e 'package.path="./src/?.lua;./src/?/init.lua;"..package.path' bin/luacheck.lua .... To test Luacheck, ensure that you have busted, luautf8, and luasocket installed and run busted.

Docker

Alternatively Luacheck can be run as a standalone docker container. The usage of docker is fairly simple. You can either build your own or download a prebuilt version. To build your own, execute the following command from the source directory of this project:

$ docker build -t ghcr.io/lunarmodules/luacheck:HEAD .

To use a prebuilt one, download it from the GitHub Container Registry. Here we use the one tagged latest, but you can substitute latest for any tagged release.

$ docker pull ghcr.io/lunarmodules/luacheck:latest

Once you have a container you can run it on one file or a source tree (substitute latest with HEAD if you built your own or with the tagged version you want if applicable):

# Run on an entire directory
$ docker run -v "$(pwd):/data" ghcr.io/lunarmodules/luacheck:latest .

# Run on one file:
$ docker run -v "$(pwd):/data" ghcr.io/lunarmodules/luacheck:latest bin/luacheck.lua

A less verbose way to run it in most shells is with at alias:

# In a shell or in your shell's RC file:
$ alias luacheck='docker run -v "$(pwd):/data" ghcr.io/lunarmodules/luacheck:latest'

# Thereafter just run:
$ luacheck .

Use as a CI job

There are actually many ways to run Luacheck remotely as part of a CI work flow. Because packages are available for many platforms, one way would be to just use your platforms native package installation system to pull them into whatever CI runner environment you already use. Another way is to pull in the prebuilt Docker container and run that.

As a case study, here is how a workflow could be setup in GitHub Actions:

name: Luacheck
on: [push, pull_request]
jobs:
  luacheck:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Luacheck linter
        uses: lunarmodules/luacheck@v1

By default the GH Action is configured to run luacheck ., but you can also pass it your own args to replace the default input of ..

      - name: Luacheck linter
        uses: lunarmodules/luacheck@v1
        with:
            args: myfile.lua

License

The MIT License (MIT)

Copyright (c) 2014 - 2018 Peter Melnichenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Luacheck is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Luacheck
v1.2.0
Latest

Luacheck is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

0