Non Returning Function

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

 NEW! This inspection is only available in pre-release builds.

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

QuickFixes

The following quickfixes are available for this inspection:

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.2.6174)