org.sonar.l10n.oe.rules.rssw-oe.compiler.warning.2750.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-openedge-plugin Show documentation
Show all versions of sonar-openedge-plugin Show documentation
Enables analysis of OpenEdge projects
The newest version!
The user defined function or method has a return statement but it does not return a value.
User defined functions always return a value, as do non-void methods. If this RETURN statement
is executed, it will result in the function evaluating to the unknown value.
Noncompliant Code Example
FUNCTION f1 RETURNS CHARACTER (ipCondition AS CHARACTER):
IF (ipCondition EQ ?) THEN RETURN. // Will return unknown value
IF (ipCondition BEGINS 'A') THEN RETURN 'Something'.
ELSE RETURN 'Something different'.
END FUNCTION.
Compliant Solution
FUNCTION f1 RETURNS CHARACTER (ipCondition AS CHARACTER):
IF (ipCondition EQ ?) THEN RETURN ''. // Usually better to return an empty string
IF (ipCondition BEGINS 'A') THEN RETURN 'Something'.
ELSE RETURN 'Something different'.
END FUNCTION.