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

Fix PLW1508 false positive for default string created via a mult operation #14841

Merged

Conversation

UnknownPlatypus
Copy link
Contributor

Summary

Fix a false positive for default string created via a mult operation.

MY_VAR = os.environ.get("MY_VAR", "0" * 32)

I find the if matches!(op, Operator::Mult) branch inside the Operator::Mult match quite inelegant but was not sure of the most idiomatic way to handle this.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Dec 8, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

@AlexWaygood
Copy link
Member

I find the if matches!(op, Operator::Mult) branch inside the Operator::Mult match quite inelegant but was not sure of the most idiomatic way to handle this.

Agreed -- I fixed it by splitting out the Operator::Mult handling into its own branch 👍 I think that makes more sense, even if it does introduce a tiny bit of repetition.

@AlexWaygood AlexWaygood added the bug Something isn't working label Dec 8, 2024
@AlexWaygood AlexWaygood enabled auto-merge (squash) December 8, 2024 18:24
@AlexWaygood AlexWaygood merged commit 8d9e408 into astral-sh:main Dec 8, 2024
20 checks passed
@UnknownPlatypus
Copy link
Contributor Author

Wonderful thanks !

Btw, just wanted to say that the dev onboarding was really simple. The Contributing.md is doing a great job.
Thanks for that.

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.

2 participants