-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b4a324
commit 7e9635b
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Find all C++ files and run clang-format on them | ||
find . -regex '.*\.\(cpp\|hpp\|c\|h\)' -exec clang-format -style=file -output-replacements-xml {} + | grep "<replacement " >/dev/null | ||
start_dir="." | ||
echo "Starting format check in directory: $start_dir" | ||
|
||
file_count=$(find $start_dir -type f \( -iname "*.cpp" -or -iname "*.hpp" -or -iname "*.c" -or -iname "*.h" \) -not -path "./external/*" | wc -l) | ||
echo "Total files to check: $file_count" | ||
|
||
find $start_dir -type f \( -iname "*.cpp" -or -iname "*.hpp" -or -iname "*.c" -or -iname "*.h" \) -not -path "./external/*" -exec echo "Processing file: {}" \; -exec clang-format -style=file -output-replacements-xml {} + | grep "<replacement " >/dev/null | ||
if [ $? -ne 1 ]; then | ||
echo "Code formatting differs from clang-format's style" | ||
exit 1 | ||
else | ||
echo "All files formatted correctly." | ||
fi |