Support `ruff format` as a formatter
Any plans to begin using ruff format instead of black for code formatting?
Ruff is designed to be a drop in replacement for black and should provide a nice performance boost
@akaihola:
Some pointers to get started with implementation:
- many-formatters sub-project
- #251
- #304
- #51
- #309
- #266
ruff is a very nice linter, I use it in all my new projects now, but it's not a replacement for black, which is a code reformatter. Yes to include ruff as a supported lint tool in darker, but not as a replacement for black!
Thanks for the response! I should have been more clear, semi-recently they added formatting to it. Supposedly its 30x faster than black and a drop in replacement for 99.99% of scenarios
Oh right, I only used linters in ruff so far! https://docs.astral.sh/ruff/formatter/ Nice to know!
@clintonsteiner I'll definitely be looking into this. I love ruff's performance!
Would using ruff be a replacement or an optional setting?
@akaihola up to you but I'd probably do as an optional replacement for an iteration via setting an env variable (if you want it always on) or command line arg.
Would you mind assisting me with a little layout of the 3 files you'd start with when making this change as well as any other development tips?
@clintonsteiner could you catch up on the discussion in #251? Also the following items are related or contain relevant discussion: #304, #51, #309, #266.
Also FYI @guettli @Carreau @jedie: the idea of alternative reformatters is popping up again. I love it.
I would suggest being able to specify the formatter. We wouldn't be using Ruff (for various reasons) and being able to use darker with multiple formatters (even just the two) would make more sense. I see this is already suggested in #304. Happy to help out on this if need be.
I've run ruff using darker --revision origin/main . -L "ruff check --line-length=88 --select E501,ANN" which allows for incremental addition of lint rules.