Static code analysis can find hundreds of opportunities in VBA code.
Rubberduck builds its own internal representation of the code, and then proceeds to analyze it. Each individual inspection can easily be disabled, or configured to issue inspection results at different severity levels ranging from
Use the Inspection Results toolwindow to review Rubberduck’s findings, search, filter, regroup results by inspection, location, type, or severity. Each inspection result comes with a detailed description of what’s being flagged and why, so you can make an enlightened decision.
Unless configured otherwise, Rubberduck automatically runs inspections after the a parser/resolver cycle completes (regardless of whether the inspection results toolwindow is displayed or not).
For the best experience, it would be recommended to first try Rubberduck with an empty project, add a new module, and write, say, a loop that counts 1 to 10 and outputs to the debug pane - then to parse that and review the inspection results; carefully review the inspection settings, and consider disabling the inspections that irreconcilably clash with your preferences: use meaningful names alone can easily produce hundreds upon hundreds of results if you’re not that much into using vowels, or if you, say, prefix all your variable names; these inspections can be re-enabled anytime you’re ready!
This tab lists all items found in the .xml documentation assets from the latest pre-release build. To modify this content, a pull request must be merged into the [next] branch.
Locates unqualified Worksheet.Range/Cells/Columns/Rows member calls inside worksheet modules that implicitly refer to the containing sheet.
Implicit references inside a worksheet document module can be mistakes for implicit references to the active worksheet, which is the behavior in all other places. By explicitly qualifying these member calls with Me, the ambiguity can be resolved.
This inspection will only run if the Excel library is referenced.
Identifies the use of non-indexed default member accesses.
Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made and can cause errors in which a member was forgotten to be called to go unnoticed.
Warns about constants that don't have an explicitly defined type.
All constants have a declared type, whether a type is specified or not. The implicit type is determined by the compiler based on the value, which is not always the expected type.
Highlights implicit Public access modifiers in user code.
In modern VB (VB.NET), the implicit access modifier is Private, as it is in most other programming languages. Making the Public modifiers explicit can help surface potentially unexpected language defaults.
Identifies the use of indexed default member accesses that require a recursive default member resolution.
Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made and the final default member is not on the interface of the object itself. In particular, this can cause errors in which a member was forgotten to be called to go unnoticed.