From f31ac1560c88bb3beedb41838a8d37b1a68d78ac Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 11 Jun 2024 14:18:52 -0700 Subject: [PATCH] remove automated formatting checks --- .clang-format | 123 -------------------------------- .github/workflows/presubmit.yml | 22 ------ scripts/check-format.sh | 55 -------------- 3 files changed, 200 deletions(-) delete mode 100644 .clang-format delete mode 100755 scripts/check-format.sh diff --git a/.clang-format b/.clang-format deleted file mode 100644 index d563a411..00000000 --- a/.clang-format +++ /dev/null @@ -1,123 +0,0 @@ ---- -Language: Cpp -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlines: Right -AlignOperands: false -AlignTrailingComments: false -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: All -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLoopsOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: MultiLine -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: true - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: true - IndentBraces: false - SplitEmptyFunction: false - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: false -DerivePointerAlignment: true -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: false -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '(Test)?$' -IndentCaseLabels: true -IndentPPDirectives: None -IndentWidth: 4 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 2 -NamespaceIndentation: Inner -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 4 -ObjCSpaceAfterProperty: true -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Left -ReflowComments: true -SortIncludes: false -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: false -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 4 -UseTab: Never diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index bcb31e23..db0b0ccf 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -9,27 +9,8 @@ on: - '**/*.md' jobs: - format: - name: Code formatting - runs-on: ubuntu-latest - defaults: - run: - shell: bash - steps: - - uses: actions/checkout@v4 - with: - # repository: ${{github.repository}} (default) - fetch-depth: 0 - - name: Install clang-format - run: sudo apt-get install clang-format - - name: Check format - run: $GITHUB_WORKSPACE/scripts/check-format.sh - origin/`if [[ "${{github.event_name}}" == "push" ]]; then echo "main"; else echo "${{github.base_ref}}"; fi` - --binary clang-format - linux: runs-on: ubuntu-latest - needs: format defaults: run: shell: bash @@ -264,7 +245,6 @@ jobs: windows: runs-on: windows-latest - needs: format defaults: run: shell: pwsh @@ -522,7 +502,6 @@ jobs: macos: runs-on: macos-latest - needs: format defaults: run: shell: bash @@ -613,7 +592,6 @@ jobs: android: runs-on: ubuntu-latest - needs: format defaults: run: shell: bash diff --git a/scripts/check-format.sh b/scripts/check-format.sh deleted file mode 100755 index 24c61662..00000000 --- a/scripts/check-format.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -SOURCE_COMMIT="$1" -if [ "$#" -gt 0 ]; then - shift -fi - -# If no source commit is given target the default branch -if [ "x$SOURCE_COMMIT" = "x" ]; then - # If remote is not set use the remote of the current branch or fallback to "origin" - if [ "x$REMOTE" = "x" ]; then - BRANCH="$(git rev-parse --abbrev-ref HEAD)" - REMOTE="$(git config --local --get "branch.$BRANCH.remote" || echo 'origin')" - fi - SOURCE_COMMIT="remotes/$REMOTE/HEAD" -fi - -# Force colored diff output -DIFF_COLOR_SAVED="$(git config --local --get color.diff)" -if [ "x$DIFF_COLOR_SAVED" != "x" ]; then - git config --local --replace-all "color.diff" "always" -else - git config --local --add "color.diff" "always" -fi - -scratch="$(mktemp -t check-format.XXXXXXXXXX)" -finish () { - # Remove temporary file - rm -rf "$scratch" - # Restore setting - if [ "x$DIFF_COLOR_SAVED" != "x" ]; then - git config --local --replace-all "color.diff" "$DIFF_COLOR_SAVED" - else - git config --local --unset "color.diff" - fi -} -# The trap will be invoked whenever the script exits, even due to a signal, this is a bash only -# feature -trap finish EXIT - -GIT_CLANG_FORMAT="${GIT_CLANG_FORMAT:-git-clang-format}" -"$GIT_CLANG_FORMAT" --style=file --extensions=cc,cp,cpp,c++,cxx,cu,cuh,hh,hpp,hxx,hip,vert,frag --diff "$@" "$SOURCE_COMMIT" > "$scratch" - -# Check for no-ops -grep '^no modified files to format$\|^clang-format did not modify any files$' \ - "$scratch" > /dev/null && exit 0 - -# Dump formatting diff and signal failure -printf \ -"\033[31m==== FORMATTING VIOLATIONS DETECTED ====\033[0m -run '\033[33m%s --style=file %s %s\033[0m' to apply these formating changes\n\n" \ -"$GIT_CLANG_FORMAT" "$*" "$SOURCE_COMMIT" - -cat "$scratch" -exit 1