|
| 1 | +# Pre-commit is tool which we use to format and check this repository. This is |
| 2 | +# also used in CI. You will still get nicer commits if you install it also |
| 3 | +# locally. |
| 4 | +# |
| 5 | +# To install pre-commit run in repository root: |
| 6 | +# pip install pre-commit |
| 7 | +# pre-commit install |
| 8 | +# |
| 9 | +# To ignore pre-commit checks run: |
| 10 | +# git commit --no-verify |
| 11 | +# or |
| 12 | +# pre-commit uninstall |
| 13 | + |
| 14 | +# Just in case exclude build and .git folders. Others are for external files. |
| 15 | +exclude: build|\.git|external/|BACnet\-Server\.X/|tools/(avstack|check\-stack\-usage|memap)|test/ztest/ |
| 16 | + |
| 17 | +repos: |
| 18 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 19 | + rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # v4.6.0 |
| 20 | + hooks: |
| 21 | + - id: check-merge-conflict |
| 22 | + args: [--assume-in-merge] |
| 23 | + # Editorconfig-checker does not care if file contains multiple newlines. |
| 24 | + - id: end-of-file-fixer |
| 25 | + exclude: '.*\.(cproj|vcxproj.*|props)$' |
| 26 | + - id: check-yaml |
| 27 | + args: [ |
| 28 | + # for .clang-format |
| 29 | + --allow-multiple-documents, |
| 30 | + ] |
| 31 | + - id: check-case-conflict |
| 32 | + - id: check-shebang-scripts-are-executable |
| 33 | + - id: fix-byte-order-marker |
| 34 | + # Seems that VS files are using BOMs. |
| 35 | + exclude: '.*\.(cproj|vcxproj.*|sln|atsln|props)$' |
| 36 | + - id: trailing-whitespace |
| 37 | + |
| 38 | + - repo: https://github.com/Lucas-C/pre-commit-hooks |
| 39 | + rev: a30f0d816e5062a67d87c8de753cfe499672b959 # v1.5.5 |
| 40 | + hooks: |
| 41 | + - id: remove-tabs |
| 42 | + name: Remove tabs (4 spaces) |
| 43 | + args: ["--whitespaces-count", "4"] |
| 44 | + exclude: \.(yaml|yml|html|htm|sln|atsln|layout)$|Makefile|\.(mgw|mak|MAK)$|Dockerfile$ |
| 45 | + - id: remove-tabs |
| 46 | + name: Remove tabs (2 spaces) |
| 47 | + args: ["--whitespaces-count", "2"] |
| 48 | + files: '.*\.(yaml|yml|html|htm)|Dockerfile$' |
| 49 | + |
| 50 | + - repo: https://github.com/pre-commit/mirrors-clang-format |
| 51 | + rev: 05241dc3def184dba136e62d54ff57f1c8a497a9 # v17.0.6 |
| 52 | + hooks: |
| 53 | + - id: clang-format |
| 54 | + |
| 55 | + # We might enable this in future. |
| 56 | + # - repo: https://github.com/pre-commit/mirrors-prettier |
| 57 | + # rev: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 # v3.1.0 |
| 58 | + # hooks: |
| 59 | + # - id: prettier |
| 60 | + |
| 61 | + - repo: https://github.com/pre-commit/pygrep-hooks |
| 62 | + rev: v1.10.0 # v1.10.0 |
| 63 | + hooks: |
| 64 | + - id: text-unicode-replacement-char |
| 65 | + |
| 66 | + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python |
| 67 | + rev: 3.2.0 #2.6.2 |
| 68 | + hooks: |
| 69 | + - id: editorconfig-checker |
| 70 | + alias: ec |
| 71 | + args: [ |
| 72 | + # Saddly we have to disable this, but it just won't work. Maybe some day. |
| 73 | + -disable-indent-size, |
| 74 | + ] |
0 commit comments