Unused Assignments not recognized for local variables

Issue #147 wontfix
Robert M.
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 S 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. Log in to comment