Why you should care
When used in a stored procedure, the RETURN statement specifies an integer value to return to the calling application, batch, or procedure. If no value is specified then the stored procedure returns the value to 0. None of the statements in a stored procedure are executed after the RETURN statement is executed.
Having a RETURN statement in the middle of the procedure or function results in the values of the procedure or function, after the statement, to not be returned and executed.
Having the RETURN statement in the middle of the command makes rest of the code unproductive. Lack of a RETURN statement would cause the code to function improperly and result in a loss of time.
How we detect
This code insight ensures that the return statement should be at the end of a procedure or function should always be the last instruction.
About CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.