From fd7581f8babebdd9eeb13cc4a9800dbb80f893a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 1 Dec 2021 16:08:28 +0100 Subject: [PATCH] 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 --- .clang-format | 7 +++++++ scripts/apply-clang-format.sh | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 .clang-format create mode 100755 scripts/apply-clang-format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..a3cf6a1f --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +--- +BasedOnStyle: Google +IndentWidth: 2 +--- +Language: Cpp +ColumnWidth: 100 +--- diff --git a/scripts/apply-clang-format.sh b/scripts/apply-clang-format.sh new file mode 100755 index 00000000..36f5ee92 --- /dev/null +++ b/scripts/apply-clang-format.sh @@ -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