-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
Add luacheck as a static analysis step in CI to catch unused variables, undefined globals, shadowed variables, and syntax errors in Lua source files.
Motivation
We already have lua-quality CI step but luacheck provides more comprehensive static analysis. For OpenResty/LuaJIT code, luacheck helps catch common bugs early.
Acceptance Criteria
-
luacheckinstalled indocker/Dockerfile.test(or CI directly viaapt/luarocks) -
.luacheckrcconfig added at repo root, declaring OpenResty globals (ngx,cjson,require, etc.) to avoid false positives - New
lua-qualityor separateluacheckstep in.github/workflows/ci.ymlrunningluacheck src/fairvisor/ - CI step fails on luacheck errors (not
continue-on-error) - Existing source files pass (fix any warnings found)
Tooling options
- luacheck (https://github.com/lunarmodules/luacheck) — gold standard, widely used, easy CI integration
- selene (https://github.com/Kampfkarren/selene) — Rust-based alternative, faster, more configurable
Recommendation: start with luacheck.
Notes
- The
.luacheckrcmust whitelist OpenResty-specific globals:ngx,ndk,cjson,cjson_safe,require(already a Lua global) - Can pin to a specific version for reproducibility
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels