From 68f6f883cc21030459233956d675fabf87df3d74 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Fri, 10 Jul 2020 13:38:12 +0200
Subject: [PATCH] Code formatting

Add script to format all source/header files in one go.
---
 .clang-format           | 4 ++--
 scripts/apply-format.sh | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100755 scripts/apply-format.sh

diff --git a/.clang-format b/.clang-format
index d0ef16a775..b9adbf5584 100644
--- a/.clang-format
+++ b/.clang-format
@@ -25,7 +25,7 @@ BinPackParameters: false
 BreakBeforeBinaryOperators: NonAssignment
 BreakBeforeBraces: Attach
 BreakBeforeTernaryOperators: true
-BreakConstructorInitializers: AfterColon
+BreakConstructorInitializers: BeforeComma
 BreakInheritanceList: AfterColon
 ColumnLimit: 80
 CompactNamespaces: false
@@ -50,7 +50,7 @@ ObjCBinPackProtocolList: Auto
 ObjCBlockIndentWidth: 2
 PenaltyBreakAssignment: 2
 PointerAlignment: Left
-ReflowComments: true
+ReflowComments: false
 SortIncludes: true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: true
diff --git a/scripts/apply-format.sh b/scripts/apply-format.sh
new file mode 100755
index 0000000000..dc8e0c8e99
--- /dev/null
+++ b/scripts/apply-format.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+CLANG_FORMAT_BIN=${FAIRROOT_CLANG_FORMAT_BIN:-clang-format}
+
+FILES=$(find . -type f \
+        \( -iname "*.h" -o -iname "*.hpp" -o -iname "*.cxx" -o -iname "*.cpp" -o -iname "*.c" -o -iname "*.C" \) \
+        -not \( -path "./build/*" -o -path "./cmake/*" -o -path "./external/*" -o -path "./geometry/*" -o -path "./parameters/*" -o -path "./input/*" -prune \))
+
+$CLANG_FORMAT_BIN -i $FILES --verbose
-- 
GitLab