Non Returning Function

Warns about 'Function' and 'Property Get' procedures whose return value is not assigned.

Reasoning

Both 'Function' and 'Property Get' accessors should always return something. Omitting the return assignment is likely a bug.

Default severity

Error

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Public Function GetFoo() As Long Dim foo As Long foo = 42 'function will always return 0 End Function

This example should NOT trigger a result

MyModule (StandardModule)
Public Function GetFoo() As Long Dim foo As Long foo = 42 GetFoo = foo End Function

Rubberduck.CodeAnalysis.Inspections.Concrete.NonReturningFunctionInspection.cs (Prerelease-v2.5.9.6289)