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 {} \;