-
Notifications
You must be signed in to change notification settings - Fork 311
Open
Labels
enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspectionsup-for-grabsUse this label in conjunction with a difficulty level label, e.g. difficulty-02-duckyUse this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Milestone
Description
What
Flag instances of SomeForm.Show
, where the instance being shown is the default instance of the form.
Why
Instance state stored in a form's default instance is often a source of bugs and/or unexpected behavior. By showing an instance that was specifically created to be shown in a particular context, code is more robust and better adheres to OOP principles.
Example
This code should trigger the inspection:
Public Sub DoSomething()
UserForm1.Show
End Sub
QuickFixes
-
Create and use new instance
Example code, after quickfix is applied:
Public Sub DoSomething() With New UserForm1 .Show End With End Sub
Resources
Each inspection needs a number of resource strings - please provide a suggestion here:
- InspectionNames: userFormDefaultInstanceShown
- InspectionInfo: Instance state stored in a form's default instance is often a source of bugs and/or unexpected behavior. Avoiding to show the default instance ensures the form's state remains in the local scope showing that form.
- InspectionResults: '{0}' is showing the default instance of '{1}' (0: expression; 1: form name)
Metadata
Metadata
Assignees
Labels
enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspectionsup-for-grabsUse this label in conjunction with a difficulty level label, e.g. difficulty-02-duckyUse this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky