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
It might be possible to catch the case of pure boolean example like that one, but it would miss the same logic error in other cases and that might be worse. For example:
Even your example seems a bit contrived because doesn't bit.issset() just return a boolean anyway? Since luacheck doen't evaluate code but only looks at the syntax we can catch some kinds of errors but not others. I would consider a PR if somebody wanted to add a catch this, but it does seem a little dicey to get into the world of catching logic bugs via syntax.
My colleague wrote the following wrong code
I didn't realize the mistake at the time, just wanted to use it as a ternary expression.
The code execution will not report an error, but it will never get the desired result.
After the code was sent to me, I saw the code error prompt in VSCODE.
[Warn type:15], or expression is always true
[Warn type:16], and expression is always false
Can luacheck detect such errors?
The text was updated successfully, but these errors were encountered: