al-code-outline icon indicating copy to clipboard operation
al-code-outline copied to clipboard

Warning/error if procedure with return value doesn't contain exit() and doesn't assign to the named return value

Open jhoek opened this issue 1 year ago • 1 comments

In procedures with a return value type (=functions), the developer should probably either call exit() to return a value, or assign to the named return value (if applicable) before the function execution ends. I would consider it a best practice not to "silently" exit the procedure without explicitly setting the return value on all code paths.

Perhaps this rule should be Hidden or Info by default, in order not to break anybody's workflow, in particularly people who don't consider the above a best practice?

Thanks again for considering my suggestion.

jhoek avatar Feb 20 '24 14:02 jhoek

Hi. That's a nice idea but I am guessing that you wanted to create this issue in the BusinessCentral.LinterCop repository :)

anzwdev avatar Feb 28 '24 23:02 anzwdev