Skip to content

Make format_checker languages configurable and add C++ support#294

Open
4og wants to merge 1 commit into
mainfrom
4og_configurable_formatter
Open

Make format_checker languages configurable and add C++ support#294
4og wants to merge 1 commit into
mainfrom
4og_configurable_formatter

Conversation

@4og

@4og 4og commented Jun 24, 2026

Copy link
Copy Markdown
Member

The use_format_targets hardcoded 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_targets now takes a languages list to select which formatters run.
  • Added opt-in C++ support via @llvm_toolchain//:clang-format.
  • Unknown languages raise a clear error; README updated.

Behavior

  • Backward compatible: use_format_targets() still wires Python, Rust, Starlark, YAML with no LLVM dependency.
  • C++ is opt-in: use_format_targets(languages = ["python", "rust", "starlark", "yaml", "cpp"]).

Fixes #90

@FScholPer

Copy link
Copy Markdown

How does that fit together with the devcontainer precommit hook?

@4og 4og force-pushed the 4og_configurable_formatter branch from fa34d72 to 4a7ffff Compare June 25, 2026 11:44
@4og

4og commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@FScholPer, I don't see any precommit hooks for file formatting besides yamlfmt. Maybe I'm looking in the wrong place.

@lurtz

lurtz commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

How does that fit together with the devcontainer precommit hook?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

format_checker is missing C++ target

3 participants