Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Feb 29, 2024

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Feb 29, 2024

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 :)

@github-actions

This comment has been minimized.

@Avasam
Copy link
Collaborator Author

Avasam commented Feb 29, 2024

Please also ignore UP038 everywhere [...]

Forgot about that one, I even have it in my own personal projects' ignore

@github-actions

This comment has been minimized.

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!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood changed the title Being less selective about pyupgrades rules Enable nearly all pyupgrade rules (except on test cases) Feb 29, 2024
@AlexWaygood AlexWaygood merged commit 26e8c00 into python:main Feb 29, 2024
@Avasam Avasam deleted the less-selective-pyupgrades-rules branch February 29, 2024 18:45
danieleades pushed a commit to danieleades/typeshed that referenced this pull request Mar 1, 2024
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants