From fd3d08241b1d01b6cabc321ac6c08c41d24c9218 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 29 Nov 2023 13:36:30 -0800 Subject: [PATCH] revert files --- .clang-format | 44 +++++++++++++++++++ .../.cmake-format.py => .cmake-format | 2 +- .github/workflows/.clang-format | 9 ---- .github/workflows/pre_commit.yaml | 24 ++++++++++ .pre-commit-config.yaml | 28 ++++++++++++ 5 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 .clang-format rename .github/workflows/.cmake-format.py => .cmake-format (95%) delete mode 100644 .github/workflows/.clang-format create mode 100644 .github/workflows/pre_commit.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..7fd91b83 --- /dev/null +++ b/.clang-format @@ -0,0 +1,44 @@ +--- +BasedOnStyle: Google +Language: Cpp +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignTrailingComments: 'true' +AllowAllArgumentsOnNextLine: 'false' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AlwaysBreakBeforeMultilineStrings: 'false' +AlwaysBreakTemplateDeclarations: 'Yes' +BinPackArguments: 'false' +BinPackParameters: 'false' +BreakBeforeBraces: Linux +ColumnLimit: '100' +ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' +FixNamespaceComments: 'true' +IndentAccessModifiers: 'true' +IndentCaseLabels: 'true' +IndentWidth: '2' +NamespaceIndentation: All +PointerAlignment: Left +SpaceAfterCStyleCast: 'true' +SpaceAfterLogicalNot: 'false' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeCtorInitializerColon: 'true' +SpaceBeforeInheritanceColon: 'true' +SpaceBeforeParens: ControlStatements +SpacesInParentheses: 'false' +SpacesInSquareBrackets: 'false' +Standard: Cpp11 +TabWidth: '2' +UseTab: Never + +--- +Language: Json +# Use 100 columns for JS. +ColumnLimit: 100 +--- +Language: ObjC +# Use 100 columns for C#. +ColumnLimit: 100 +... diff --git a/.github/workflows/.cmake-format.py b/.cmake-format similarity index 95% rename from .github/workflows/.cmake-format.py rename to .cmake-format index 2fb7cd4b..77459569 100644 --- a/.github/workflows/.cmake-format.py +++ b/.cmake-format @@ -16,4 +16,4 @@ # If a statement is wrapped to more than one line, than dangle the closing # parenthesis on its own line. - dangle_parens = True + dangle_parens = True \ No newline at end of file diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format deleted file mode 100644 index b8cef3e9..00000000 --- a/.github/workflows/.clang-format +++ /dev/null @@ -1,9 +0,0 @@ -# Documentation about the style options and their meaning -# https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html - -Language: Cpp -AccessModifierOffset: 0 -AlignConsecutiveMacros: true -BreakBeforeBraces: Linux -ColumnLimit: 150 -ConstructorInitializerIndentWidth: 2 diff --git a/.github/workflows/pre_commit.yaml b/.github/workflows/pre_commit.yaml new file mode 100644 index 00000000..a258545c --- /dev/null +++ b/.github/workflows/pre_commit.yaml @@ -0,0 +1,24 @@ +name: pre-commit GitHub Action + +# Won't run on develop/main directly +on: + workflow_dispatch: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + - uses: EndBug/add-and-commit@v9.1.3 + # Only need to try and commit if the action failed + if: failure() + with: + fetch: false + committer_name: GitHub Actions + committer_email: actions@github.com + message: Apply pre-commmit fixes + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..b86c2759 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false + +repos: + - repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v16.0.1 + hooks: + - id: clang-format + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: forbid-new-submodules + - id: end-of-file-fixer + - id: check-yaml + args: [--allow-multiple-documents]