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

[pre-commit] Activate ruff checks and fix existing issues #11912

Merged

Conversation

Pierre-Sassoulas
Copy link
Member

Follow-up to #11901, there's some nice fixes here I think, especially automated removal of useless noqa. I would consider adding flake8-bugbear next but let me know what you think. I suppose most of the f"{x!s}" are the default behavior in a f-string and we could replace them with f"{x}" but I'm not sure why this is not what ruff does when autofixing already.

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

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

Nice!

👍 on bugbear (at least most of the rules).

flake8-pyi also looks very nice.

@bluetech
Copy link
Member

bluetech commented Feb 2, 2024

I suppose most of the f"{x!s}" are the default behavior in a f-string and we could replace them with f"{x}" but I'm not sure why this is not what ruff does when autofixing already.

Probably because __format__ might not be the same as __str__ so blind replacing would not be safe. For most types it would be the same, but needs manual inspection of the type.

@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented Feb 2, 2024

Always thought that format called __str__, TIL.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 5be64c3 into pytest-dev:main Feb 2, 2024
24 checks passed
@Pierre-Sassoulas Pierre-Sassoulas deleted the activate-ruff-checks branch February 2, 2024 19:22
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