|
| 1 | +--- |
| 2 | +# See https://pre-commit.com for more information |
| 3 | +# See https://pre-commit.com/hooks.html for more hooks |
| 4 | +# - Added pkgs feature flag auto generated code to flake8 exclude list |
| 5 | +# Force all unspecified python hooks to run python 3.10 |
| 6 | +default_language_version: |
| 7 | + python: python3.9 |
| 8 | +default_stages: |
| 9 | + - commit |
| 10 | +repos: |
| 11 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 12 | + rev: v4.5.0 |
| 13 | + hooks: |
| 14 | + - id: trailing-whitespace |
| 15 | + # TODO: Exclude tests/test_data directory |
| 16 | + exclude: ^tests/test_data/ |
| 17 | + exclude_types: |
| 18 | + - "markdown" |
| 19 | + - id: end-of-file-fixer |
| 20 | + - id: check-yaml |
| 21 | + args: [--unsafe] |
| 22 | + - id: check-added-large-files |
| 23 | + args: ["--maxkb=10240"] |
| 24 | + - id: check-case-conflict |
| 25 | + - id: check-docstring-first |
| 26 | + - id: check-ast |
| 27 | + - id: check-json |
| 28 | + exclude: ".vscode/launch.json" |
| 29 | + - id: check-executables-have-shebangs |
| 30 | + - id: check-shebang-scripts-are-executable |
| 31 | + - id: check-toml |
| 32 | + - id: debug-statements |
| 33 | + - id: detect-private-key |
| 34 | + - id: check-merge-conflict |
| 35 | + - id: check-symlinks |
| 36 | + - id: destroyed-symlinks |
| 37 | + - id: forbid-new-submodules |
| 38 | + - id: mixed-line-ending |
| 39 | + - id: no-commit-to-branch |
| 40 | + - repo: https://github.com/adrienverge/yamllint |
| 41 | + rev: v1.35.1 |
| 42 | + hooks: |
| 43 | + - id: yamllint |
| 44 | + args: ["-d", "relaxed"] |
| 45 | + language: system |
| 46 | + - repo: https://github.com/rhysd/actionlint |
| 47 | + rev: v1.6.26 |
| 48 | + hooks: |
| 49 | + - id: actionlint-docker |
| 50 | + args: [-ignore, 'label ".+" is unknown'] |
| 51 | + - repo: https://github.com/psf/black |
| 52 | + rev: 24.2.0 |
| 53 | + hooks: |
| 54 | + - id: black |
| 55 | + args: [--config=pyproject.toml, -l 120] |
| 56 | + language: system |
| 57 | + exclude: | |
| 58 | + (?x)^( |
| 59 | + pkgs/unstract-flags/src/unstract/flags/evaluation_.*\.py| |
| 60 | + )$ |
| 61 | + - repo: https://github.com/pycqa/flake8 |
| 62 | + rev: 7.0.0 |
| 63 | + hooks: |
| 64 | + - id: flake8 |
| 65 | + args: [--max-line-length=120] |
| 66 | + exclude: | |
| 67 | + (?x)^( |
| 68 | + .*migrations/.*\.py| |
| 69 | + unstract-core/tests/.*| |
| 70 | + pkgs/unstract-flags/src/unstract/flags/evaluation_.*\.py| |
| 71 | + )$ |
| 72 | + - repo: https://github.com/pycqa/isort |
| 73 | + rev: 5.13.2 |
| 74 | + hooks: |
| 75 | + - id: isort |
| 76 | + files: "\\.(py)$" |
| 77 | + args: |
| 78 | + [ |
| 79 | + "--profile", |
| 80 | + "black", |
| 81 | + "--filter-files", |
| 82 | + --settings-path=pyproject.toml, |
| 83 | + ] |
| 84 | + - repo: https://github.com/hadialqattan/pycln |
| 85 | + rev: v2.4.0 |
| 86 | + hooks: |
| 87 | + - id: pycln |
| 88 | + args: [--config=pyproject.toml] |
| 89 | + - repo: https://github.com/pycqa/docformatter |
| 90 | + rev: v1.7.5 |
| 91 | + hooks: |
| 92 | + - id: docformatter |
| 93 | + # - repo: https://github.com/MarcoGorelli/absolufy-imports |
| 94 | + # rev: v0.3.1 |
| 95 | + # hooks: |
| 96 | + # - id: absolufy-imports |
| 97 | + - repo: https://github.com/asottile/pyupgrade |
| 98 | + rev: v3.15.0 |
| 99 | + hooks: |
| 100 | + - id: pyupgrade |
| 101 | + entry: pyupgrade --py39-plus --keep-runtime-typing |
| 102 | + types: |
| 103 | + - python |
| 104 | + - repo: https://github.com/gitleaks/gitleaks |
| 105 | + rev: v8.18.2 |
| 106 | + hooks: |
| 107 | + - id: gitleaks |
| 108 | + - repo: https://github.com/asottile/yesqa |
| 109 | + rev: v1.5.0 |
| 110 | + hooks: |
| 111 | + - id: yesqa |
| 112 | + # TODO: Uncomment after typing the SDK |
| 113 | + # - repo: https://github.com/pre-commit/mirrors-mypy |
| 114 | + # rev: v1.8.0 |
| 115 | + # hooks: |
| 116 | + # - id: mypy |
| 117 | + # language: system |
| 118 | + # entry: mypy . |
| 119 | + # pass_filenames: false |
| 120 | + # # IMPORTANT! |
| 121 | + # # Keep args same as tool.mypy section in pyproject.toml |
| 122 | + # args: |
| 123 | + # [ |
| 124 | + # --allow-subclassing-any, |
| 125 | + # --allow-untyped-decorators, |
| 126 | + # --check-untyped-defs, |
| 127 | + # --exclude, ".*migrations/.*.py", |
| 128 | + # --exclude, "backend/prompt/.*", |
| 129 | + # --exclude, "document_display_service/.*", |
| 130 | + # --exclude, "pkgs/unstract-connectors/tests/.*", |
| 131 | + # --exclude, "pkgs/unstract-core/.*", |
| 132 | + # --exclude, "pkgs/unstract-flags/src/unstract/flags/.*", |
| 133 | + # --exclude, "sdks/.*", |
| 134 | + # --exclude, "unstract-document-service/.*", |
| 135 | + # --exclude, "__pypackages__/.*", |
| 136 | + # --follow-imports, "silent", |
| 137 | + # --ignore-missing-imports, |
| 138 | + # --implicit-reexport, |
| 139 | + # --pretty, |
| 140 | + # --python-version=3.9, |
| 141 | + # --show-column-numbers, |
| 142 | + # --show-error-codes, |
| 143 | + # --strict, |
| 144 | + # --warn-redundant-casts, |
| 145 | + # --warn-return-any, |
| 146 | + # --warn-unreachable, |
| 147 | + # --warn-unused-configs, |
| 148 | + # --warn-unused-ignores, |
| 149 | + # ] |
| 150 | + - repo: https://github.com/igorshubovych/markdownlint-cli |
| 151 | + rev: v0.39.0 |
| 152 | + hooks: |
| 153 | + - id: markdownlint |
| 154 | + args: [--disable, MD013] |
| 155 | + - id: markdownlint-fix |
| 156 | + args: [--disable, MD013] |
| 157 | + - repo: https://github.com/pdm-project/pdm |
| 158 | + rev: 2.12.3 |
| 159 | + hooks: |
| 160 | + - id: pdm-lock-check |
0 commit comments