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!
These inspections are about Rubberduck-specific features, such as annotation comments.
Warns about duplicated annotations.
Default severity: Error
Rubberduck annotations should not be specified more than once for a given module, member, variable, or expression.
Flags invalid Rubberduck annotation comments.
Default severity: Error
Rubberduck is correctly parsing an annotation, but that annotation is illegal in that context.
Indicates that a Rubberduck annotation is documenting the presence of a VB attribute that is actually missing.
Default severity: Warning
Rubberduck annotations mean to document the presence of hidden VB attributes; this inspection flags annotations that do not have a corresponding VB attribute.
Indicates that a user module is missing a @Folder Rubberduck annotation.
Default severity: Suggestion
Modules without a custom @Folder annotation will be grouped under the default folder in the Code Explorer toolwindow. By specifying a custom @Folder annotation, modules can be organized by functionality rather than simply listed.