this is better
fsfw/fsfw/pipeline/pr-development This commit looks good Details

This commit is contained in:
Robin Müller 2022-05-13 11:56:37 +02:00
parent c86e99e6dc
commit 23fb06578b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 22 additions and 0 deletions

22
scripts/auto-formatter.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
if [[ ! -f README.md ]]; then
cd ..
fi
cmake_fmt="cmake-format"
if command -v ${cmake_fmt} &> /dev/null; then
cmake_fmt_cmd="${cmake_fmt} -i CMakeLists.txt"
eval ${cmake_fmt_cmd}
else
echo "No ${cmake_fmt} tool found, not formatting CMake files"
fi
cpp_format="clang-format"
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then
find ./src ${file_selectors} | xargs clang-format --style=file -i
find ./hal ${file_selectors} | xargs clang-format --style=file -i
find ./tests ${file_selectors} | xargs clang-format --style=file -i
else
echo "No ${cpp_format} tool found, not formatting C++/C files"
fi