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] Add rule forbidding map(int, package.__version__.split('.')) (RUF048) #14373

Merged
merged 8 commits into from
Nov 18, 2024

Conversation

InSyncWithFoo
Copy link
Contributor

Summary

Resolves #12961.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Nov 16, 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!

I wonder if the rule should also flag [int(x) for x in __version__] and (int(x) for x in __version__)? But that could always be done as a followup.

@InSyncWithFoo
Copy link
Contributor Author

@AlexWaygood Thanks! All fixed.

@dhruvmanila dhruvmanila added rule Implementing or modifying a lint rule preview Related to preview mode features labels Nov 18, 2024
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 AlexWaygood changed the title [ruff] tuple(map(int, package.__version__.split('.'))) (RUF048) [ruff] Add rule forbidding map(int, package.__version__.split('.')) (RUF048) Nov 18, 2024
@AlexWaygood AlexWaygood enabled auto-merge (squash) November 18, 2024 13:40
@AlexWaygood AlexWaygood merged commit 3642381 into astral-sh:main Nov 18, 2024
17 checks passed
@InSyncWithFoo InSyncWithFoo deleted the RUF048 branch November 20, 2024 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: Test for bad version parsing tuple(map(int, __version__)))
3 participants