From 6daad3ae665c2b7602505d15a8f487b104618a62 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 31 Jan 2017 09:28:04 -0800 Subject: [PATCH] Update format.sh Summary: The format.sh was referring to an outdated `benchmarks/` directory and left out a bunch of other C/C++ files. This updates it to cover all but the build artifacts and vendored libraries in `lib/`. Reviewed By: emilsjolander Differential Revision: D4481490 fbshipit-source-id: 056e00359f794d0aa999fd65ec1ef0c657738867 --- format.sh | 67 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/format.sh b/format.sh index c8affc49..184c2635 100755 --- a/format.sh +++ b/format.sh @@ -1,34 +1,37 @@ #!/usr/bin/env bash -clang-format \ - -style="{ \ - AlignAfterOpenBracket: Align, \ - AlignEscapedNewlinesLeft: true, \ - AlignOperands: true, \ - AllowAllParametersOfDeclarationOnNextLine: false, \ - AllowShortBlocksOnASingleLine: false, \ - AllowShortCaseLabelsOnASingleLine: false, \ - AllowShortFunctionsOnASingleLine: false, \ - AllowShortIfStatementsOnASingleLine: false, \ - AllowShortLoopsOnASingleLine: false, \ - BinPackArguments: false, \ - BinPackParameters: false, \ - BreakBeforeBraces: Attach, \ - ColumnLimit: 100, \ - ContinuationIndentWidth: 4, \ - IndentCaseLabels: true, \ - IndentWidth: 2, \ - KeepEmptyLinesAtTheStartOfBlocks: false, \ - Language: Cpp, \ - PenaltyBreakBeforeFirstCallParameter: 100, \ - PenaltyBreakString: 1000, \ - PenaltyExcessCharacter: 100, \ - PenaltyReturnTypeOnItsOwnLine: 100, \ - PointerAlignment: Right, \ - SortIncludes: true, \ - SpaceAfterCStyleCast: true, \ - UseTab: Never, \ - }" "$@" \ - -i $(dirname $0)/yoga/*.{h,c,cpp} \ - $(dirname $0)/benchmarks/*.{h,c,cpp} \ - $(dirname $0)/java/jni/*.{h,c,cpp} +FILES=$(find . \( -path ./buck-out -o -path ./lib \) -prune -o \ + \( -name \*.h -o -name \*.c -o -name \*.cpp \) -print) + +for f in $FILES "$@"; do + clang-format \ + -style="{ \ + AlignAfterOpenBracket: Align, \ + AlignEscapedNewlinesLeft: true, \ + AlignOperands: true, \ + AllowAllParametersOfDeclarationOnNextLine: false, \ + AllowShortBlocksOnASingleLine: false, \ + AllowShortCaseLabelsOnASingleLine: false, \ + AllowShortFunctionsOnASingleLine: false, \ + AllowShortIfStatementsOnASingleLine: false, \ + AllowShortLoopsOnASingleLine: false, \ + BinPackArguments: false, \ + BinPackParameters: false, \ + BreakBeforeBraces: Attach, \ + ColumnLimit: 100, \ + ContinuationIndentWidth: 4, \ + IndentCaseLabels: true, \ + IndentWidth: 2, \ + KeepEmptyLinesAtTheStartOfBlocks: false, \ + Language: Cpp, \ + PenaltyBreakBeforeFirstCallParameter: 100, \ + PenaltyBreakString: 1000, \ + PenaltyExcessCharacter: 100, \ + PenaltyReturnTypeOnItsOwnLine: 100, \ + PointerAlignment: Right, \ + SortIncludes: true, \ + SpaceAfterCStyleCast: true, \ + UseTab: Never, \ + ObjCSpaceAfterProperty: true, \ + }" -i "$f" +done