You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
484 B

#!/bin/bash
# Find all C++ files in the project directory and its subdirectories
files=$(find . -name "*.cpp")
# Iterate over each file
for file in $files; do
clang-format "$file" > format_errors.txt 2>&1
# Compare the original file with the formatted version
if ! cmp -s "$file" format_errors.txt; then
echo "Formatting failed for file: $file. Reasons:"
cat format_errors.txt
exit 1
fi
done
echo "Formatting successful for all files."