Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

False positive in unused-output-variable #1353

Closed
anderseknert opened this issue Jan 20, 2025 · 1 comment · Fixed by #1398
Closed

False positive in unused-output-variable #1353

anderseknert opened this issue Jan 20, 2025 · 1 comment · Fixed by #1398
Labels
bug Something isn't working rule

Comments

@anderseknert
Copy link
Member

i is here incorrectly flagged as an unused-output-variable:

rule if {
    [i |
        some i
        foo[i]
    ]
}

The issue seems to be isolated to rule bodies, or at least bodies. This isn't flagged:

rule := [i |
    some i
    foo[i]
]
@anderseknert anderseknert added bug Something isn't working rule labels Jan 20, 2025
@anderseknert
Copy link
Member Author

Another false positive found when working with the Gatekeeper Library today:

provided := {annotation | input.review.object.metadata.annotations[annotation]}

Which incorrectly flags annotation as unused

anderseknert added a commit that referenced this issue Feb 6, 2025
Comprehension term vars are never unused, and should not be
flagged.

Fixes #1353

Signed-off-by: Anders Eknert <anders@styra.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant