From e9f16669abfdfb6cc9768446d7280a2c1ff235b2 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sat, 6 Oct 2018 18:05:13 +0200 Subject: [PATCH] Add clang-format script. Base default style on WebKit and set a few options specific to Devilution. * `AlignTrailingComments: true` * `AllowShortBlocksOnASingleLine: true` * `AllowShortFunctionsOnASingleLine: None` * `PointerAlignment: Right` For header files, we also want to add * `AlignConsecutiveAssignments: true` --- format.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 format.sh diff --git a/format.sh b/format.sh new file mode 100755 index 000000000..66c6de538 --- /dev/null +++ b/format.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +CPP_DONE="Source/doom.cpp Source/movie.cpp Source/pfile.cpp Source/player.cpp Source/plrmsg.cpp Source/sound.cpp Source/spells.cpp Source/tmsg.cpp" + +for f in $CPP_DONE; do + echo "Formatting $f" + clang-format -style="{BasedOnStyle: webkit, AlignTrailingComments: true, AllowShortBlocksOnASingleLine: true, AllowShortFunctionsOnASingleLine: None, PointerAlignment: Right}" -i $f +done + +H_DONE="enums.h structs.h" + +for f in $H_DONE; do + echo "Formatting $f" + clang-format -style="{BasedOnStyle: webkit, AlignTrailingComments: true, AllowShortBlocksOnASingleLine: true, AllowShortFunctionsOnASingleLine: None, PointerAlignment: Right, AlignConsecutiveAssignments: true}" -i $f +done