LLSCheck is a command-line utility that leverages the Lua Language Server for linting and static analysis of Lua code.
It delivers user-friendly reports, enhancing readability compared to raw JSON output. Moreover, LLSCheck seamlessly integrates with popular CI tools, i.e the exit code is a failure when the Lua Language Server finds issues.
Lua Language Server must be installed locally
and lua-language-server
must be in your $PATH.
Using LuaRocks:
luarocks install llscheck
llscheck --help
Usage: llscheck [-h] [--completion {bash,zsh,fish}]
[--checklevel {Error,Warning,Information,Hint}]
[--configpath <configpath>] [<workspace>]
Generate a LuaLS diagnosis report and print to human-friendly format.
Arguments:
workspace The workspace to check. (default: .)
Options:
-h, --help Show this help message and exit.
--completion {bash,zsh,fish}
Output a shell completion script for the specified shell.
--checklevel {Error,Warning,Information,Hint}
The minimum level of diagnostic that should be logged. (default: Warning)
--configpath <configpath>
Path to a LuaLS config file. (default: .luarc.json)
--no-color Do not add color to output.
Colored text output is disabled if any of the following conditions are met:
- llscheck is not run from a terminal (TTY).
- The NO_COLOR environment variable is present and not empty.
- The
--no-color
argument is provided.
You can also run LLSCheck as a standalone Docker container. To build your own, execute the following command from the source directory of this project:
docker build -t llscheck https://github.com/jeffzi/llscheck.git
Optionally, you can pin the version of Lua Language Server with --build-arg LLS_VERSION=3.7.0
.
Once you have a container you can run it with arguments:
# Run llscheck on the src directory
docker run -v "$(pwd):/data" llscheck --checklevel Information src
On an Apple Silicon chip M1+, you'll need to add the option --platform=linux/amd64
to both docker commands.
Lua Language Server must be installed locally
and lua-language-server
must be in your $PATH.
Use pre-commit. Once you have it installed,
add this to the .pre-commit-config.yaml
in your repository:
repos:
- repo: https://github.com/jeffzi/llscheck
rev: latest
hooks:
- id: llscheck
# args: ["--checklevel", "Hint"]