All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.oe.rules.rssw-oe.compiler.warning.2750.html Maven / Gradle / Ivy

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.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy