Skip to content

Inspection: Static code analysis for Err.Raise  #3313

@bclothier

Description

@bclothier

Given code like this:

Select Case Foo
  Case 1
    DoThis
  Case 2
    DoThat
  Case 3
    DoNothing
  Case Else
    Err.Raise 5, "Fail", "Foo can be only 1 , 2 or 3, moron!"
End Select

It would be useful to have an inspection where Foo is assigned a literal value or similar case that would case it to reach the Err.Raise statement and thus alert the user.

This can be useful for maintaining / updating enumerations that must be complete. Imagine adding a new flag to the enum but not remembering to update the Select Case that should process all possible values of the enumeration. There might be also other cases where the use of Err.Raise warrant additional analysis as the code get updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-path-analysisInvolves simulating execution paths / interpreting the user code ..to an extent.enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions