|
| 1 | +--- |
| 2 | +minimum_pre_commit_version: 3.5.0 |
| 3 | +repos: |
| 4 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 5 | + rev: v4.5.0 |
| 6 | + hooks: |
| 7 | + - id: check-merge-conflict # Check for files that contain merge conflict strings. |
| 8 | + - id: trailing-whitespace # Trims trailing whitespace. |
| 9 | + args: [--markdown-linebreak-ext=md] |
| 10 | + - id: mixed-line-ending # Replaces or checks mixed line ending. |
| 11 | + args: [--fix=lf] |
| 12 | + - id: end-of-file-fixer # Makes sure files end in a newline and only a newline. |
| 13 | + - id: check-merge-conflict # Check for files that contain merge conflict strings. |
| 14 | + - id: check-ast # Simply check whether files parse as valid python. |
| 15 | + |
| 16 | + # ----- Formatting ----------------------------------------------------------------------------> |
| 17 | + - repo: https://github.com/myint/autoflake |
| 18 | + rev: v2.2.1 |
| 19 | + hooks: |
| 20 | + - id: autoflake |
| 21 | + name: Remove unused variables and imports |
| 22 | + language: python |
| 23 | + args: ["--in-place", "--remove-all-unused-imports", "--remove-unused-variables", "--expand-star-imports"] |
| 24 | + files: \.py$ |
| 25 | + |
| 26 | + - repo: https://github.com/saltstack/pre-commit-remove-import-headers |
| 27 | + rev: 1.1.0 |
| 28 | + hooks: |
| 29 | + - id: remove-import-headers |
| 30 | + |
| 31 | + - repo: https://github.com/saltstack/salt-rewrite |
| 32 | + # Automatically rewrite code with known rules |
| 33 | + rev: 2.5.2 |
| 34 | + hooks: |
| 35 | + - id: salt-rewrite |
| 36 | + alias: rewrite-tests |
| 37 | + name: Rewrite the test suite |
| 38 | + files: ^tests/.*\.py$ |
| 39 | + args: [--silent, -E, fix_docstrings] |
| 40 | + |
| 41 | + - repo: https://github.com/asottile/pyupgrade |
| 42 | + rev: v3.15.0 |
| 43 | + hooks: |
| 44 | + - id: pyupgrade |
| 45 | + name: Rewrite Code to be Py3+ |
| 46 | + args: [ |
| 47 | + --py3-plus |
| 48 | + ] |
| 49 | + |
| 50 | + - repo: https://github.com/asottile/reorder_python_imports |
| 51 | + rev: v3.12.0 |
| 52 | + hooks: |
| 53 | + - id: reorder-python-imports |
| 54 | + args: [ |
| 55 | + --py3-plus, |
| 56 | + ] |
| 57 | + |
| 58 | + - repo: https://github.com/psf/black |
| 59 | + rev: 23.12.1 |
| 60 | + hooks: |
| 61 | + - id: black |
| 62 | + args: [-l 100] |
| 63 | + |
| 64 | + # <---- Formatting ----------------------------------------------------------------------------- |
0 commit comments