From a2f3d5869c521b9b8cf0fca92278397a5dbf2627 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Sun, 29 Sep 2019 13:52:23 -0700 Subject: [PATCH] Configuration for clang-format. --- .clang-format | 9 +++++++++ format.sh | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .clang-format create mode 100755 format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..6eb1fbef --- /dev/null +++ b/.clang-format @@ -0,0 +1,9 @@ +--- +Language: Cpp +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 90 +AccessModifierOffset: -4 +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +SortIncludes: false # breaks the build when enabled diff --git a/format.sh b/format.sh new file mode 100755 index 00000000..2134310a --- /dev/null +++ b/format.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +for f in src/*.c src/*.cpp src/*.h release/include/*/*.h tests/*.h tests/*/*.h; do + # Skip files that are imported from external sources. + if [[ ! $f = src/bin2c.* && \ + ! $f = src/lctype.* && \ + ! $f = src/linenoise.* && \ + ! $f = src/lj_strscan.* && \ + ! $f = src/lstring.* && \ + ! $f = src/lzio.* && \ + ! $f = src/MSVCSetupAPI.* ]]; then + clang-format -i "$f" + fi +done