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

whitespaces around operators #216

Closed
AiyionPrime opened this issue Jul 9, 2021 · 4 comments
Closed

whitespaces around operators #216

AiyionPrime opened this issue Jul 9, 2021 · 4 comments

Comments

@AiyionPrime
Copy link

AiyionPrime commented Jul 9, 2021

I'm looking for an option to check for whitespaces around operators, but cannot find it, yet.
I did find a mention of this feature not being implemented yet, from 2016 though.

examples would be

  • too less/many spaces around operator:
i=  3
  • no spaces after ,
for var_1,···,var_n in explist do body end

I realize its not an easy to implement check, due to its context sensitivity, but would like to state I'm missing this feature.
Maybe someone comes along feels the same, and leaves a 👍.

This project is really nice to have around, thanks!

[...]
Ideally luacheck would also check for correct amount of whitespace around operators, parens, etc., but that would require more cooperation with the parser, and also it will be more complex to support customization. The warnings you suggested don't seem to need any options.

I haven't touched luacheck code in a while, and contributions are most welcome! I think that the way to do this would be to modify the lexer to consider whitespace a token, with exactly one whitespace token between each two consecutive normal tokens. Then the parser can call a function provided by the checker on each token. That function would check whitespace tokens and issue warnings.

Originally posted by @mpeterv in #79 (comment)

@ur4ltz
Copy link

ur4ltz commented Jul 11, 2021

See this!
#198

@AiyionPrime
Copy link
Author

Thanks for making me aware.

@AiyionPrime
Copy link
Author

lunarmodules#19

@CppCXY
Copy link

CppCXY commented Mar 10, 2022

Maybe EmmyLuaCodeStyle is good choice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants