SpacemanDMM
SpacemanDMM copied to clipboard
[Feature Request] Add a warning that the function should be in a if() if it has a return FALSE/TRUE
Basically when you have a function say
/proc/foo(var/bar)
if(bar)
return TRUE
return FALSE
and you do
/proc/main()
foo(TRUE)
it should emit a warning that it should be in a check.
Why I'm inquiring about this, is that I've caught a few bugs because the output of the function isnt checked
Might be tricky, remember these just evaluate to 1
/0
.
Maybe a more generic lint that return values of tagged function are "checked."
yeah, I mean if it specifically has a return in the function, all calls should be in some sort of assignment or check/if
This definitely shouldn't be default behavior though. There are many functions that return a value that doesn't necessarily need to be checked.
seems like it should imo. if theres specifically a return in there it seems like it should be checked. Could I see some code where this wouldnt apply?
Most of the functionality for this already exists with purity lint, I can add a code standards config option or a lint to enable it without having to use the purity lint @redmoogle