Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple conditionals operating on the same variable can be converted to Select Case block #16

Open
retailcoder opened this issue Nov 13, 2014 · 1 comment
Labels
code-path-analysis Involves simulating execution paths / interpreting the user code ..to an extent. difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-inspections up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

Comments

@retailcoder
Copy link
Member

[Suggestion]

Rubberduck should be able to determine whether a If..ElseIf block is checking the same variable against different values, and recommend converting the entire block into a Select Case block.

If foo = 123 Then
    '...
Else If foo = 456 Then
    '...
Else If foo = 789 Then
    '...
End If

Can be converted to:

Select Case foo
    Case 123:
        '...
    Case 456:
        '...
    Case 789:
        '...
End Select
@retailcoder
Copy link
Member Author

This inspection + quickfix requires implementing a specialized If block analyzer.

retailcoder added a commit that referenced this issue Jan 12, 2016
sync with merged PR's in main repo
@Vogel612 Vogel612 added the enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. label Nov 16, 2017
@retailcoder retailcoder added up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. code-path-analysis Involves simulating execution paths / interpreting the user code ..to an extent. labels Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-path-analysis Involves simulating execution paths / interpreting the user code ..to an extent. difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-inspections up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Projects
None yet
Development

No branches or pull requests

3 participants