mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4929] [Feature Request]: Add a cmake-format config so the pre-commit hook stops reflowing comments #1253
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1253
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @2xdevv on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4929
Describe your feature request
The
cmake-formatpre-commit hook (.pre-commit-config.yaml,cheshirekow/cmake-format-precommitv0.6.13, added in #1124) runs without a config file, so it uses the tool's defaults. One default,markup.enable_markup = True, treats consecutive#lines as a single paragraph and re-wraps them. For example, inmooncake-store/benchmarks/CMakeLists.txt:becomes
On
main(d53ddb9f), running the hook on 12 of the tracked CMake files rewrites their comments this way.Proposal
Add
.cmake-format.jsonat the repo root:I've checked that the hook picks it up from the repo root, both with
cmake-formatdirectly and withpre-commit run cmake-format. With it in place, the hook leaves comment lines alone. JSON needs no extra dependencies in the hook's virtualenv; the YAML form needs PyYAML.Other projects that use cmake-format turn off markup the same way, for example apache/arrow and facebook/folly.
Related problems this does not fix
Existing drift. CI doesn't run the hook; it checks only clang-format on changed C++ lines (
scripts/code_format.sh). As a result, many CMake files no longer match the formatter's output. With the config, the hook still rewrites 56 of the 122 CMake files it covers (57 without the config), but only their layout (mostly indentation and argument alignment), never their comments. Contributors who touch these files keep working around the rewrites, for example in #3008 (SKIP=cmake-format), #3898, #4228, #4241, #4571, #4714, #4913 and #4924. Fixing that needs a one-time reformat and a CI check, or dropping the hook. Either is a separate decision for maintainers.cmake-format is unmaintained. v0.6.13 is its last release. If maintainers want to revisit the tool, gersemi is a maintained alternative with a pre-commit hook. Projects that have switched to it include facebookincubator/velox (#14237), XRPLF/rippled (#6486), microsoft/CCF (#7789) and FEniCS/dolfinx (#4242).
I can open a PR that adds the config.
Before submitting a new issue...
@github-actions[bot] commented on GitHub (Oct 25, 2026):
Thanks for opening this issue, @2xdevv!
261649551A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide