OpenDream
OpenDream copied to clipboard
Lint for pointless/bad positional arguments.
In cases like https://github.com/Citadel-Station-13/Citadel-Station-13-RP/blob/69ce25bd79b41b7800e33c45ccb9a094a280c5ff/code/modules/gamemaster/actions/atmos_leak.dm#L20-L23
...
severity = pickweight(EVENT_LEVEL_MUNDANE = 8,
EVENT_LEVEL_MODERATE = 5,
EVENT_LEVEL_MAJOR = 3
)
...
// Event defines.
#define EVENT_LEVEL_MUNDANE 1
#define EVENT_LEVEL_MODERATE 2
#define EVENT_LEVEL_MAJOR 3
...
After preprocessing, this is
// This runtimes if the argument order is different.
severity = pickweight(1 = 8,
2 = 5,
3 = 3
)
which is equivalent to
severity = pickweight(8, 5, 3)
this is almost certainly unintentional, undoubtably does not do what the programmer intended (a BYOND classic frankly), and should probably be linted for.
Added context I haven't verified for myself: