Rubberduck: `Constant not used` QuickFix enhancement

Created on 1 Mar 2017  路  7Comments  路  Source: rubberduck-vba/Rubberduck

The QuickFix removes all text from the line up to the start of the comment.

Add a QuickFix option that will remove the whole line.

difficulty-01-duckling enhancement feature-inspections up-for-grabs

Most helpful comment

Looking at this and testing quick fix it looks like this has been taken care of.

Public Sub Temp()
    Const foo = 12, bar = 42 ' bar is not used
    MsgBox foo
End Sub

Becomes

Public Sub Temp()
    Const foo = 12 ' bar is not used
    MsgBox foo
End Sub

All 7 comments

Needs to account for this:

Const foo = 12, bar = 42 ' bar is not used
MsgBox foo

To avoid turning it into that:

MsgBox foo ' foo was removed and now the code is broken

Sounds like a good place for the code-rewriting API to explicitly test for ...

Const foo = 12, bar = 42 ' bar is not used has foo and bar both as an Integer in the Locals window. Inspection results have them coming up as ... implicitly Variant.

@IvenBach that is most likely a resolver problem. Fixing the Resolver there should enable us to fix "implicitly Variant". This also relates to DefTypes, because Implicitly Variant needs to correctly take DefType assigned types into account...

Could you open a separate issue?

Is this bug still even present? Not sure we had the rewriter stuff implemented back in March 2017...

Looking at this and testing quick fix it looks like this has been taken care of.

Public Sub Temp()
    Const foo = 12, bar = 42 ' bar is not used
    MsgBox foo
End Sub

Becomes

Public Sub Temp()
    Const foo = 12 ' bar is not used
    MsgBox foo
End Sub

well... "fixed somewhen in the last year" then

Was this page helpful?
0 / 5 - 0 ratings