mh
5 months ago
2 changed files with 36 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||
|
#!/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." |
@ -0,0 +1,18 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# Find all C++ files in the project directory and its subdirectories |
||||
|
files=$(find . -name "*.cpp") |
||||
|
|
||||
|
for file in $files; do |
||||
|
echo "Running clang-tidy for file: $file" |
||||
|
clangTidyOutput=$(clang-tidy "$file" -- -I/usr/include/c++/11 -I/usr/include/x86_64-linux-gnu/c++/11 -DMY_DEFINES ...) |
||||
|
echo "$clangTidyOutput" |
||||
|
|
||||
|
# Check if clang-tidy found any warnings |
||||
|
if [[ $clangTidyOutput == *"warning:"* ]]; then |
||||
|
echo "clang-tidy found warnings in file: $file" |
||||
|
echo "$clangTidyOutput" |
||||
|
exit 1 |
||||
|
fi |
||||
|
done |
||||
|
echo "clang-tidy done successful for all files." |
Loading…
Reference in new issue