Merge pull request 'Added formatting scripts' (#527) from KSat/fsfw:mueller/clang-shell-script into development

Reviewed-on: fsfw/fsfw#527
This commit is contained in:
Ulrich Mohr 2021-12-13 14:26:22 +01:00
commit 2bd1e6acbd
3 changed files with 21 additions and 0 deletions

7
.clang-format Normal file
View File

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

View File

@ -107,6 +107,12 @@ cmake --build . -- fsfw-tests_coverage -j
The `coverage.py` script located in the `script` folder can also be used to do this conveniently.
## Formatting the sources
The formatting is done by the `clang-format` tool. The configuration is contained within the
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
can run the `apply-clang-format.sh` helper script to format all source files consistently.
## Index
[1. High-level overview](docs/README-highlevel.md#top) <br>

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 -o -iname *.c | xargs clang-format --style=file -i
find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i