Skip to content

Add luacheck static analysis to CI #27

@levleontiev

Description

@levleontiev

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

  • luacheck installed in docker/Dockerfile.test (or CI directly via apt/luarocks)
  • .luacheckrc config added at repo root, declaring OpenResty globals (ngx, cjson, require, etc.) to avoid false positives
  • New lua-quality or separate luacheck step in .github/workflows/ci.yml running luacheck src/fairvisor/
  • CI step fails on luacheck errors (not continue-on-error)
  • Existing source files pass (fix any warnings found)

Tooling options

Recommendation: start with luacheck.

Notes

  • The .luacheckrc must whitelist OpenResty-specific globals: ngx, ndk, cjson, cjson_safe, require (already a Lua global)
  • Can pin to a specific version for reproducibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions