From e059efe0d8fc0607de8feac6602a97d6e0007f9c Mon Sep 17 00:00:00 2001 From: shijing xian Date: Fri, 17 Apr 2026 14:03:55 -0700 Subject: [PATCH] add instruction to add pre-commit clang-format hook --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82c79f8e..af6da1db 100644 --- a/README.md +++ b/README.md @@ -481,9 +481,10 @@ In some cases, you may need to perform a full clean that deletes all build artif ``` ### Clang format -CPP SDK is using clang C++ format +CPP SDK is using clang C++ format, and set up the pre-commit hook (run once): ```bash brew install clang-format +printf '#!/bin/sh\necho "Running clang-format..."\nFILES=$(git diff --cached --name-only -- "*.cpp" "*.cc" "*.h" "*.hpp")\n[ -z "$FILES" ] && exit 0\nfor f in $FILES; do clang-format -i "$f"; git add "$f"; done\necho "clang-format completed."\n' > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit ```