From 46a170fb71cc97394675183936f341898e3bb180 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 14 Oct 2022 09:08:07 -0700 Subject: [PATCH] ObjC --- .clang-format | 112 ++++++++++++++++++++++++ .github/actions/clang-format/action.yml | 4 +- .github/workflows/valiadate-apple.yml | 12 +++ 3 files changed, 126 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index 7bb07207..d64a4072 100644 --- a/.clang-format +++ b/.clang-format @@ -54,3 +54,115 @@ SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 Standard: Cpp11 UseTab: Never +--- +Language: ObjC +AccessModifierOffset: -1 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: DontAlign +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +FixNamespaceComments: true +ForEachMacros: + - FOR_EACH + - FOR_EACH_R + - FOR_EACH_RANGE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^<.*\.h(pp)?>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: true +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +TabWidth: 8 +UseCRLF: false +UseTab: Never +... diff --git a/.github/actions/clang-format/action.yml b/.github/actions/clang-format/action.yml index bc6c7019..6b71b079 100644 --- a/.github/actions/clang-format/action.yml +++ b/.github/actions/clang-format/action.yml @@ -19,5 +19,5 @@ runs: working-directory: ${{ inputs.directory }} shell: bash run: | - shopt -s globstar - clang-format-${{ inputs.version }} --dry-run --Werror **/*.cpp + shopt -s extglob + clang-format-${{ inputs.version }} --dry-run --Werror **/*(.cpp|.h|.m|.mm) diff --git a/.github/workflows/valiadate-apple.yml b/.github/workflows/valiadate-apple.yml index 24ad6705..b92866a7 100644 --- a/.github/workflows/valiadate-apple.yml +++ b/.github/workflows/valiadate-apple.yml @@ -29,3 +29,15 @@ jobs: - name: pod install working-directory: ./YogaKit/YogaKitSample run: pod install + + clang-format: + name: Clang Format + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: clang-format + uses: ./.github/actions/clang-format + with: + directory: ./YogaKit