diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..dddc90e7d1 --- /dev/null +++ b/.clang-format @@ -0,0 +1,30 @@ +--- +BasedOnStyle: LLVM +IndentWidth: 4 +--- +Language: Cpp +AccessModifierOffset: -4 +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: true + AcrossComments: true + PadOperators: true +AlignEscapedNewlines: Left +AllowShortFunctionsOnASingleLine: InlineOnly +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Stroustrup +ForEachMacros: + - DGL_FOREACH_NODE + - DGL_FOREACH_EDGE + - BOOST_FOREACH +IfMacros: + - SORT_DEBUG +MacroBlockBegin: GNO_BEGIN +MacroBlockEnd: GNO_END +SortIncludes: Never +--- +Language: ObjC +--- +Language: JavaScript +--- +Language: Json diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000..de900dd344 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +5fb6b1a969e72db28df78483d3360b15a17f0c68 +cac8d9d848299297977d1315b7e90cc3f7698730 diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml new file mode 100644 index 0000000000..88652e7a6a --- /dev/null +++ b/.github/workflows/clang-format-check.yml @@ -0,0 +1,19 @@ +--- +name: ClangFormat Check + +on: + push: + branches: + - grass* + pull_request: +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.10.1 + with: + clang-format-version: '15' + check-path: . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..ae04269166 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,42 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + exclude: | + (?x)^( + .*\.ascii$| + .*\.ref$| + .*\.diff$| + .*\.rtf$| + .*\.kate-swp$| + .*\.svg$ + ) + - id: end-of-file-fixer + exclude: | + (?x)^( + .*\.ascii$| + .*\.ref$| + .*\.diff$| + .*\.rtf$| + .*\.kate-swp$| + .*\.svg$ + ) + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.33.0 + hooks: + - id: markdownlint + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v15.0.6 + hooks: + - id: clang-format + types_or: [c, c++, javascript, json, objective-c]