anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 13 forks source link

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

Open jhoek opened 6 months ago

jhoek commented 6 months ago

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.

anzwdev commented 6 months ago

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