Files
docling/.pre-commit-config.yaml
geoHeil 5b1df788ef ci: tighten pre-commit guardrails (#3346)
* ci: tighten pre-commit guardrails

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: validate pre-commit guardrail changes

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: switch hook validation to prek

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: exempt active slim plan from max-lines

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: move max-lines config under github

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: fail on uncovered tach modules

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: ignore generated docs in max-lines check

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: clarify local validation tasks

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* docs: refine agent instructions

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: replace mypy with ty

(cherry picked from commit 382afbde8f00abfaeba95ea9c8e9cc603f27a2d9)
Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

* ci: replace justfile with makefile

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>

---------

Signed-off-by: Georg Heiler <georg.kf.heiler@gmail.com>
2026-05-08 15:07:11 +02:00

66 lines
2.3 KiB
YAML

fail_fast: true
minimum_pre_commit_version: "3.7.0"
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
files: '^(docling|docs/examples|tests)/.*\.py$|^(\.pre-commit-config\.yaml|pyproject\.toml|tach\.toml)$'
- id: end-of-file-fixer
files: '^(docling|docs/examples|tests)/.*\.py$|^(\.pre-commit-config\.yaml|pyproject\.toml|tach\.toml)$'
- id: check-yaml
args: [--unsafe]
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=5120]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
hooks:
# Run the Ruff formatter.
- id: ruff-format
name: "Ruff formatter"
args: [--config=pyproject.toml]
files: '^(docling|tests|docs/examples).*\.(py|ipynb)$'
# Run the Ruff linter.
- id: ruff
name: "Ruff linter"
args: [--exit-non-zero-on-fix, --fix, --config=pyproject.toml]
files: '^(docling|tests|docs/examples).*\.(py|ipynb)$'
- repo: local
hooks:
- id: ty
name: ty
entry: uv run --no-sync ty check
language: system
files: '^(docling|\.github/scripts)/.*\.py$'
- id: tach
name: Tach
entry: uv run --no-sync tach check
pass_filenames: false
language: system
files: '^docling/.*\.py$|^tach\.toml$'
- id: tach-module-coverage
name: Tach module coverage
entry: python3 scripts/check_tach_module_coverage.py
pass_filenames: false
language: system
files: '^docling/.*\.py$|^tach\.toml$|^scripts/check_tach_module_coverage\.py$'
- id: max-lines
name: Check max lines per file
entry: python3 scripts/check_max_lines.py
language: system
files: '\.(py|ts|tsx|js|jsx|rs|json|sql|md|txt|yaml|yml)$'
pass_filenames: true
- id: dprint
name: Dprint check
entry: uv run --no-sync dprint check --config .github/dprint.json --config-discovery=false
pass_filenames: false
language: system
files: '^(\.github/dprint\.json|tach\.toml)$'
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.8.3
hooks:
- id: uv-lock