Inspections

Unless you configure it not to, Rubberduck automatically runs the code through all enabled inspections after successfully parsing all modules. The list of inspections on this page (as well as their respective content and code examples) is generated directly from XML documentation in the source code merged into our repository on GitHub.

You can make inspections ignore a specific module by adding an '@IgnoreModule annotation to that module's (declarations) section:

Option Explicit
'@IgnoreModule; inspections will ignore this module

Severity levels range from DoNotShow to Error and are completely configurable, for every single inspection. Inspections with their severity level set to DoNotShow do not execute at all: speed up Rubberduck static code analysis by reviewing which inspections you want to run and disabling the others!

ApplicationWorksheetFunction

Warns about late-bound WorksheetFunction calls made against the extended interface of the Application object.

ArgumentWithIncompatibleObjectType

Locates arguments passed to functions or procedures for object parameters which the do not have a compatible declared type.

AssignedByValParameter

Warns about parameters passed by value being assigned a new value in the body of a procedure.

AssignmentNotUsed

Warns about a variable that is assigned, and then re-assigned before the first assignment is read.

AttributeValueOutOfSync

Indicates that the value of a hidden VB attribute is out of sync with the corresponding Rubberduck annotation comment.

BooleanAssignedInIfElse

Identifies redundant Boolean expressions in conditionals.

ConstantNotUsed

Locates 'Const' declarations that are never referenced.

DefaultMemberRequired

Locates indexed default member calls for which the corresponding object does not have a suitable suitable default member.

DefaultProjectName

This inspection means to indicate when the project has not been renamed.

DefTypeStatement

Warns about Def[Type] statements.

DuplicatedAnnotation

Warns about duplicated annotations.

EmptyCaseBlock

Identifies empty 'Case' blocks that can be safely removed.

EmptyDoWhileBlock

Identifies empty 'Do...Loop While' blocks that can be safely removed.

EmptyElseBlock

Identifies empty 'Else' blocks that can be safely removed.

EmptyForEachBlock

Identifies empty 'For Each...Next' blocks that can be safely removed.

EmptyForLoopBlock

Identifies empty 'For...Next' blocks that can be safely removed.

EmptyIfBlock

Identifies empty 'If' blocks.

EmptyMethod

Identifies empty module member blocks.

EmptyModule

Flags empty code modules.

EmptyStringLiteral

Flags uses of an empty string literal ("").

EmptyWhileWendBlock

Identifies empty 'While...Wend' blocks that can be safely removed.

EncapsulatePublicField

Flags publicly exposed instance fields.

ExcelMemberMayReturnNothing

Locates instances of member calls made against the result of a Range.Find/FindNext/FindPrevious method, without prior validation.

ExcelUdfNameIsValidCellReference

Locates public User-Defined Function procedures accidentally named after a cell reference.

FunctionReturnValueNotUsed

Warns when a user function's return value is never used, at any of its call sites.

HostSpecificExpression

Warns about host-evaluated square-bracketed expressions.

HungarianNotation

Flags identifiers that use [Systems] Hungarian Notation prefixes.

IllegalAnnotation

Flags invalid Rubberduck annotation comments.

ImplementedInterfaceMember

Identifies members of class modules that are used as interfaces, but that have a concrete implementation.

ImplicitActiveSheetReference

Locates unqualified Worksheet.Range/Cells/Columns/Rows member calls that implicitly refer to ActiveSheet.

ImplicitActiveWorkbookReference

Locates unqualified Workbook.Worksheets/Sheets/Names member calls that implicitly refer to ActiveWorkbook.

ImplicitByRefModifier

Highlights implicit ByRef modifiers in user code.

ImplicitDefaultMemberAssignment

Identifies implicit default member calls.

ImplicitPublicMember

Highlights implicit Public access modifiers in user code.

ImplicitVariantReturnType

Warns about 'Function' and 'Property Get' procedures that don't have an explicit return type.

IntegerDataType

Identifies obsolete 16-bit integer variables.

IsMissingOnInappropriateArgument

Identifies uses of 'IsMissing' involving non-variant, non-optional, or array parameters.

IsMissingWithNonArgumentParameter

Identifies uses of 'IsMissing' involving a non-parameter argument.

LineLabelNotUsed

Identifies line labels that are never referenced, and therefore superfluous.

MemberNotOnInterface

Warns about member calls against an extensible interface, that cannot be validated at compile-time.

MissingAnnotationArgument

