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 format as a formatter #521

Open
clintonsteiner opened this issue Oct 26, 2023 · 9 comments · May be fixed by #744
Open

Support ruff format as a formatter #521

clintonsteiner opened this issue Oct 26, 2023 · 9 comments · May be fixed by #744
Assignees
Labels
enhancement New feature or request many-formatters Support for multiple code formatters and skipping formatting performance Speed or memory usage improvement
Milestone

Comments

@clintonsteiner
Copy link
Collaborator

clintonsteiner commented Oct 26, 2023

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:

@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
Collaborator 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
Collaborator 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
@Will-Ruddick
Copy link

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.

@akaihola akaihola changed the title Support Ruff as a formatter Support ruff format as a formatter Aug 1, 2024
@akaihola akaihola linked a pull request Sep 17, 2024 that will close this issue
7 tasks
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

Successfully merging a pull request may close this issue.

5 participants