Skip to content
Christopher McClellan edited this page Aug 7, 2015 · 7 revisions

Summary

Rubberduck provide code analysis via the Code Inspections functionality. The code in all open VBA Projects is parsed and Rubberduck suggests improvements. Many of these can be automatically corrected by the add in by using the "Fix" button.

Quickfixes are not intended to be used blindly, and some of them may end up leaving the code non-compilable (like removing the declaration for a variable that's referenced, but never assigned to). Inspection results should not be considered as an obligation to change anything about the code; they are meant to inform the maintainer about these issues.

Wiki

Code Inspections are configurable and stored in the Rubberduck.config file that is installed along with the add-in to the C:\Users\Username\AppData\Roaming\Rubberduck\ directory.

Severity levels can be set through the Settings Dialog by going to Rubberduck >> Options.

menu bar

All Code Inspections' severity level can be configured to any of the following severity levels.

  • Do Not Show issues will not show up in code inspection results.
  • Hint issues indicate either that Rubberduck cannot address the issue automatically (in this version), or that a trivial programming error is about to be avoided.
  • Suggestion issues are a friend's recommendation.
  • Warning issues are a yellow flag. Address with care.
  • Error issues can prevent your code from compiling, e.g. using an undeclared variable without Option Explicit specified would still.

Advanced users may also directly modify the rubberduck.config file.

  <CodeInspections>
    <CodeInspection Name="Parameter is passed ByRef implicitly" Severity="Warning" InspectionType="CodeQualityIssues" />
    <CodeInspection Name="Function returns an implicit Variant" Severity="DoNotShow" InspectionType="CodeQualityIssues" />
    <CodeInspection Name="Instruction contains multiple declarations" Severity="Hint" InspectionType="CodeQualityIssues" />
    <CodeInspection Name="Use of obsolete Rem comment syntax" Severity="Suggestion" InspectionType="MaintainabilityAndReadabilityIssues" />
    <CodeInspection Name="Option Explicit is not specified" Severity="Error" InspectionType="CodeQualityIssues" />
    <CodeInspection Name="Variable type is implicitly Variant" Severity="Warning" InspectionType="CodeQualityIssues" />
  </CodeInspections>