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

Asserted variable considered unused #617

Open
FUSAKLA opened this issue Jul 19, 2022 · 1 comment · May be fixed by #723
Open

Asserted variable considered unused #617

FUSAKLA opened this issue Jul 19, 2022 · 1 comment · May be fixed by #723

Comments

@FUSAKLA
Copy link

FUSAKLA commented Jul 19, 2022

Hi, I just bumped into an issue when using

{   
    local input = [1,2,3],
    local knownItems = [1,2],
    local unknownItems = std.filter(function(i) !(i in knownItems), input),
    assert unknownItems == [] : "unexpected items: %s" % std.join(",",unknownItems)
}

Linter returns

Unused variable: unknownItems

Usage of the local variable here is obvious to avoid duplication of the filtering, but it is used just for assertion and validation of input data.

Would it be possible to also reflect usage in assertion?

@sparkprime
Copy link
Member

yes this is a bug in the linter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants