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
Developers who aren’t familiar with lua often don’t understand that functions are first-class citizens in lua. This results in creating functions that do nothing but call another function, passing any parameters to the outer function into the inner function.
One bit of (unlintable) complexity: sometimes, the outer function can be used to deliberately pass in fewer parameters to an inner function; ie inner function takes 3 parameters, outer function takes 2 and calls the inner function with an implicit nil third parameter, but at a call site that passes the outer function three parameters.
The text was updated successfully, but these errors were encountered:
I think the "sometimes" caveat here is probably frequent enough and valid enough that warning on other cases is probably not worthwhile. That being said are you sure we can't lint for it? If we can track unused variables wouldn't we be able to figure out if everything being passed in was used, if there are unused args... Nevermind even in starting to write this I see why it is unlintable. Also there are other use cases such as passing additional arguments from the surrounding scope to the inside function.
I can't imagine this not throwing for too many false positives to be useful. We would need a third level of notice — something below warning.
Developers who aren’t familiar with lua often don’t understand that functions are first-class citizens in lua. This results in creating functions that do nothing but call another function, passing any parameters to the outer function into the inner function.
One bit of (unlintable) complexity: sometimes, the outer function can be used to deliberately pass in fewer parameters to an inner function; ie inner function takes 3 parameters, outer function takes 2 and calls the inner function with an implicit nil third parameter, but at a call site that passes the outer function three parameters.
The text was updated successfully, but these errors were encountered: