Skip to content

Invert If analyzer should be aware of Is / IsNot complementation. #51359

@AdamSpeight2008

Description

@AdamSpeight2008

Brief description:
Make Invert If aware of the compliment pair of TypeOf ... Is ... and TypeOf ... IsNot ...

Languages applicable:
Maybe both, primarily VB.

Code example that the analyzer should report:

Source

If TypeOf e Is t Then
  ' Statements 0
Else
  ' Statements 1
End If

Expected

If TypeOf e IsNot t Then
  ' Statements 1
Else
  ' Statements 0
End If

Actual

If Not TypeOf e Is t Then
  ' Statements 1
Else
  ' Statements 0
End If

Additional information:

Any more additional information you would like to add.

Documentation requirements:

When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-AnalyzersArea-IDEBughelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions