From bb6ace40ac691165e47cce4b7aa3c9ea08a6b15e Mon Sep 17 00:00:00 2001 From: Dominik Wernberger Date: Thu, 4 Jul 2024 17:20:38 +0200 Subject: [PATCH] Add clang-format configuration --- .clang-format | 33 +++++++++++++++++++++++++++++++++ format.sh | 5 +++++ 2 files changed, 38 insertions(+) create mode 100644 .clang-format create mode 100755 format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..524c5d9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,33 @@ +--- +Language: Cpp +IndentWidth: 4 +AccessModifierOffset: -4 +AlignAfterOpenBracket: DontAlign +AlignArrayOfStructures: Left +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true +AllowShortBlocksOnASingleLine: Never +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +BraceWrapping: + BeforeWhile: true +BreakBeforeBraces: Allman +ColumnLimit: 120 +IncludeBlocks: Preserve +IndentCaseBlocks: true +IndentCaseLabels: true +InsertBraces: true +PackConstructorInitializers: Never +PointerAlignment: Left +ReferenceAlignment: Left +SeparateDefinitionBlocks: Always +SortIncludes: CaseSensitive +SpaceBeforeParens: Custom +SpaceBeforeParensOptions: + AfterControlStatements: false + AfterFunctionDefinitionName: false +SpaceBeforeRangeBasedForLoopColon: true +SpacesInAngles: Never +SpacesInParentheses: false \ No newline at end of file diff --git a/format.sh b/format.sh new file mode 100755 index 0000000..8f3dc36 --- /dev/null +++ b/format.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +REPO_DIR=$(realpath $(dirname $0)) + +find "$REPO_DIR/src" -iname "*.[ch]pp" -exec clang-format-15 --style=file:"$REPO_DIR/.clang-format" -i {} \;