]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
feat: add clang-format and pre-commit config files
authorSONOLET Aymeric <aymeric.sonolet@cea.fr>
Tue, 16 Apr 2024 10:15:17 +0000 (12:15 +0200)
committerSONOLET Aymeric <aymeric.sonolet@cea.fr>
Tue, 16 Apr 2024 10:15:17 +0000 (12:15 +0200)
.clang-format [new file with mode: 0644]
.pre-commit-config.yaml [new file with mode: 0644]

diff --git a/.clang-format b/.clang-format
new file mode 100644 (file)
index 0000000..b54894b
--- /dev/null
@@ -0,0 +1,21 @@
+# A clang-format style that approximates Python's PEP 7
+# Useful for IDE integration
+#
+BasedOnStyle: Google
+AlignAfterOpenBracket: Align
+AllowShortEnumsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+AlwaysBreakAfterReturnType: TopLevel
+BreakBeforeBraces: Stroustrup
+ColumnLimit: 79
+ContinuationIndentWidth: 8
+DerivePointerAlignment: false
+IndentWidth: 4
+IncludeBlocks: Regroup
+Language: Cpp
+PointerAlignment: Right
+ReflowComments: true
+SpaceBeforeParens: ControlStatements
+SpacesInParentheses: false
+TabWidth: 4
+UseTab: Never
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..2a4efa8
--- /dev/null
@@ -0,0 +1,102 @@
+---
+repos:
+    - repo: https://github.com/pre-commit/pre-commit-hooks
+      rev: v4.6.0  # Use the ref you want to point at
+      hooks:
+          - id: trailing-whitespace
+            exclude: |
+                (?x)^(
+                  .*\.py|
+                  .*\.cpp|
+                  .*\.h|
+                  .*\.hpp|
+                  .*\.hxx|
+                  .*\.cxx
+                )$
+          - id: check-added-large-files
+          - id: debug-statements
+          - id: detect-private-key
+          - id: end-of-file-fixer
+          - id: mixed-line-ending
+            exclude: |
+                (?x)^(
+                  .*\.py|
+                  .*\.cpp|
+                  .*\.h|
+                  .*\.hpp|
+                  .*\.hxx|
+                  .*\.cxx
+                )$
+          - id: check-case-conflict
+            exclude: |
+                (?x)^(
+                  .*\.py|
+                  .*\.cpp|
+                  .*\.h|
+                  .*\.hpp|
+                  .*\.hxx|
+                  .*\.cxx
+                )$
+          - id: check-json
+          - id: pretty-format-json
+          - id: check-merge-conflict
+          - id: check-toml
+          - id: check-xml
+          - id: requirements-txt-fixer
+    - repo: https://github.com/astral-sh/ruff-pre-commit
+      # Ruff version.
+      rev: v0.3.7
+      hooks:
+        # Run the linter.
+          - id: ruff
+            types_or: [python, pyi, jupyter]
+            args: [--fix]
+            exclude: |
+                (?x)^(
+                    .*[Tt]est.*|
+                    .*__init__.py
+                )$
+        # Run the formatter.
+          - id: ruff-format
+            types_or: [python, pyi, jupyter]
+    - repo: https://github.com/pre-commit/mirrors-clang-format
+      rev: v18.1.3  # Use the sha / tag you want to point at
+      hooks:
+          - id: clang-format
+            files: |
+              (?x)^(
+                  .*\.txx|
+                  .*\.hxx|
+                  .*\.cxx
+              )$
+            types_or: [text]
+    - repo: https://github.com/scop/pre-commit-shfmt
+      rev: v3.8.0-1
+      hooks:
+          # Choose one of:
+          - id: shfmt  # prebuilt upstream executable
+            args: [--indent=4, -w, -s]
+    - repo: https://github.com/shellcheck-py/shellcheck-py
+      rev: v0.10.0.1
+      hooks:
+          - id: shellcheck
+            args: [--severity=warning]
+    - repo: https://github.com/adrienverge/yamllint.git
+      rev: v1.35.1  # or higher tag
+      hooks:
+          - id: yamllint
+            args: [--strict, '--config-data={extends: relaxed, rules: {line-length: {max: 120}}}']
+    - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
+      rev: 0.2.3  # or other specific tag
+      hooks:
+          - id: yamlfmt
+    - repo: https://github.com/pre-commit/pygrep-hooks
+      rev: v1.10.0  # Use the ref you want to point at
+      hooks:
+          - id: rst-backticks
+          - id: rst-directive-colons
+          - id: rst-inline-touching-normal
+    - repo: https://github.com/cheshirekow/cmake-format-precommit
+      rev: v0.6.13
+      hooks:
+          - id: cmake-format