Added formatting scripts

1. Added .clang-format file which contains information for the
   clang-format tool on how to format source files
2. Added shell helper script to apply all changes on HAL soures,
   test sources and primary sources

The shell script was not applied yet. This should be done shortly
before introducing the release. Also, it might be good idea to provide
instructions on how to set up the formatter for Eclipse
This commit is contained in:
Robin Müller 2021-12-01 16:08:28 +01:00
parent bf31248a50
commit fd7581f8ba
2 changed files with 15 additions and 0 deletions

7
.clang-format Normal file
View File

@ -0,0 +1,7 @@
---
BasedOnStyle: Google
IndentWidth: 2
---
Language: Cpp
ColumnWidth: 100
---

8
scripts/apply-clang-format.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ ! -f README.md ]]; then
cd ..
fi
find ./src -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i
find ./hal -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i
find ./tests -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i