Table of Contents

RDC01009: Empty procedure

Severity: Information  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: EmptyProcedureAnalyzer

A Sub, Function or Property procedure has no statement (MS-VBAL §5.3.1.6 Subroutine and Function Declarations, §5.3.1.7 Property Declarations).

Calling it does nothing, and a function or a property getter returns the default value of its type. An empty procedure is often unfinished code, or left over. Comments, line labels and Dim, Static and Const declarations are no statements: a procedure that holds only those is empty.

A Public member of a class module is a member of the interface of the class, which another class module can implement with Implements (MS-VBAL §5.2.4 Class Module Declarations). A class written as an interface declares its members with no statement, so a Public member of a class module is not reported. A Private or Friend member of a class is, and so is a member that implements an interface or handles an event, whatever its access.

The finding is the name of the procedure.

How it is raised

Situation Example Resolution
A procedure of a standard module with no statement. Sub Foo()
' ...
End Sub
Write what it does, or remove it.
A Private or Friend procedure of a class module with no statement. Private Sub Class_Initialize()
End Sub
Remove it, or write what it does.
An implementation of an interface member, or an event handler, with no statement. Private Sub Source_Click()
End Sub
Write what it does. An implementation meant to do nothing can say why in a comment; the finding remains.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca