Fixed VS Code format on save#1028
Fixed VS Code format on save#1028Titus-von-Koeller merged 2 commits intobitsandbytes-foundation:mainfrom
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
There is now two code formatters configured for this project: Yapf and Ruff. Would it make sense to align on one of them? |
|
This repo isn't using This change is fine, though, running the Ruff lint autofixes via VSCode and having a compliant |
Yeah, I just learned of Ruff from your PR actually. I've always been using black, but Ruff is lightning fast and seems to share the same no-bikeshedding design goal, which I really like. I actually thought Ruff was running formatting via the pre-commit toolchain as it wanted to delete duplicate linefeeds etc, but I did not look into it further. I agree that Ruff seems like a good choice, and I do think that running a complete Python format-on-save would be a quality of life improvement |
|
Yeah, Ruff has two personas, as it were: the linter, which has most of flake8's rules implemented, but notably not the whitespace rules just yet (there's a PR pending for that though: astral-sh/ruff#9266) and a Black-compatible formatter, which also cleans up whitespace to adhere to the same rules, but there's no way to apply just that part of the formatter (for technical raisins). There's a clear usecase for only wanting (part of) the whitespace rules instead of the wholesale reformatting that the formatter would apply too :) |
|
Hey @rickardp, thanks for the PR. This useful. |
|
Actually, I had posted an update with a decision to go forward with the black / ruff format approach and deprecate yapf. See #994 (comment) We should also set up a c-format formatter for C/C++/CUDA. Thanks a lot both! This kind of work will make it much easier for everyone to collaborate and contribute. I ll be back from vacation in a week. |
There is a pipeline linter now that checks that the files are correctly formatted.
This PR will make VS Code format the files correctly on save.
The .editorconfig should work with most IDEs.