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

LGTM.com - false positive for py/uninitialized-local-variable #9987

Open
rparini opened this issue Aug 8, 2022 · 3 comments
Open

LGTM.com - false positive for py/uninitialized-local-variable #9987

rparini opened this issue Aug 8, 2022 · 3 comments
Labels
acknowledged GitHub staff acknowledges this issue false-positive Python

Comments

@rparini
Copy link

rparini commented Aug 8, 2022

Description of the false positive

The error says that a variable may be used before it is initialized but the variable is defined on the line above. I cannot see a way that it would not be initialized.

URL to the alert on the project page on LGTM.com

It does not appear in LGTM.com (seems the py/uninitialized-local-variable alert is hidden by default) but on GitHub, using the CodeQL action, it is https://github.com/rparini/cxroots/security/code-scanning/28 Apologies if this is the wrong place for this report.

@MathiasVP
Copy link
Contributor

Hi @rparini.

Indeed, this looks like a false positive. Thank you for reporting it 🙇! I've forwarded it to the Python team.

Our current focus is on improving our security analysis. Because your report does not relate to a security query, we will put this on our backlog and prioritize it if we get enough reports of the same underlying issue in other projects. We'll let you as soon as it's fixed!

As a temporary workaround, you can setup GitHub Code Scanning to suppress individual alerts or disable the py/uninitialized-local-variable query altogether.

@MathiasVP MathiasVP added the acknowledged GitHub staff acknowledges this issue label Aug 8, 2022
@rparini
Copy link
Author

rparini commented Aug 10, 2022

Hi @MathiasVP, thanks for acknowledging. Is there some documentation on how to exclude the py/uninitialized-local-variable query completely? I can see how I would add more queries in the docs but not how I would exclude some.

@MathiasVP
Copy link
Contributor

Unfortunately, this isn't super easy to do right now. Here's an answer describes how to do it. Making it easier to disable specific queries is something we're working on at the moment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged GitHub staff acknowledges this issue false-positive Python
Projects
None yet
Development

No branches or pull requests

2 participants