Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative (or an addition), could we add this to the build scripts? I.e. check if the hook exists, then create it if not? That way we could have better enforcement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are some more automatic/elegant solutions, example: https://github.com/polymathrobotics/livekit_ros2_bridge/blob/main/.pre-commit-config.yaml

```


Expand Down
Loading