Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: replace luacheck with luals (for headless/automated linting) #24563

Open
justinmk opened this issue Aug 4, 2023 · 7 comments
Open

CI: replace luacheck with luals (for headless/automated linting) #24563

justinmk opened this issue Aug 4, 2023 · 7 comments
Labels
ci automation for build, test, and release lua stdlib
Milestone

Comments

@justinmk
Copy link
Member

justinmk commented Aug 4, 2023

Problem

(This is a tracking issue, to invite discussion/counterpoints/investigation.)

luacheck might be redundant with luals.

Expected behavior

  • determine if luacheck adds value beyond what luals is capable of
  • if luals has a non-interactive mode, use that instead of luacheck to check code in CI
    • con: this requires lintlua build target to use/install luals
  • remove luacheck
@justinmk justinmk added ci automation for build, test, and release lua stdlib labels Aug 4, 2023
@justinmk justinmk added this to the unplanned milestone Aug 4, 2023
@clason
Copy link
Member

clason commented Sep 2, 2023

Possible alternative: https://github.com/JohnnyMorganz/luau-lsp, which has a stand-alone mode

(disclaimer: I don't know how close luau is to lua, so whether that can be leveraged at all)

@lewis6991
Copy link
Member

Luau is almost a completely different language so I'm not sure we can use it.

@clason
Copy link
Member

clason commented Sep 2, 2023

https://luau-lang.org claims that

Luau is syntactically backwards-compatible with Lua 5.1 (code that is valid Lua 5.1 is also valid Luau)

However, it is typed, and I would expect any static analyzer would rely on that rather than our annotations, which would kind of defeat the purpose.

@clason
Copy link
Member

clason commented Sep 2, 2023

LuaLS does seem to support a --check mode: https://luals.github.io/wiki/usage/

lua-language-server/bin/lua-language-server --check runtime --checklevel=Error --logpath=. runtime/

Diagnosis complete, 41 problems found, see ./check.json

check.json.txt

Would need some postprocessing...

@clason
Copy link
Member

clason commented Sep 2, 2023

Other relevant data points:

  • LuaLS can be installed via homebrew
  • LuaLS makes frequent (and sometimes breaking) updates; expect reported diagnostics to change rapidly (although if we explicitly extract diagnostics from the JSON, new checks won't be a problem).

@justinmk justinmk changed the title CI: replace luacheck with luals CI: replace luacheck with luals (for headless linting) Sep 10, 2023
@justinmk justinmk changed the title CI: replace luacheck with luals (for headless linting) CI: replace luacheck with luals (for headless/automated linting) Sep 10, 2023
@Dkendal

This comment was marked as resolved.

@lewis6991
Copy link
Member

I've opened LuaLS/lua-language-server#3051 to try to progress this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci automation for build, test, and release lua stdlib
Projects
None yet
Development

No branches or pull requests

4 participants