You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ,
forvar_1,···,var_ninexplistdobodyend
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.
I think this is out of scope for Luacheck and should rather be a formatter's job to fix and/or check. Luacheck is supposed to check likely semantic issues rather than formatting issues. The only warning where Luacheck checks formatting is with mixed indentation, which is severe and universal enough that it seems reasonable.
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
,
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!
Originally posted by @mpeterv in mpeterv#79 (comment)
I was just made aware of his passing away and hope this repo is the right place to follow up on this.
The text was updated successfully, but these errors were encountered: