Issues

Issue #147 wontfix

Unused Assignments not recognized for local variables

rmcode
created an issue

Local variables aren't marked as unused, if you use a short declaration like this:

local MAX_SPEED_Y;

It is only correctly marked, if you use the following declaration:

local MAX_SPEED_Y = nil;

But then of course it also is marked as a redundant initialisation. It is not a big issue, but it can lead to some left-over code if you usually rely on the inspections-functionality.

Would be nice if this could be fixed for one of the future updates.

Comments (2)

  1. Jon Akhtar repo owner

    This is by design. At the end of the day I concluded that there is no assignment in this statement:

    local FOO;
    

    The reason is that if you use this pattern:

    local a,b
    
    a = 1
    b = 2
    

    The a and b in the local statement will be flagged as unused assignments.

  2. Jon Akhtar repo owner

    If there is a use-case that would make it more useful to have I would be willing to add it back, but it was just too noisy for pre-declared locals

  3. Log in to comment