You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any chance you could use the same (incredible) logic used for black/isort/flake8 and add options for clang-format and rustfmt? There are some precommit hooks out there (https://github.com/doublify/pre-commit-rust, https://github.com/pre-commit/mirrors-clang-format and a couple others for clang-format) but they don't handle running only on changed lines as well (if at all).
This would be an excellent feature for any large projects that use C or rust extensions.
Prettier would be very nice too, for yaml/json/toml/etc
Perhaps darker could somehow expose something generic where it uses the existing core diff logic, but allows the user to add any number of custom formatters
@tgross35 this is a great idea and something I have been thinking about in the past. There's nothing inherent in Darker that would prevent serving needs for other languages than Python.
And actually there are some existing issues and PRs which will help a bit towards this goal:
Once Black reformatting is no more done by default by Darker, we could indeed support all of these:
darker --format=black .
darker --format=prettier .
darker --format=clang-format .
darker --format=rustfmt .
I guess each of these options could automatically determine the file extensions to look for when discovering files to process.
Linters (the --lint/-L option) will be a bit more complicated to adapt since Darker just blindly passes each modified .py file to any binaries mentioned by the --lint/-L option. So either Darker has to grow awareness of specific linters and the file types they support, or alternatively, only one reformatter would be allowed per invocation, and the file extensions matched by the reformatter option would apply to all linters as well.
Let's keep this feature on the drawing board and hope others who are interested in it will find this issue as well!
Thank you for the very thorough answer! I didn't even realize the general idea was more or less already a work in progress so I'll get rid of this issue. I look forward to seeing whatever comes of it
Hello!
Is there any chance you could use the same (incredible) logic used for black/isort/flake8 and add options for clang-format and rustfmt? There are some precommit hooks out there (https://github.com/doublify/pre-commit-rust, https://github.com/pre-commit/mirrors-clang-format and a couple others for clang-format) but they don't handle running only on changed lines as well (if at all).
This would be an excellent feature for any large projects that use C or rust extensions.
Extra bonus if you somehow include the pep7 compliant clang format file by default https://gist.github.com/pganssle/0e3a5f828b4d07d79447f6ced8e7e4db
The text was updated successfully, but these errors were encountered: