Browse Source

Upload files to 'clang_configs'

master
mh 5 months ago
parent
commit
61528d0031
  1. 18
      clang_configs/clang_format_script.sh
  2. 18
      clang_configs/clang_tidy_script.sh

18
clang_configs/clang_format_script.sh

@ -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."

18
clang_configs/clang_tidy_script.sh

@ -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…
Cancel
Save