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 Hint
to Error
.
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.
Identifies the use of indexed default member accesses for which the default member cannot be determined at compile time.
Default severity: Warning
An indexed default member access hides away the actually called member. This is especially problematic if the default member cannot be determined from the declared type of the object. Should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.
Identifies obsolete 16-bit integer variables.
Default severity: Hint
Modern processors are optimized for processing 32-bit integers; internally, a 16-bit integer is still stored as a 32-bit value. Unless code is interacting with APIs that require a 16-bit integer, a Long (32-bit integer) should be used instead.
Flags invalid or misplaced Rubberduck annotation comments.
Default severity: Warning
Rubberduck is correctly parsing an annotation, but that annotation is illegal in that context and couldn't be bound to a code element.
Identifies uses of 'IsMissing' involving non-variant, non-optional, or array parameters.
Default severity: Warning
'IsMissing' only returns True when an optional Variant parameter was not supplied as an argument. This inspection flags uses that attempt to use 'IsMissing' for other purposes, resulting in conditions that are always False.
Identifies uses of 'IsMissing' involving a non-parameter argument.
Default severity: Warning
'IsMissing' only returns True when an optional Variant parameter was not supplied as an argument. This inspection flags uses that attempt to use 'IsMissing' for other purposes, resulting in conditions that are always False.