From a0327e065e9dbc3a5f3b7437031f6842d5771bee Mon Sep 17 00:00:00 2001 From: William Hobbs Date: Mon, 26 Feb 2024 11:57:52 -0800 Subject: [PATCH] .clang-format: add clang-format file Add a clang-format file to standardize all C formatting for future tests. --- .clang-format | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..2276364 --- /dev/null +++ b/.clang-format @@ -0,0 +1,37 @@ +BasedOnStyle : google +SpaceBeforeParens : Always +IndentWidth : 4 +BreakBeforeBraces : Custom +BraceWrapping : + BeforeElse : true + AfterFunction : true +UseTab: Never +AllowShortIfStatementsOnASingleLine : false +ConstructorInitializerAllOnOneLineOrOnePerLine : true +AllowShortFunctionsOnASingleLine : false +AllowShortLoopsOnASingleLine : false +BinPackParameters : false +BinPackArguments : false +AllowAllParametersOfDeclarationOnNextLine : false +AlignTrailingComments : true +ColumnLimit : 88 + +# do not put all arguments on one line unless it's the same line as the call +PenaltyBreakBeforeFirstCallParameter : 10000000 +PenaltyReturnTypeOnItsOwnLine : 65000 +PenaltyBreakString : 10 + +# treat foreach macros as for loops +ForEachMacros : +- json_array_foreach +- json_object_foreach + +# These improve formatting results but require clang 3.6/7 or higher +SortIncludes : false +BreakBeforeBinaryOperators : NonAssignment +AlignAfterOpenBracket: Align +AlignOperands : true +BreakBeforeTernaryOperators : true +AllowAllParametersOfDeclarationOnNextLine : false +SpaceBeforeSquareBrackets: false +IndentPPDirectives: None