|
| 1 | +# install package |
| 2 | +# uv add -dev pre-commit |
| 3 | +# register as git commit-hook to run automatically |
| 4 | +# uv run pre-commit install |
| 5 | +# run manually |
| 6 | +# uv run pre-commit run --all-files |
| 7 | +# update hooks to latest version |
| 8 | +# uv run pre-commit autoupdate |
| 9 | + |
| 10 | +default_language_version: |
| 11 | + python: python3.11 |
| 12 | + |
| 13 | +exclude: | |
| 14 | + (?x)^( |
| 15 | + \.vscode/.*| |
| 16 | + tests/testdata/.*| |
| 17 | + src/strava-resources/.* |
| 18 | + )$ |
| 19 | +
|
| 20 | +repos: |
| 21 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 22 | + rev: v6.0.0 |
| 23 | + hooks: |
| 24 | + - id: check-added-large-files |
| 25 | + args: ["--maxkb=500"] |
| 26 | + - id: check-ast |
| 27 | + - id: check-builtin-literals |
| 28 | + - id: check-case-conflict |
| 29 | + - id: check-docstring-first |
| 30 | + - id: check-executables-have-shebangs |
| 31 | + # - id: check-illegal-windows-names |
| 32 | + - id: check-json |
| 33 | + - id: check-merge-conflict |
| 34 | + - id: check-shebang-scripts-are-executable |
| 35 | + - id: check-symlinks |
| 36 | + - id: check-toml |
| 37 | + - id: check-vcs-permalinks |
| 38 | + - id: check-xml |
| 39 | + - id: check-yaml |
| 40 | + - id: debug-statements |
| 41 | + - id: destroyed-symlinks |
| 42 | + # - id: detect-aws-credentials |
| 43 | + - id: detect-private-key |
| 44 | + # conflict with black below |
| 45 | + # - id: double-quote-string-fixer |
| 46 | + - id: end-of-file-fixer |
| 47 | + # - id: file-contents-sorter |
| 48 | + # files: ^(deploy-whitelist.txt|\.gitignore|\.dockerignore)$ |
| 49 | + - id: fix-byte-order-marker |
| 50 | + - id: forbid-new-submodules |
| 51 | + # - id: forbid-submodules |
| 52 | + - id: mixed-line-ending |
| 53 | + args: ["--fix=lf"] |
| 54 | + - id: name-tests-test |
| 55 | + args: ["--pytest-test-first"] |
| 56 | + # - id: no-commit-to-branch |
| 57 | + # args: [--branch, staging] |
| 58 | + - id: pretty-format-json |
| 59 | + args: ["--autofix", "--no-ensure-ascii", "--no-sort-keys"] |
| 60 | + - id: requirements-txt-fixer |
| 61 | + # - id: sort-simple-yaml |
| 62 | + # files: ^config/simple/ |
| 63 | + - id: trailing-whitespace |
| 64 | + |
| 65 | + # ruff |
| 66 | + - repo: https://github.com/astral-sh/ruff-pre-commit |
| 67 | + rev: v0.14.14 |
| 68 | + hooks: |
| 69 | + - id: ruff-check |
| 70 | + args: [--fix, --exit-non-zero-on-fix] |
| 71 | + - id: ruff-format |
| 72 | + |
| 73 | + # security |
| 74 | + - repo: https://github.com/gitleaks/gitleaks |
| 75 | + rev: v8.30.0 |
| 76 | + hooks: |
| 77 | + - id: gitleaks |
| 78 | + |
| 79 | + # markdown |
| 80 | + - repo: https://github.com/igorshubovych/markdownlint-cli |
| 81 | + rev: v0.47.0 |
| 82 | + hooks: |
| 83 | + - id: markdownlint |
| 84 | + args: ["--disable", "MD013"] |
| 85 | + |
| 86 | + # code spell check via cspell |
| 87 | + - repo: https://github.com/streetsidesoftware/cspell-cli |
| 88 | + rev: v9.4.0 |
| 89 | + hooks: |
| 90 | + - id: cspell |
0 commit comments