|
| 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: v2.31.0 |
| 15 | + hooks: |
| 16 | + - id: pyupgrade |
| 17 | + args: |
| 18 | + - --py37-plus |
| 19 | + |
| 20 | + # Autoformat: Python code |
| 21 | + - repo: https://github.com/psf/black |
| 22 | + rev: 22.1.0 |
| 23 | + hooks: |
| 24 | + - id: black |
| 25 | + args: [--target-version=py37] |
| 26 | + |
| 27 | + # Autoformat: Python code |
| 28 | + - repo: https://github.com/asottile/reorder_python_imports |
| 29 | + rev: v3.0.1 |
| 30 | + hooks: |
| 31 | + - id: reorder-python-imports |
| 32 | + |
| 33 | + # Autoformat: js, html, markdown, yaml, json |
| 34 | + - repo: https://github.com/pre-commit/mirrors-prettier |
| 35 | + rev: v2.6.1 |
| 36 | + hooks: |
| 37 | + - id: prettier |
| 38 | + exclude_types: |
| 39 | + # These are excluded initially as pre-commit was added but can |
| 40 | + # absolutely be enabled later. If so, we should consider having a |
| 41 | + # separate run of pre-commit where we configure a line spacing of 4 |
| 42 | + # for these file formats. |
| 43 | + - html |
| 44 | + - javascript |
| 45 | + - css |
| 46 | + |
| 47 | + # Misc autoformatting and linting |
| 48 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 49 | + rev: v4.1.0 |
| 50 | + hooks: |
| 51 | + - id: end-of-file-fixer |
| 52 | + exclude_types: [svg] |
| 53 | + - id: check-case-conflict |
| 54 | + - id: check-executables-have-shebangs |
| 55 | + - id: requirements-txt-fixer |
| 56 | + |
| 57 | + # Lint: Python code |
| 58 | + - repo: https://github.com/PyCQA/flake8 |
| 59 | + rev: "4.0.1" |
| 60 | + hooks: |
| 61 | + - id: flake8 |
| 62 | + |
| 63 | +# versioneer.py is excluded for being an imported dependency we opt to not |
| 64 | +# modify ourselves. This is also set in .flake8 for consistency. |
| 65 | +exclude: versioneer.py|binderhub/_version.py |
0 commit comments