fix: provision C++ clang-format for spotless - #918
Open
ColinLeeo wants to merge 1 commit into
Open
Conversation
ColinLeeo
force-pushed
the
fix/cpp-clang-format-provisioning
branch
from
August 24, 2026 06:43
46997d4 to
17a5688
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves C++ formatting reproducibility in the Maven/Spotless workflow by introducing a repo-local clang-format wrapper (pinned to 17.0.6) and updating documentation to use the correct Maven profiles for formatting across Java/C++/Python modules.
Changes:
- Update root and Python formatting documentation to use explicit Maven profiles/phases for formatting.
- Add
cpp/tools/clang-formatwrapper that downloads and runs a pinned clang-format (with PATH fallback on unsupported hosts). - Configure C++ Spotless to call the wrapper on Linux/macOS via OS-activated Maven profiles.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
CLAUDE.md |
Updates root formatting commands and explains how formatting is provisioned across profiles. |
python/CLAUDE.md |
Updates Python formatting command to use the with-python profile (and initialize) explicitly. |
cpp/tools/clang-format |
New wrapper script that provisions and enforces a pinned clang-format version. |
cpp/pom.xml |
Routes Spotless C++ formatting through a configurable executable, defaulting to wrapper on Linux/macOS. |
cpp/CLAUDE.md |
Documents Spotless/clang-format provisioning behavior for C++. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+41
to
+50
| download() { | ||
| url="$1" | ||
| output="$2" | ||
| if command -v curl >/dev/null 2>&1; then | ||
| curl -fL "${url}" -o "${output}" | ||
| elif command -v wget >/dev/null 2>&1; then | ||
| wget -O "${output}" "${url}" | ||
| else | ||
| echo "Neither curl nor wget is available to download clang-format ${VERSION}." >&2 | ||
| exit 1 |
| ./mvnw spotless:apply -P with-java,with-cpp # Format Java and C++ | ||
| ./mvnw spotless:check -P with-java,with-cpp # Check Java and C++ formatting | ||
| ./mvnw initialize spotless:apply -P with-java,with-python # Format Java, C++, and Python | ||
| ./mvnw process-sources -P with-java,with-python # Check Java, C++, and Python formatting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cpp/tools/clang-formatwrapper for clang-format 17.0.6.Validation
./cpp/tools/clang-format --version./mvnw spotless:apply -P with-cpp./mvnw spotless:check -P with-cpp./mvnw spotless:check -P with-java,with-cppxmllint --noout cpp/pom.xml