{"id":13434278,"url":"https://github.com/mpeterv/luacheck","last_synced_at":"2025-05-14T19:09:56.519Z","repository":{"id":14870871,"uuid":"17594341","full_name":"mpeterv/luacheck","owner":"mpeterv","description":" A tool for linting and static analysis of Lua code. ","archived":false,"fork":false,"pushed_at":"2022-12-18T19:53:23.000Z","size":2237,"stargazers_count":1950,"open_issues_count":45,"forks_count":326,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-04-13T15:08:04.685Z","etag":null,"topics":["linter","lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpeterv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-10T13:55:05.000Z","updated_at":"2025-04-12T12:49:37.000Z","dependencies_parsed_at":"2023-01-13T18:09:54.735Z","dependency_job_id":null,"html_url":"https://github.com/mpeterv/luacheck","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpeterv%2Fluacheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpeterv%2Fluacheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpeterv%2Fluacheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpeterv%2Fluacheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpeterv","download_url":"https://codeload.github.com/mpeterv/luacheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linter","lua"],"created_at":"2024-07-31T02:01:52.054Z","updated_at":"2025-05-14T19:09:55.464Z","avatar_url":"https://github.com/mpeterv.png","language":"Lua","readme":"# Luacheck\n\n[![Join the chat at https://gitter.im/luacheck/Lobby](https://badges.gitter.im/luacheck/Lobby.svg)](https://gitter.im/luacheck/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![Build Status](https://travis-ci.org/mpeterv/luacheck.png?branch=master)](https://travis-ci.org/mpeterv/luacheck)\n[![Windows build status](https://ci.appveyor.com/api/projects/status/pgox2vvelagw1fux/branch/master?svg=true\u0026passingText=Windows%20build%20passing\u0026failingText=Windows%20build%20failing)](https://ci.appveyor.com/project/mpeterv/luacheck/branch/master)\n[![codecov](https://codecov.io/gh/mpeterv/luacheck/branch/master/graph/badge.svg)](https://codecov.io/gh/mpeterv/luacheck)\n[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE)\n\n## Contents\n\n* [Overview](#overview)\n* [Installation](#installation)\n* [Basic usage](#basic-usage)\n* [Related projects](#related-projects)\n* [Documentation](#documentation)\n* [Development](#development)\n* [Building and testing](#building-and-testing)\n* [License](#license)\n\n## Overview\n\nLuacheck is a static analyzer and a linter for [Lua](http://www.lua.org). 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.\n\nLuacheck supports checking Lua files using syntax of Lua 5.1, Lua 5.2, Lua 5.3 and LuaJIT. Luacheck itself is written in Lua and runs on all of mentioned Lua versions.\n\n## Installation\n\n### Using LuaRocks\n\nFrom your command line run the following command (using `sudo` if necessary):\n\n```\nluarocks install luacheck\n```\n\nFor parallel checking Luacheck additionally requires [LuaLanes](https://github.com/LuaLanes/lanes), which can be installed using LuaRocks as well (`luarocks install lanes`).\n\n### Windows binary download\n\nFor Windows there is single-file 64-bit binary distribution, bundling Lua 5.3.4, Luacheck, LuaFileSystem, and LuaLanes using [LuaStatic](https://github.com/ers35/luastatic):\n[download](https://github.com/mpeterv/luacheck/releases/download/0.23.0/luacheck.exe).\n\n## Basic usage\n\nAfter Luacheck is installed, run `luacheck` program from the command line. Pass a list of files, [rockspecs](https://github.com/luarocks/luarocks/wiki/Rockspec-format) or directories (requires LuaFileSystem) to be checked:\n\n```\nluacheck src extra_file.lua another_file.lua\n```\n\n```\nChecking 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```\n\nFor more info, see [documentation](https://luacheck.readthedocs.io/en/stable/).\n\n## Related projects\n\n### Editor support\n\nThere are a few plugins which allow using Luacheck directly inside an editor, showing warnings inline:\n\n* For Vim, [Syntastic](https://github.com/vim-syntastic/syntastic) contains [luacheck checker](https://github.com/vim-syntastic/syntastic/wiki/Lua%3A---luacheck);\n* For Sublime Text 3 there is [SublimeLinter-luacheck](https://packagecontrol.io/packages/SublimeLinter-luacheck) which requires [SublimeLinter](https://sublimelinter.readthedocs.io/en/latest/);\n* For Atom there is [linter-luacheck](https://atom.io/packages/linter-luacheck) which requires [AtomLinter](https://github.com/steelbrain/linter);\n* For Emacs, [Flycheck](http://www.flycheck.org/en/latest/) contains [luacheck checker](http://www.flycheck.org/en/latest/languages.html#lua);\n* For Brackets, there is [linter.luacheck](https://github.com/Malcolm3141/brackets-luacheck) extension;\n* For Visual Studio code there is [vscode-luacheck](https://marketplace.visualstudio.com/items?itemName=dwenegar.vscode-luacheck) extension. [vscode-lua](https://marketplace.visualstudio.com/items?itemName=trixnz.vscode-lua) extension also includes Luacheck support.\n\nIf you are a plugin developer, see [recommended way of using Luacheck in a plugin](http://luacheck.readthedocs.org/en/stable/cli.html#stable-interface-for-editor-plugins-and-tools).\n\n### Other projects\n\n* [Luacheck bindings for Node.js](https://www.npmjs.com/package/luacheck);\n* [Luacheck plugin for Gulp](https://www.npmjs.com/package/gulp-luacheck).\n\n## Documentation\n\nDocumentation is available [online](https://luacheck.readthedocs.io/en/stable/). If Luacheck has been installed using LuaRocks, it can be browsed offline using `luarocks doc luacheck` command.\n\nDocumentation can be built using [Sphinx](http://sphinx-doc.org/): `sphinx-build docsrc doc`, the files will be found inside `doc/`.\n\n## Development\n\nLuacheck is currently in development. The latest released version is 0.23.0. The interface of the `luacheck` module may change between minor releases. The command line interface is fairly stable.\n\nUse the Luacheck issue tracker on GitHub to submit bugs, suggestions and questions. Any pull requests are welcome, too.\n\n## Building and testing\n\nAfter 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](http://olivinelabs.com/busted/) and [luautf8](https://github.com/starwing/luautf8) installed and run `busted`.\n\n## License\n\n```\nThe 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```\n","funding_links":[],"categories":["Lua","\u003e 1k ★","Resources"],"sub_categories":["Testing","Analysis Tools and ASTs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpeterv%2Fluacheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpeterv%2Fluacheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpeterv%2Fluacheck/lists"}