Write script for formatting code

This commit is contained in:
Camden Dixie O'Brien 2024-10-25 13:32:28 +01:00
parent 308deb3886
commit 8f4fe21bcf
2 changed files with 26 additions and 0 deletions

21
.clang-format Normal file
View File

@ -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
...

5
scripts/format.sh Normal file
View File

@ -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