Warns about a malformed Rubberduck annotation that is missing an argument.

MissingAttribute

Indicates that a Rubberduck annotation is documenting the presence of a VB attribute that is actually missing.

MissingMemberAnnotation

Indicates that a hidden VB attribute is present for a member, but no Rubberduck annotation is documenting it.

MissingModuleAnnotation

Indicates that a hidden VB attribute is present for a module, but no Rubberduck annotation is documenting it.

ModuleScopeDimKeyword

Warns about module-level declarations made using the 'Dim' keyword.

ModuleWithoutFolder

Indicates that a user module is missing a @Folder Rubberduck annotation.

MoveFieldCloserToUsage

Locates module-level fields that can be moved to a smaller scope.

MultilineParameter

Flags parameters declared across multiple physical lines of code.

MultipleDeclarations

Flags declaration statements spanning multiple physical lines of code.

NonReturningFunction

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

ObjectVariableNotSet

Warns about assignments that appear to be assigning an object reference without the 'Set' keyword.

ObsoleteCallingConvention

Warns about 'Declare' statements that are using the obsolete/unsupported 'CDecl' calling convention on Windows.

ObsoleteCallStatement

Locates explicit 'Call' statements.

ObsoleteCommentSyntax

Locates legacy 'Rem' comments.

ObsoleteErrorSyntax

Locates legacy 'Error' statements.

ObsoleteGlobal

Locates legacy 'Global' declaration statements.

ObsoleteLetStatement

Locates explicit 'Let' assignments.

ObsoleteMemberUsage

Flags usages of members marked as obsolete with an @Obsolete("justification") Rubberduck annotation.

ObsoleteTypeHint

Flags declarations where a type hint is used in place of an 'As' clause.

ObsoleteWhileWendStatement

Flags 'While...Wend' loops as obsolete.

OnLocalError

Flags obsolete 'On Local Error' statements.

OptionBase

Flags modules that specify Option Base 1.

OptionExplicit

Flags modules that omit Option Explicit.

ParameterCanBeByVal

Flags parameters that are passed by reference (ByRef), but could be passed by value (ByVal).

ParameterNotUsed

Identifies parameter declarations that are not used.

ProcedureCanBeWrittenAsFunction

Warns about 'Sub' procedures that could be refactored into a 'Function'.

ProcedureNotUsed

Locates procedures that are never invoked from user code.

ProcedureRequired

Locates places in which a procedure needs to be called but an object variables has been provided that does not have a suitable default member.

RedundantByRefModifier

Identifies redundant ByRef modifiers.

RedundantOption

Identifies redundant module options that are set to their implicit default.

SelfAssignedDeclaration

Identifies auto-assigned object declarations.

SetAssignmentWithIncompatibleObjectType

Locates assignments to object variables for which the RHS does not have a compatible declared type.

ShadowedDeclaration

Identifies identifiers that hide/"shadow" other identifiers otherwise accessible in that scope.

SheetAccessedUsingString

Locates ThisWorkbook.Worksheets and ThisWorkbook.Sheets calls that appear to be dereferencing a worksheet that is already accessible at compile-time with a global-scope identifier.

StepIsNotSpecified

Locates 'For' loops where the 'Step' token is omitted.

StepOneIsRedundant

Locates 'For' loops where the 'Step' token is specified with the default increment value (1).

StopKeyword

Locates 'Stop' instructions in user code.

UnassignedVariableUsage

Warns when a variable is referenced prior to being assigned.

UndeclaredVariable

Warns about implicit local variables that are used but never declared.

UnderscoreInPublicClassModuleMember

Warns about public class members with an underscore in their names.

UnhandledOnErrorResumeNext

Finds instances of 'On Error Resume Next' that don't have a corresponding 'On Error GoTo 0' to restore error handling.

UnreachableCase

Flags 'Case' blocks that are semantically unreachable.

UntypedFunctionUsage

Flags uses of a number of specific string-centric but Variant-returning functions in various standard library modules.

UseMeaningfulName

Warns about identifiers that have names that are likely to be too short, disemvoweled, or appended with a numeric suffix.

ValueRequired

Locates places in which a value needs to be accessed but an object variables has been provided that does not have a suitable default member.

VariableNotAssigned

Warns about variables that are never assigned.

VariableNotUsed

Warns about variables that are never referenced.

VariableTypeNotDeclared

Warns about variables declared without an explicit data type.

WriteOnlyProperty

Warns about properties that don't expose a 'Property Get' accessor.