starpls icon indicating copy to clipboard operation
starpls copied to clipboard

Incorrect unused variable diagnosis in loops

Open keith opened this issue 4 months ago • 0 comments

With this code:

def foo():
    found = False
    for i in range(10):
        if found:
            break
        if i == 5:
            found = True
    return ""

You see this warning about found never being accessed:

Image

keith avatar Sep 04 '25 16:09 keith