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

Support Ruff as a formatter #521

Open
clintonsteiner opened this issue Oct 26, 2023 · 8 comments
Open

Support Ruff as a formatter #521

clintonsteiner opened this issue Oct 26, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request many-formatters Support for multiple code formatters and skipping formatting performance Speed or memory usage improvement

Comments

@clintonsteiner
Copy link
Contributor

clintonsteiner commented Oct 26, 2023

Any plans to begin using ruff instead of black for code formatting?
Ruff is designed to be a drop in replacement for black and should provide a nice performance boost

See also:

@mrfroggg
Copy link

mrfroggg commented Dec 8, 2023

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!

@clintonsteiner
Copy link
Contributor Author

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

@mrfroggg
Copy link

mrfroggg commented Dec 8, 2023

Oh right, I only used linters in ruff so far!
https://docs.astral.sh/ruff/formatter/
Nice to know!

@akaihola
Copy link
Owner

@clintonsteiner I'll definitely be looking into this. I love ruff's performance!

@Svenito
Copy link
Collaborator

Svenito commented Mar 5, 2024

Would using ruff be a replacement or an optional setting?

@clintonsteiner
Copy link
Contributor Author

@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?

@akaihola
Copy link
Owner

akaihola commented Mar 7, 2024

@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.

@Svenito
Copy link
Collaborator

Svenito commented Mar 7, 2024

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.

@akaihola akaihola changed the title Implement ruff formatter instead of black Implement ruff formatter an addition to black Mar 14, 2024
@akaihola akaihola changed the title Implement ruff formatter an addition to black Implement ruff formatter in addition to black Mar 17, 2024
@akaihola akaihola added the many-formatters Support for multiple code formatters and skipping formatting label Mar 17, 2024
@akaihola akaihola changed the title Implement ruff formatter in addition to black Support Ruff as a formatter Mar 17, 2024
@akaihola akaihola added the performance Speed or memory usage improvement label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request many-formatters Support for multiple code formatters and skipping formatting performance Speed or memory usage improvement
Projects
Development

No branches or pull requests

4 participants