Enable nearly all pyupgrade rules (except on test cases)#11499
Merged
AlexWaygood merged 11 commits intopython:mainfrom Feb 29, 2024
Merged
Enable nearly all pyupgrade rules (except on test cases)#11499AlexWaygood merged 11 commits intopython:mainfrom
AlexWaygood merged 11 commits intopython:mainfrom
Conversation
Avasam
commented
Feb 29, 2024
This comment has been minimized.
This comment has been minimized.
…Avasam/typeshed into less-selective-pyupgrades-rules
Avasam
commented
Feb 29, 2024
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…Avasam/typeshed into less-selective-pyupgrades-rules
Member
|
Please also ignore UP038 everywhere due to astral-sh/ruff#7871. It doesn't matter for us now, since it only triggers if the target version is set to py310 or higher, but I don't want a nasty pre-commit surprise when we drop support for Python 3.9 :) |
This comment has been minimized.
This comment has been minimized.
This reverts commit 170653f.
Collaborator
Author
Forgot about that one, I even have it in my own personal projects' ignore |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
danieleades
pushed a commit
to danieleades/typeshed
that referenced
this pull request
Mar 1, 2024
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's more rules that we want than rules we don't want. And with Ruff having a distinction for "unsafe fixes" (not applied by default) the comment "Only enable rules that have safe autofixes" holds less weight.
Rules relevant to code changes:
https://docs.astral.sh/ruff/rules/lru-cache-without-parameters/
https://docs.astral.sh/ruff/rules/f-string/
Even the protobuf-specific ignore could be activated and autofixes run, as they have a redundant (for typeshed at least) Python >= 3.8 check.
Extracted from #11496 , overlaps with #11498
xref plinss/flake8-noqa#22 as with it there would be 1 less noqa