|
| 1 | +# pre-commit is a tool to perform a predefined set of tasks manually and/or |
| 2 | +# automatically before git commits are made. |
| 3 | +# |
| 4 | +# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level |
| 5 | +# |
| 6 | +# Common tasks |
| 7 | +# |
| 8 | +# - Run on all files: pre-commit run --all-files |
| 9 | +# - Register git hooks: pre-commit install --install-hooks |
| 10 | +# |
| 11 | +repos: |
| 12 | + # Autoformat: Python code, syntax patterns are modernized |
| 13 | + - repo: https://github.com/asottile/pyupgrade |
| 14 | + rev: v3.3.1 |
| 15 | + hooks: |
| 16 | + - id: pyupgrade |
| 17 | + args: |
| 18 | + - --py38-plus |
| 19 | + |
| 20 | + # Autoformat: Python code |
| 21 | + - repo: https://github.com/PyCQA/autoflake |
| 22 | + rev: v2.0.2 |
| 23 | + hooks: |
| 24 | + - id: autoflake |
| 25 | + # args ref: https://github.com/PyCQA/autoflake#advanced-usage |
| 26 | + args: |
| 27 | + - --in-place |
| 28 | + |
| 29 | + # Autoformat: Python code |
| 30 | + - repo: https://github.com/pycqa/isort |
| 31 | + rev: 5.12.0 |
| 32 | + hooks: |
| 33 | + - id: isort |
| 34 | + |
| 35 | + # Autoformat: Python code |
| 36 | + - repo: https://github.com/psf/black |
| 37 | + rev: 23.3.0 |
| 38 | + hooks: |
| 39 | + - id: black |
| 40 | + exclude: "contrib\/template\/.*" |
| 41 | + |
| 42 | + # Autoformat: markdown, yaml |
| 43 | + - repo: https://github.com/pre-commit/mirrors-prettier |
| 44 | + rev: v3.0.0-alpha.6 |
| 45 | + hooks: |
| 46 | + - id: prettier |
| 47 | + |
| 48 | + # Misc... |
| 49 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 50 | + rev: v4.4.0 |
| 51 | + # ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available |
| 52 | + hooks: |
| 53 | + # Autoformat: Makes sure files end in a newline and only a newline. |
| 54 | + - id: end-of-file-fixer |
| 55 | + |
| 56 | + # Autoformat: Sorts entries in requirements.txt. |
| 57 | + - id: requirements-txt-fixer |
| 58 | + |
| 59 | + # Lint: Check for files with names that would conflict on a |
| 60 | + # case-insensitive filesystem like MacOS HFS+ or Windows FAT. |
| 61 | + - id: check-case-conflict |
| 62 | + |
| 63 | + # Lint: Checks that non-binary executables have a proper shebang. |
| 64 | + - id: check-executables-have-shebangs |
| 65 | + |
| 66 | + # Lint: Python code |
| 67 | + - repo: https://github.com/PyCQA/flake8 |
| 68 | + rev: "6.0.0" |
| 69 | + hooks: |
| 70 | + - id: flake8 |
| 71 | + |
| 72 | +# pre-commit.ci config reference: https://pre-commit.ci/#configuration |
| 73 | +ci: |
| 74 | + autoupdate_schedule: monthly |
0 commit comments