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

Selene lint action broken #42

Closed
jens1205 opened this issue Jul 23, 2021 · 5 comments
Closed

Selene lint action broken #42

jens1205 opened this issue Jul 23, 2021 · 5 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jens1205
Copy link
Contributor

Selene always complains about an unknown goto

error[parse_error]: unexpected token `goto`
    ┌─ lua/rest-nvim/init.lua:183:4
    │
183 │             goto continue
    │             ^^^^ expected 'end'

This is a known issue (Kampfkarren/selene#224)

@NTBBloodbath
Copy link
Member

Hey, thank you for pointing it to me jens!

I'll take a look at the workaround to fix it asap, we don't want false linting errors.

@jens1205
Copy link
Contributor Author

Some interesting background: neovim officially only supports lua 5.1. But the "goto" keyword has been introduced with lua 5.2.

So why does our code work? Neovim ships with luajit 2.1.0 which includes some extensions from lua 5.2 https://luajit.org/extensions.html

But for this ticket it is questionable if our linter should really accept the full feature set of lua 5.2.

Perhaps the best way to fix is to rewrite the one function not to use goto

@jens1205
Copy link
Contributor Author

Or we switch from selene to luacheck https://github.com/mpeterv/luacheck/ Maybe they support the features of luajit:

Luacheck supports checking Lua files using syntax of Lua 5.1, Lua 5.2, Lua 5.3 and LuaJIT.

And luacheck is also proposed in a new template for nvim plugins: https://github.com/nvim-lua/nvim-lua-plugin-template

@NTBBloodbath
Copy link
Member

I didn't really understood how to fix that selene issue because I already selected lua52 as our stdlib because of what you've said before and was the same result.

Let's take a look at luacheck, hope it has a github action so we can setup it very quickly. If not then there's no problem, we can do it from scratch :)

@NTBBloodbath
Copy link
Member

I think it's done. Already changed our linter to luacheck and squashed some errors that luacheck detected :)

@NTBBloodbath NTBBloodbath added enhancement New feature or request bug Something isn't working labels Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants