From 8f4fe21bcf7228e60e56d9d76bbb61aa7fa9b2ed Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Fri, 25 Oct 2024 13:32:28 +0100 Subject: [PATCH] Write script for formatting code --- .clang-format | 21 +++++++++++++++++++++ scripts/format.sh | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 .clang-format create mode 100644 scripts/format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..3840d47 --- /dev/null +++ b/.clang-format @@ -0,0 +1,21 @@ +--- +BasedOnStyle: WebKit +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: DontAlign +AlignOperands: false +AlignTrailingComments: false +TabWidth: 4 +UseTab: ForIndentation +DerivePointerAlignment: false +PointerAlignment: Right +BinPackArguments: true +BinPackParameters: true +ExperimentalAutoDetectBinPacking: false +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortFunctionsOnASingleLine: None +ColumnLimit: 77 +... diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100644 index 0000000..9124d63 --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,5 @@ +cd "$(git rev-parse --show-toplevel)" +find . -not \( -path './.git' -prune \) \ + -not \( -path './build' -prune \) \ + -name '*.c' -o -name '*.h' \ + | xargs -n 1 clang-format -i