Skip to content

The function should have return (FunctionShouldHaveReturn)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL
OS
Major Yes 10 suspicious
unpredictable

Description

Function differs from a Procedure only that it necessarily returns a value and can be used in expressions.

Based on the above-mentioned, a function which does not contain a return is itself erroneous. Corrections required:

  • implement return if the implemented method is a function
  • rewrite function to procedure if return is not needed

Snippets

Diagnostic ignorance in code

// BSLLS:FunctionShouldHaveReturn-off
// BSLLS:FunctionShouldHaveReturn-on

Parameter for config

"FunctionShouldHaveReturn": false