Browse Source

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`
pull/25/head
Robin Eklind 8 years ago committed by Anders Jenbo
parent
commit
e9f16669ab
  1. 15
      format.sh

15
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
Loading…
Cancel
Save