[GH-ISSUE #4929] [Feature Request]: Add a cmake-format config so the pre-commit hook stops reflowing comments #1253

Closed
opened 2026-10-29 21:24:27 +00:00 by bsakaguchi · 1 comment
Owner

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-format pre-commit hook (.pre-commit-config.yaml, cheshirekow/cmake-format-precommit v0.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, in mooncake-store/benchmarks/CMakeLists.txt:

# Add storage backend benchmark executable
# This benchmark tests all storage backends (OffsetAllocator, Bucket, FilePerKey)
# with realistic KV cache workloads for LLM inference scenarios

becomes

# Add storage backend benchmark executable This benchmark tests all storage
# ...

On main (d53ddb9f), running the hook on 12 of the tracked CMake files rewrites their comments this way.

Proposal

Add .cmake-format.json at the repo root:

{
  "markup": {
    "enable_markup": false
  }
}

I've checked that the hook picks it up from the repo root, both with cmake-format directly and with pre-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.

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...

  • Make sure you already searched for relevant issues and read the documentation
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-format` pre-commit hook ([`.pre-commit-config.yaml`](https://github.com/kvcache-ai/Mooncake/blob/main/.pre-commit-config.yaml), `cheshirekow/cmake-format-precommit` v0.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, in `mooncake-store/benchmarks/CMakeLists.txt`: ```cmake # Add storage backend benchmark executable # This benchmark tests all storage backends (OffsetAllocator, Bucket, FilePerKey) # with realistic KV cache workloads for LLM inference scenarios ``` becomes ```cmake # Add storage backend benchmark executable This benchmark tests all storage # ... ``` On `main` (`d53ddb9f`), running the hook on 12 of the tracked CMake files rewrites their comments this way. ### Proposal Add `.cmake-format.json` at the repo root: ```json { "markup": { "enable_markup": false } } ``` I've checked that the hook picks it up from the repo root, both with `cmake-format` directly and with `pre-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](https://github.com/apache/arrow/blob/main/cmake-format.py) and [facebook/folly](https://github.com/facebook/folly/blob/main/.cmake-format). ### 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](https://github.com/BlankSpruce/gersemi) is a maintained alternative with a pre-commit hook. Projects that have switched to it include facebookincubator/velox ([#14237](https://github.com/facebookincubator/velox/pull/14237)), XRPLF/rippled ([#6486](https://github.com/XRPLF/rippled/pull/6486)), microsoft/CCF ([#7789](https://github.com/microsoft/CCF/pull/7789)) and FEniCS/dolfinx ([#4242](https://github.com/FEniCS/dolfinx/pull/4242)). I can open a PR that adds the config. ### Before submitting a new issue... - [x] Make sure you already searched for relevant issues and read the [documentation](https://kvcache-ai.github.io/Mooncake/)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 25, 2026):

Thanks for opening this issue, @2xdevv!

Field Value
Issue #4929
GitHub user ID 261649551
Reporter @2xdevv

A maintainer will triage this when possible. To help us respond faster, please include:

  • Mooncake version or commit SHA
  • Environment (OS, CUDA/driver, RDMA stack if relevant)
  • Steps to reproduce and expected vs. actual behavior

Useful links: Documentation · Contributing guide

This message was posted automatically by the issue bot.

<!-- gh-comment-id:6400461566 --> @github-actions[bot] commented on GitHub (Oct 25, 2026): Thanks for opening this issue, @2xdevv! | Field | Value | |-------|-------| | **Issue** | #4929 | | **GitHub user ID** | `261649551` | | **Reporter** | @2xdevv | A maintainer will triage this when possible. To help us respond faster, please include: - Mooncake version or commit SHA - Environment (OS, CUDA/driver, RDMA stack if relevant) - Steps to reproduce and expected vs. actual behavior Useful links: [Documentation](https://kvcache-ai.github.io/Mooncake/) · [Contributing guide](https://github.com/kvcache-ai/Mooncake/blob/main/CONTRIBUTING.md) > This message was posted automatically by the issue bot.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#1253
No description provided.