Skip to content

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

Merged
Pierre-Sassoulas merged 4 commits into
pytest-dev:mainfrom
Pierre-Sassoulas:activate-ruff-checks
Feb 2, 2024
Merged

[pre-commit] Activate ruff checks and fix existing issues#11912
Pierre-Sassoulas merged 4 commits into
pytest-dev:mainfrom
Pierre-Sassoulas:activate-ruff-checks

Conversation

@Pierre-Sassoulas

Copy link
Copy Markdown
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.

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

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

bluetech commented Feb 2, 2024

Copy link
Copy Markdown
Member

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

Pierre-Sassoulas commented Feb 2, 2024

Copy link
Copy Markdown
Member Author

Always thought that format called __str__, TIL.

@Pierre-Sassoulas
Pierre-Sassoulas merged commit 5be64c3 into pytest-dev:main Feb 2, 2024
@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