From 61528d0031ca5ab796edad2e61cfaf0dc47c4fb2 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 10 Jul 2024 00:20:28 -0700 Subject: [PATCH] Upload files to 'clang_configs' --- clang_configs/clang_format_script.sh | 18 ++++++++++++++++++ clang_configs/clang_tidy_script.sh | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 clang_configs/clang_format_script.sh create mode 100644 clang_configs/clang_tidy_script.sh diff --git a/clang_configs/clang_format_script.sh b/clang_configs/clang_format_script.sh new file mode 100644 index 0000000..1da3d78 --- /dev/null +++ b/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." diff --git a/clang_configs/clang_tidy_script.sh b/clang_configs/clang_tidy_script.sh new file mode 100644 index 0000000..e406601 --- /dev/null +++ b/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."