Closed Zash closed 6 years ago
Prosody .luacheckrc
has allow_defined_top
option enabled, so that all globals assigned in all main chunks are considered defined. This works across files unless global scope is limited using module
option. prosody.cfg.lua.dist
file sets log
so when it's checked together with prosody
there are no longer warnings about accessing that global.
allow_defined
and allow_defined_top
are the only options with behavior working across files. Ideally there should be no such behavior or there should be a config option telling luacheck
what files to check, so that there is no result mismatch when checking the whole project (e.g. as a part of CI) vs checking single files (e.g. via an editor plugin).
Does having allow_defined_top
only apply to prosody
make more sense then?
I'm not sure, I haven't looked at the files in detail. If allow_defined_top
is set only in prosody
, other files will be able to use globals set in prosody
without warnings when checked together with it. Is that the intention?
That sounds like it makes some sense, yes. I was unaware that luacheck considered variables across files in this way.
So in Prosody as of r6aeed79d9283 this weirdness happens:
Ok, not so weird. But then when also giving the default config file:
Only one warning for
prosody
now?(At the time of this writing, it is very late. Too late to start with attempting to reduce this to a smaller test case. I may try that another day.)