Make format_checker languages configurable and add C++ support#294
Conversation
2006739 to
fa34d72
Compare
|
How does that fit together with the devcontainer precommit hook? |
fa34d72 to
4a7ffff
Compare
|
@FScholPer, I don't see any precommit hooks for file formatting besides yamlfmt. Maybe I'm looking in the wrong place. |
I think the situation is somewhat half finished. I originally introduced the pre-commit config here. The intention was that e.g. yamlfmt is used via pre-commit at least by repos, which do not have a need for bazel otherwise. The devcontainer repo itself is such an example. Then @AlexanderLanin started with the idea to reverse the dependency. The intention is that the devcontainer defines the tool versions. Either you use the devcontainer directly and get them, or via the added bazel code there. But I am afraid that Alexander might have stopped the work, after being done with the devcontainer, because the shuffles way too many plates at once. My personal opinion is that it is always nice to run fast and easy checks via pre-commit. I also see no reason why formatters could not be one of them. My only concern is that adding bazel to the equation might make it slower. |
The
use_format_targetshardcoded a fixed formatter set (Python, Rust, Starlark, YAML) with no way to opt out. Adding C++ unconditionally would force every consumer, including those without C++ code, to depend on the LLVM toolchain.use_format_targetsnow takes alanguageslist to select which formatters run.@llvm_toolchain//:clang-format.Behavior
use_format_targets()still wires Python, Rust, Starlark, YAML with no LLVM dependency.use_format_targets(languages = ["python", "rust", "starlark", "yaml", "cpp"]).Fixes #90