pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.72k stars 211 forks source link

Use ruff for formatting too #645

Closed akx closed 2 months ago

akx commented 2 months ago

Following up on ruff being added for linting in #610, this makes formatting also use ruff instead of Black.

Pierre-Sassoulas commented 2 months ago

LGTM but this is not my decision to make.

Pierre-Sassoulas commented 2 months ago

It's available since November 2023 afair. In m'y experience It's faster than black, and it also permits to not argue about formatting. (Equivalent at first but they started to drift apart after black's 2024 style.. two months after first release). As long as it's pre-commit enforced and you don't have strong opinion about following black's style, it should not be a problem and a small quality of life increase when committing or reading the pre-commit conf.

akx commented 2 months ago

This ruff formatter seems new, or I have been time traveling :)) - what is your experience with it?

It's pretty new, yeah, but it's been rock stable and fast (as all of Astral's tools seem to be...). 99% compatible with the Black style, with some changes that are IMO for the better.

I can switch the quote styles around, sure, but that'll probably be a much larger diff. So – enforce single quotes everywhere is the preference?

ionelmc commented 2 months ago

Enforcing single quotes everywhere is what [tool.ruff.lint.flake8-quotes] inline-quotes = "single" was supposed to do. I guess I have to try this and see how it goes.