|
| 1 | +--- |
| 2 | +repos: |
| 3 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 4 | + rev: v4.5.0 |
| 5 | + hooks: |
| 6 | + - id: no-commit-to-branch |
| 7 | + args: [--branch, master] |
| 8 | + - id: check-yaml |
| 9 | + args: [--unsafe] |
| 10 | + - id: check-json |
| 11 | + - id: mixed-line-ending |
| 12 | + - id: trailing-whitespace |
| 13 | + exclude_types: [markdown] |
| 14 | + - id: end-of-file-fixer |
| 15 | + - id: check-merge-conflict |
| 16 | + - id: check-executables-have-shebangs |
| 17 | + - id: check-shebang-scripts-are-executable |
| 18 | + exclude: ^tests/test_.*$ |
| 19 | + - id: fix-byte-order-marker |
| 20 | + - id: check-case-conflict |
| 21 | + |
| 22 | + # Beautify shell scripts |
| 23 | + - repo: https://github.com/lovesegfault/beautysh.git |
| 24 | + rev: v6.2.1 |
| 25 | + hooks: |
| 26 | + - id: beautysh |
| 27 | + exclude: (?x)^(tests/test_(.*))$ |
| 28 | + args: [-i, "2"] |
| 29 | + |
| 30 | + # Run local script |
| 31 | + - repo: local |
| 32 | + hooks: |
| 33 | + - id: local-precommit-script |
| 34 | + name: Run local script before commit if it exists |
| 35 | + language: system |
| 36 | + entry: bash -c '[ ! -x local.sh ] || ./local.sh' |
| 37 | + pass_filenames: false |
| 38 | + |
| 39 | + # Prettier (format code, only for non common files) |
| 40 | + - repo: https://github.com/pre-commit/mirrors-prettier |
| 41 | + rev: v4.0.0-alpha.8 |
| 42 | + hooks: |
| 43 | + - id: prettier |
| 44 | + stages: [manual] |
| 45 | + exclude_types: |
| 46 | + - executable |
| 47 | + - binary |
| 48 | + - shell |
| 49 | + - markdown |
| 50 | + |
| 51 | + # Check format of yaml files |
| 52 | + - repo: https://github.com/adrienverge/yamllint.git |
| 53 | + rev: v1.35.1 |
| 54 | + hooks: |
| 55 | + - id: yamllint |
| 56 | + args: |
| 57 | + - --no-warnings |
| 58 | + - -d |
| 59 | + - '{extends: relaxed, rules: {line-length: {max: 120}}}' |
| 60 | + |
| 61 | + # Execute codespell to fix typo errors (setup of codespell into dev/tools/codespell/) |
| 62 | + - repo: https://github.com/codespell-project/codespell |
| 63 | + rev: v2.2.6 |
| 64 | + hooks: |
| 65 | + - id: codespell |
| 66 | + args: |
| 67 | + - --ignore-words-list=master,als |
| 68 | + - --builtin=clear,rare,informal,usage,code,names,en-GB_to_en-US |
| 69 | + exclude_types: [image] |
| 70 | + |
| 71 | + # Check some shell scripts |
| 72 | + - repo: https://github.com/shellcheck-py/shellcheck-py |
| 73 | + rev: v0.9.0.6 |
| 74 | + hooks: |
| 75 | + - id: shellcheck |
| 76 | + args: [-W, '100'] |
| 77 | + |
| 78 | + # Run tests |
| 79 | + - repo: local |
| 80 | + hooks: |
| 81 | + - id: tests |
| 82 | + stages: [manual] |
| 83 | + name: Run tests |
| 84 | + language: system |
| 85 | + entry: bash -c "./bash_unit tests/*" |
| 86 | + pass_filenames: false |
0 commit comments