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

[ruff] Fix false positive on global keyword (RUF052) #15235

Merged

Conversation

Garrett-R
Copy link
Contributor

@Garrett-R Garrett-R commented Jan 3, 2025

Summary

Fixes #14996.

BTW, the issue correctly reports a false positive given that the docs say "Only local variables in function scopes are flagged by the rule".

Test Plan

I added the false positive to the fixture and verified it indeed caused a false positive before my fix was done.

@Garrett-R Garrett-R force-pushed the garrett/14996/ruff052-fix-global-keyword branch from ce679c7 to 70f2f89 Compare January 3, 2025 05:12
Copy link
Contributor

github-actions bot commented Jan 3, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@Garrett-R Garrett-R marked this pull request as ready for review January 3, 2025 05:20
@MichaReiser
Copy link
Member

@charliermarsh would you mind taking a look at my comment so that we can move forward with this PR?

@Garrett-R Garrett-R force-pushed the garrett/14996/ruff052-fix-global-keyword branch from 70f2f89 to 5155f96 Compare January 14, 2025 05:31
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I've reviewed the 3 snapshot files. As expected they have no "real" changes, just line numbers changing.

@Garrett-R Garrett-R requested a review from MichaReiser January 14, 2025 05:35
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@MichaReiser MichaReiser added the bug Something isn't working label Jan 14, 2025
@MichaReiser MichaReiser merged commit dc491e8 into astral-sh:main Jan 14, 2025
21 checks passed
@Garrett-R Garrett-R deleted the garrett/14996/ruff052-fix-global-keyword branch January 14, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

used-dummy-variable (RUF052) - false positive on private global variable when it has a usage in two functions
3 participants